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

    Function predict

    • Predictions of a linear model at new values of the predictors, with standard errors and optionally intervals, for an lm fit (se.fit = TRUE). Equivalent to R's predict(). Aliased columns are left out, as R does.

      Parameters

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

      • fit: number[]

        Predicted values, one per row of newdata.

      • Optionallwr?: number[]

        Lower limits of the intervals (absent with interval: "none").

      • 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[]

        Standard errors of the predicted means (R's se.fit).

      • Optionalupr?: number[]

        Upper limits of the intervals (absent with interval: "none").

      • Optionalwarnings?: string[]

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

      const fit = lm([1, 2, 3, 4, 5], [2.1, 3.9, 6.2, 7.8, 10.1]);
      predict(fit, [6, 7]); // { fit: [11.99, 13.98], seFit: [0.19807, 0.25338] }
      predict(fit, [6], { interval: "prediction" }); // { lwr: [11.119], upr: [12.861] }