Learn R Programming

glmvsd (version 1.5)

stability.test: Instability tests

Description

This function calculate the sequential, parametric bootstrap and perturbation instability measures for linear regression with Lasso, SCAD and MCP penalty.

Usage

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"))

Value

Return the instability index according to the type of instability measures.

Arguments

x

Matrix of predictors.

y

Response variable.

method

Type of instability measures. seq = sequential instability, bs = parametric bootstrap instability, and perturb = perturbation instability.

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 tau is (0,1), default is 0.5

nfolds

number of folds - default is 5.

family

Choose the family for the instability test. So far only gaussian, binomial and tweedie are implemented. The default is gaussian.

Details

See Reference section.

References

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

Examples

Run this code

# 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)

Run the code above in your browser using DataLab