Description Usage Arguments Value Author(s) Examples
View source: R/msaenet-inspect.R
Get the indices of non-zero variables from msaenet model objects.
1 | msaenet.nzv(object)
|
object |
An object of class |
Indices vector of non-zero variables in the model.
Nan Xiao <https://nanx.me>
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | dat <- msaenet.sim.gaussian(
n = 150, p = 500, rho = 0.6,
coef = rep(1, 5), snr = 2, p.train = 0.7,
seed = 1001
)
msaenet.fit <- msaenet(
dat$x.tr, dat$y.tr,
alphas = seq(0.2, 0.8, 0.2),
nsteps = 3L, seed = 1003
)
msaenet.nzv(msaenet.fit)
# coefficients of non-zero variables
coef(msaenet.fit)[msaenet.nzv(msaenet.fit)]
|
[1] 2 3 4 5 35 114 171 312 379 441 464 500
[1] 1.5676827 0.7983849 1.2047923 0.9912135 0.1679623 -0.5600420
[7] 0.6189521 -0.5053576 -0.7342114 -0.3172814 -0.3886030 -0.1883070
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.