covTest: Compute the covariance test for adaptive linear modelling

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

View source: R/funcs.R

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

1
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.

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.

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

Note

This function requires the lars R library (for the Gaussian case), and the glmpath function for the logistic and Cox model.

Author(s)

Rob Tibshirani

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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
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)

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