msasnet: Multi-Step Adaptive SCAD-Net

Description Usage Arguments Value Author(s) Examples

View source: R/msasnet.R

Description

Multi-Step Adaptive SCAD-Net

Usage

1
2
3
4
5
6
msasnet(x, y, family = c("gaussian", "binomial", "poisson", "cox"),
  init = c("snet", "ridge"), gammas = 3.7, alphas = seq(0.05, 0.95, 0.05),
  tune = c("cv", "ebic", "bic", "aic"), nfolds = 5L, ebic.gamma = 1,
  nsteps = 2L, tune.nsteps = c("max", "ebic", "bic", "aic"),
  ebic.gamma.nsteps = 1, scale = 1, eps = 1e-04, max.iter = 10000L,
  seed = 1001, parallel = FALSE, verbose = FALSE)

Arguments

x

Data matrix.

y

Response vector if family is "gaussian", "binomial", or "poisson". If family is "cox", a response matrix created by Surv.

family

Model family, can be "gaussian", "binomial", "poisson", or "cox".

init

Type of the penalty used in the initial estimation step. Can be "snet" or "ridge".

gammas

Vector of candidate gammas (the concavity parameter) to use in SCAD-Net. Default is 3.7.

alphas

Vector of candidate alphas to use in SCAD-Net.

tune

Parameter tuning method for each estimation step. Possible options are "cv", "ebic", "bic", and "aic". Default is "cv".

nfolds

Fold numbers of cross-validation when tune = "cv".

ebic.gamma

Parameter for Extended BIC penalizing size of the model space when tune = "ebic", default is 1. For details, see Chen and Chen (2008).

nsteps

Maximum number of adaptive estimation steps. At least 2, assuming adaptive SCAD-net has only one adaptive estimation step.

tune.nsteps

Optimal step number selection method (aggregate the optimal model from the each step and compare). Options include "max" (select the final-step model directly), or compare these models using "ebic", "bic", or "aic". Default is "max".

ebic.gamma.nsteps

Parameter for Extended BIC penalizing size of the model space when tune.nsteps = "ebic", default is 1.

scale

Scaling factor for adaptive weights: weights = coefficients^(-scale).

eps

Convergence threshhold to use in SCAD-net.

max.iter

Maximum number of iterations to use in SCAD-net.

seed

Random seed for cross-validation fold division.

parallel

Logical. Enable parallel parameter tuning or not, default is FALSE. To enable parallel tuning, load the doParallel package and run registerDoParallel() with the number of CPU cores before calling this function.

verbose

Should we print out the estimation progress?

Value

List of model coefficients, ncvreg model object, and the optimal parameter set.

Author(s)

Nan Xiao <https://nanx.me>

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
dat = msaenet.sim.gaussian(
  n = 150, p = 500, rho = 0.6,
  coef = rep(1, 5), snr = 2, p.train = 0.7,
  seed = 1001)

msasnet.fit = msasnet(
  dat$x.tr, dat$y.tr,
  alphas = seq(0.3, 0.9, 0.3),
  nsteps = 3L, seed = 1003)

print(msasnet.fit)
msaenet.nzv(msasnet.fit)
msaenet.fp(msasnet.fit, 1:5)
msaenet.tp(msasnet.fit, 1:5)
msasnet.pred = predict(msasnet.fit, dat$x.te)
msaenet.rmse(dat$y.te, msasnet.pred)
plot(msasnet.fit)

Example output

Call: msasnet(x = dat$x.tr, y = dat$y.tr, alphas = seq(0.3, 0.9, 0.3), 
    nsteps = 3L, seed = 1003) 
  Df    Lambda Gamma Alpha
1  6 0.2931289   3.7   0.6
[1]   2   3   4   5 114 379
[1] 2
[1] 4
[1] 2.258146

msaenet documentation built on May 14, 2018, 9:04 a.m.