predict.islasso {islasso}R Documentation

Prediction method for islasso fitted objects

Description

Prediction method for islasso fitted objects

Usage

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

Arguments

object

a fitted object of class "islasso".

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.

newdata

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

...

further arguments passed to or from other methods.

Value

An object depending on the type argument

Examples

## Not run: 
 set.seed(1)
 n <- 100
 p <- 100
 p1 <- 20  #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)
 lambda <- 2
 o <- islasso(y~X, family=gaussian, lambda=lambda)
 predict(o)

 ###prediction of new dataset
 newdata <- matrix(rnorm(n*p), n, p)
 predict(o, type="response", newdata=newdata)

## End(Not run)

[Package islasso version 1.1.0 Index]