Learn R Programming

iprior (version 0.6.5)

predict: Predict for I-prior models.

Description

Calculated predicted values of an I-prior model for a set of new data. If no new data specified, then the fitted values are returned. When not using the formula interface to fit the model, then the new data supplied for predict must be coerced into a list.

Usage

# S3 method for ipriorMod
predict(object, newdata = list(), ...)

Arguments

object

Objects of class ipriorMod.

newdata

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

Note that when using non-formula to fit, the explanatory variables must be supplied in a list, such as newdata = list(x1.new, x2.new, x3.new).

...

This is not used here.

Examples

Run this code
# Non-formula fit
mod <- iprior(y = stack.loss,
                        air = stack.x[,1],
                        water = stack.x[,2],
                        acid = stack.x[,3])
predict(mod, newdata = list(air = 58, water = 20, acid = 87))

# Formula fit
mod.orange <- iprior(circumference ~ . ^ 2, data = Orange[-1, ])
predict(mod.orange, Orange[1, ])

Run the code above in your browser using DataLab