predict.extlasso: Prediction of coefficients of a penalized linear regression...

View source: R/extlasso.R

predict.extlassoR Documentation

Prediction of coefficients of a penalized linear regression or generalized linear models

Description

The function computes estimated coefficients value at a given lambda or L1 norm or fraction of norm using a ‘extlasso’ object obtained using ‘extlasso’ function.

Usage

## S3 method for class 'extlasso'
predict(object,mode=c("fraction","norm","lambda"),at=0,...)

Arguments

object

A ‘extlasso’ object obtained using ‘extlasso’ function.

mode

If mode="lambda", prediction is made for a given lambda, if mode="norm", prediction is made for a given L1 norm and if mode="fraction", prediction is made for a fraction of norm value. Default is mode="lambda"

at

A value at which prediction is to be made. Default is at = 0.

...

Not used. Other arguments to predict.

Value

A vector of estimated coefficients of length p or p+1 at the given value of lambda or L1 norm or fraction of norm, depending on intercept=TRUE or FALSE in ‘extlasso’ object. Here p is number of predictor variables.

Author(s)

B N Mandal and Jun Ma

References

Mandal, B.N. and Jun Ma, (2014). A Jacobi-Armijo Algorithm for LASSO and its Extensions.

Examples

x=matrix(rnorm(100*30),100,30)
y=sample(c(0,1),100,replace=TRUE)
g1=extlasso(x,y,family="binomial")
predict(g1,mode="lambda",at=0.1)
predict(g1,mode="L1norm",at=1)
predict(g1,mode="fraction",at=0.5)
x=matrix(rnorm(100*30),100,30)
y=rnorm(100)
g1=extlasso(x,y,family="normal")
predict(g1,mode="lambda",at=0.09)
predict(g1,mode="L1norm",at=0.6)
predict(g1,mode="fraction",at=0.8)

extlasso documentation built on May 13, 2022, 9:08 a.m.