Skip to contents

Predict from a morie_lm, optionally with intervals

Usage

# S3 method for class 'morie_lm'
predict(
  object,
  newdata = NULL,
  interval = c("none", "confidence", "prediction"),
  level = 0.95,
  ...
)

Arguments

object

A morie_lm.

newdata

Data to predict for (defaults to the training data).

interval

"none", "confidence", or "prediction" (RE4.14).

level

Interval coverage.

...

Unused.

Value

A numeric vector (interval = "none") or a data.frame with fit, lwr, upr columns; interval widths quantify forecast error.

Examples

m <- morie_lm(mpg ~ hp, mtcars)
predict(m, interval = "prediction")[1:3, ]
#>                    fit      lwr      upr
#> Mazda RX4     22.59375 14.54641 30.64109
#> Mazda RX4 Wag 22.59375 14.54641 30.64109
#> Datsun 710    23.75363 15.66562 31.84164