predict.lars.glm: Function to make predictions from lars.glm fit

Description Usage Arguments Value Author(s) References See Also Examples

View source: R/funcs.R

Description

Function to make predictions from lars.glm fit

Usage

1
2
## S3 method for class 'lars.glm'
predict(object, x, lambda, time=NULL, status = NULL, ...)

Arguments

object

Result of call to lars.glm

x

N by p matrix of predictors

lambda

Value of L1- regularization parameter at which predictions are desired

time

Optional N-vector of survival times, required for Cox Proportional hazards model.

status

Optional N-vector of censoring indicators, required for Cox Proportional hazards model. 1=failed; 0=censored.

...

additional arguments (not used)

Value

Vector of predicted values, on the linear predictor scale.

Author(s)

Rob Tibshirani

References

Park, M.Y. and Hastie, T. (2007) 1l regularization path algorithm for generalized linear models. JRSSB B 69(4), 659-677

See Also

lars.glm, covTest

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
#logistic
x=matrix(rnorm(100*10),ncol=10)
x=scale(x,TRUE,TRUE)/sqrt(99)
y=4*x[,2]+rnorm(100)
y=1*(y>0)
a=lars.glm(x,y,family="binomial")
yhat=predict.lars.glm(a,x,family="binomial")

# Cox model
#y=6*x[,2]+rnorm(100)+10
#status=sample(c(0,1),size=length(y),replace=TRUE)
#a=lars.glm(x,y,status=status,family="cox")
#yhat=predict.lars.glm(a,x,family="cox")

Example output

Loading required package: lars
Loaded lars 1.2

Loading required package: glmnet
Loading required package: Matrix
Loading required package: foreach
Loaded glmnet 2.0-16

Loading required package: glmpath
Loading required package: survival
Loading required package: MASS
Warning message:
In predict.glmpath(object$pathobj, x, s = lambda, mode = "lambda",  :
  no s argument; mode switched to step

covTest documentation built on May 29, 2017, 8:30 p.m.