Add LP to dataset, update the estimator for handling LP, and find initialisation.
1 |
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 27 28 | m <- lvm()
m <- regression(m,y='y1',x='x'%++%1:2)
m <- regression(m,y='y1',x='z'%++%1:5)
# simul
set.seed(10)
d <- sim(m,5e2)
d <- as.data.frame(scale(d))
suppressWarnings(
start <- coef(estimate(m, data = d, control = list(iter.max = 0)))
)
# penalized lvm
mp <- penalize(m)
system.time(
lassoLVM <- estimate(mp, data = d, lambda1 = 10, control = list(trace = 2, start = start[coef(mp)], iter.max = 1), estimator = "gaussian2")
)
# reduced penalized lvm
mp.red <- reduce(mp)
system.time(
lassoRLVM <- estimate(mp.red, data = d, lambda1 = 10, control = list(trace = 2, start = start[coef(mp.red)], iter.max = 1))
)
coef(lassoRLVM)-coef(lassoLVM)[names(coef(lassoRLVM))]
lassoRLVM$opt$iterations
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.