lassoTest: Significance test for the lasso

Description Usage Arguments Details References Examples

Description

Significance test while performing variable selection with the lasso

Usage

1
2
3
4
lassoTest(x, ...)

## S3 method for class 'plvmfit'
lassoTest(x, ...)

Arguments

x

a penalized latent variable model contain

Details

It is essentially a copy of the covTest function of the covTest package.

References

R. Lockhart, J. Taylor, R. J. Tibshirani and R. Tibshirani. A significance test for the lasso. Ann Stat. 2014 42(2):413-468

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
m <- lvm(Y ~ X1+X2+X3+X4+X5)

## simulation
set.seed(10)
mSim <- m
regression(mSim, Y~X1+X2+X3+X4+X5) <- list(1,0,0,0.1,0.5)
df <- sim(mSim,50)
dfs <- as.data.frame(scale(df))

## lvm
pm <- penalize(m)
res <- estimate(pm, data = dfs, regularizationPath = TRUE)
plot(res, type = "path")
getPath(res)
lassoTest(res)

penalized.PathL1 <- penalized(Y ~  ., data = dfs, steps = "Park", trace = FALSE)
seq_lambda <- unlist(lapply(penalized.PathL1, function(x){x@lambda1}))
n.lambda <- length(seq_lambda)

if(require(covTest)){
 m.lars <- lars(y = dfs[,1], x = as.matrix(dfs[,-1]), type = "lasso")
 a <- covTest(fitobj = m.lars, x = as.matrix(dfs[,-1]), y = dfs[,1])
 # covTestLasso(beta = m.lars$beta, lambda = m.lars$lambda, Y = dfs[,1], X = as.matrix(dfs[,-1]))
 # one difference with the LVM version is that p doesn't count the intercept
}

bozenne/lava.penalty documentation built on May 13, 2019, 1:41 a.m.