Learn R Programming

islasso (version 1.5.2)

predict.islasso.path: Prediction method for islasso.path fitted objects

Description

Prediction method for islasso fitted objects

Usage

# S3 method for islasso.path
predict(object, newdata, type = c("link", "response",
  "coefficients", "class"), lambda, ...)

Value

An object depending on the type argument

Arguments

object

a fitted object of class "islasso.path".

newdata

optionally, a data frame in which to look for variables with which to predict. If omitted, the fitted linear predictors are used.

type

the type of prediction required. The default is on the scale of the linear predictors; the alternative "response" is on the scale of the response variable. Thus for a default binomial model the default predictions are of log-odds (probabilities on logit scale) and type = "response" gives the predicted probabilities. The coefficients option returns coefficients. Type "class" applies only to "binomial" models, and produces the class label.

lambda

Value(s) of the penalty parameter lambda at which predictions are required. Default is the entire sequence used to create the model.

...

further arguments passed to or from other methods.

Author

Maintainer: Gianluca Sottile <gianluca.sottile@unipa.it>

See Also

islasso.path, islasso.path.fit, coef.islasso.path, residuals.islasso.path, GoF.islasso.path, logLik.islasso.path, fitted.islasso.path, summary.islasso.path and deviance.islasso.path methods.

Examples

Run this code
if (FALSE) {
 set.seed(1)
 n <- 100
 p <- 30
 p1 <- 10  #number of nonzero coefficients
 coef.veri <- sort(round(c(seq(.5, 3, l=p1/2), seq(-1, -2, l=p1/2)), 2))
 sigma <- 1

 coef <- c(coef.veri, rep(0, p-p1))

 X <- matrix(rnorm(n*p), n, p)
 mu <- drop(X%*%coef)
 y <- mu + rnorm(n, 0,sigma)

 o <- islasso.path(y ~ ., data = data.frame(y = y, X), 
                   family = gaussian())
 temp <- GoF.islasso.path(o)
 predict(o, type = "response", lambda = temp$lambda.min)
}

Run the code above in your browser using DataLab