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

    Function glmPredict

    • Predictions of a generalized linear model with their standard errors, for a glm fit. Equivalent to R's predict(fit, newdata, type, se.fit = TRUE). Aliased columns are left out, as R does.

      Parameters

      Returns { fit: number[]; nonEstimable?: number[]; seFit: number[]; warnings?: string[] }

      • fit: number[]

        Predictions on the scale of type, one per row.

      • OptionalnonEstimable?: number[]

        0-based rows of newdata whose prediction is not estimable from a rank-deficient fit (R's attr(, "non-estim")); present only when there are some.

      • seFit: number[]

        Their standard errors (R's se.fit).

      • Optionalwarnings?: string[]

        R's warning for those rows; present only when there are some.

      const fit = glm([1, 2, 3, 4, 5, 6], [0, 0, 1, 0, 1, 1], { family: "binomial" });
      glmPredict(fit, { newdata: [7] }); // { fit: [4.2491], seFit: [3.3878] }
      glmPredict(fit, { newdata: [7], type: "response" }).fit; // [0.98592]