stability.test: Instability tests

View source: R/stability.test.R

stability.testR Documentation

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

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.

Value

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

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


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

glmvsd documentation built on Aug. 14, 2022, 9:05 a.m.