View source: R/stability.test.R
stability.test | R Documentation |
This function calculate the sequential, parametric bootstrap and perturbation instability measures for linear regression with Lasso, SCAD and MCP penalty.
stability.test(x, y, method = c("seq", "bs", "perturb"), penalty = c("LASSO", "SCAD", "MCP"), nrep = 50, remove = 0.2, tau = 0.5, nfolds = 5, family=c("gaussian","binomial"))
x |
Matrix of predictors. |
y |
Response variable. |
method |
Type of instability measures. |
penalty |
Penalty function. |
nrep |
Number of repetition for calculating instability, default is 50. |
remove |
The portion of observation to be removed when the sequential instability is calculated, default is 0.2. |
tau |
The size of perturbation when perturbation instability is calculated. The range of |
nfolds |
number of folds - default is 5. |
family |
Choose the family for the instability test. So far only |
See Reference section.
Return the instability index according to the type of instability measures.
Nan, Y. and Yang, Y. (2013), "Variable Selection Diagnostics Measures for High-dimensional Regression," Journal of Computational and Graphical Statistics, 23:3, 636-656.
BugReport: https://github.com/emeryyi/glmvsd
# generate simulation data n <- 50 p <- 8 beta<-c(2.5,1.5,0.5,rep(0,5)) sigma<-matrix(0,p,p) for(i in 1:p){ for(j in 1:p) sigma[i,j] <- 0.5^abs(i-j) } x <- mvrnorm(n, rep(0,p), sigma) e <- rnorm(n) y <- x %*% beta + e ins_seq <- stability.test(x, y, method = "seq", penalty = "SCAD", nrep = 20, remove = 0.1, tau = 0.2, nfolds = 5)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.