rStats.js v1.3.0
    Preparing search index...

    Function glmResiduals

    • Residuals of a generalized linear model, one per row, for a glm fit (default "deviance"). Equivalent to R's residuals(fit, type). The kind is the second argument or the option type (giving both is a RangeError).

      Parameters

      Returns number[]

      const fit = glm([1, 2, 3, 4, 5, 6], [0, 0, 1, 0, 1, 1], { family: "binomial" });
      glmResiduals(fit); // [-0.30644, -0.54776, 1.4436, -1.4436, 0.54776, 0.30644]
      glmResiduals(fit, "pearson"); // [-0.21925, -0.40231, 1.3546, -1.3546, 0.40231, 0.21925]
    • Residuals of a generalized linear model, with the kind in the options: glmResiduals(fit, { type: "pearson" }).

      Parameters

      Returns number[]

      const fit = glm([1, 2, 3, 4, 5, 6], [0, 0, 1, 0, 1, 1], { family: "binomial" });
      glmResiduals(fit, { type: "pearson" }); // [-0.21925, -0.40231, 1.3546, -1.3546, 0.40231, 0.21925]