covTest (version 1.02)

covTest: Compute the covariance test for adaptive linear modelling

Description

This function computes covariance test for inference in adaptive linear modelling, for lasso (least angle regression) in the Gaussian case, binomial/logistic and Cox proportional hazards survival models. This package should be considered EXPERIMENTAL. The background paper is not yet published and rigorous theory does not yet exist for the logistic and Cox models. We have currently disabled the Cox option, as it is not yet reliable.

Usage

covTest(fitobj, x, y, sigma.est = "full", status = NULL, maxp=min(nrow(x),ncol(x)))

Arguments

fitobj
Result of a call to lars or lars.en or lars.glm
x
N by p matrix of predictors
y
N-vector of outcome values
sigma.est
Estimate of error standard deviation. If a numerical value, that value if used. If "full" the (square root) of the mean squared residual from the full model is used.
status
Optional N-vector of censoring indicators for Cox Proportional hazards model. 1=failed; 0=censored.
maxp
Optional limit for number of steps to be analyzed.

Value

results
Table of covariance test values and p-values, for each predictor entered
sigma
Estimate of sigma used
null.dist
Null distribution used to compute p-values

Details

This function computes covariance test for inference in adaptive linear modelling, for lasso (least angle regression) in the Gaussian case, binomial/logistic and Cox proportional hazards survival models. It estimates p-values for each predictor entered, that account for the adpative nature of the fitting.

References

A significance test for the lasso (2013). Lockhart, R., Taylor, J., Tibshirani (Ryan) and Tibshirani (Robert)

See Also

lars, lars.en, lars.glm

Examples

Run this code


set.seed(1234)
x=matrix(rnorm(100*10),ncol=10)
x=scale(x,TRUE,TRUE)/sqrt(99)
beta=c(4,rep(0,9))
y=x%*%beta+.4*rnorm(100)

#Gaussian
a=lars(x,y)
covTest(a,x,y)

#EN
a=lars.en(x,y,lambda2=1)
covTest(a,x,y)

#logistic
y=1*(y>0)

a=lars.glm(x,y,family="binomial")
covTest(a,x,y)


# 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")
#covTest(a,x,y,status=status)

Run the code above in your browser using DataCamp Workspace