Learn R Programming

ggpmisc (version 0.6.0)

predict.lmodel2: Model Predictions

Description

predict is a generic function for predictions from the results of various model fitting functions. predict.lmodel2 is the method for model fit objects of class "lmodel2".

Usage

# S3 method for lmodel2
predict(
  object,
  method = "MA",
  newdata = NULL,
  interval = c("none", "confidence"),
  level = 0.95,
  ...
)

Value

If interval = "none" a numeric vector is returned, while if

interval = "confidence" a data frame with columns fit,

lwr and upr is returned.

Arguments

object

a fitted model object.

method

character One of the methods available in object.

newdata

An optional data frame in which to look for variables with which to predict. If omitted, the fitted values are used.

interval

Type of interval calculation.

level

the confidence level required. Currently only 0.95 accepted.

...

ignored by this method.

Details

Function lmodel2() from package 'lmodel2' returns a fitted model object of class "lmodel2" which differs from that returned by lm(). Here we implement a predict() method for objects of this class. It differs from the generic method and that for lm objects in having an additional formal parameter method that must be used to select which of the methods supported by lmodel2() are to be used in the prediction. The returned object is similar in its structure to that returned by predict.lm() but lacking names or rownames.

See Also

lmodel2