predict.l1ce: Predict Method for 'l1ce' Objects

Description Usage Arguments Value Warning Examples

View source: R/predict.q

Description

This is a method for the generic function predict for class "l1ce", typically produced from l1ce(). When newdata is missing, the fitted values are extracted, otherwise returns new predictions.

Usage

1
2
3
## S3 method for class 'l1ce'
predict(object, newdata,
           type = c("response"), se.fit = FALSE, ...)

Arguments

object

a fitted l1ce object.

newdata

a data frame containing the values at which predictions are required. This argument can be missing, in which case predictions are made at the same values used to compute the object. Only those predictors referred to in the right side of the formula in object need be present by name in newdata.

type

currrently only "response".

se.fit

logical indicating if standard errors should be returned as well. Not yet available.

...

further potential arguments passed to methods.

Value

a vector of predictions.

Warning

predict can produce incorrect predictions when the newdata argument is used if the formula in object involves transformations, such as poly(Age, 3) or sqrt(Age - min(Age)).

MM: Not sure this is true for R ....

Examples

1
2
3
4
data(Iowa)
l1c.I <- l1ce(Yield ~ ., Iowa, bound = 10, absolute.t=TRUE)
p10 <- predict(l1c.I, newdata =   Iowa[10:19,])
stopifnot(all.equal(p10, fitted(l1c.I)[10:19]))

lasso2 documentation built on Oct. 8, 2021, 9:10 a.m.