Learn R Programming

pre (version 0.3.0)

predict.pre: Predicted values based on final unbiased prediction rule ensemble

Description

predict.pre generates predictions based on the final prediction rule ensemble, for training or new (test) observations

Usage

# S3 method for pre
predict(object, newdata = NULL, type = "link",
  penalty.par.val = "lambda.1se", ...)

Arguments

object

object of class pre.

newdata

optional dataframe of new (test) observations, including all predictor variables used for deriving the prediction rule ensemble.

type

character string. The type of prediction required; the default type = "link" is on the scale of the linear predictors. Alternatively, for nominal outputs, type = "response" gives the fitted probabilities and type = "class" gives the predicted class membership.

penalty.par.val

character. Penalty parameter criterion to be used for selecting final model: lambda giving minimum cv error ("lambda.min") or lambda giving cv error that is within 1 standard error of minimum cv error ("lambda.1se"). Alternatively, a numeric value may be specified, corresponding to one of the values of lambda in the sequence used by glmnet, for which estimated cv error can be inspected by running object$glmnet.fit and plot(object$glmnet.fit).

...

currently not used.

Details

When newdata is not provided, training data included in the specified object is used.

See Also

pre, plot.pre, coef.pre, importance, cvpre, interact, print.pre

Examples

Run this code
# NOT RUN {
set.seed(1)
train <- sample(1:sum(complete.cases(airquality)), size = 100)
set.seed(42)
airq.ens <- pre(Ozone ~ ., data = airquality[complete.cases(airquality),][train,])
predict(airq.ens)
predict(airq.ens, newdata = airquality[complete.cases(airquality),][-train,])
# }

Run the code above in your browser using DataLab