Learn R Programming

msaenet (version 2.1)

msasnet: Multi-Step Adaptive SCAD-Net

Description

Multi-Step Adaptive SCAD-Net

Usage

msasnet(x, y, family = c("gaussian", "binomial", "poisson", "cox"), init = c("snet", "ridge"), nsteps = 2L, nfolds = 5L, gammas = c(2.01, 2.3, 3.7, 200), alphas = seq(0.05, 0.95, 0.05), eps = 1e-04, max.iter = 10000L, gamma = 1, 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 made 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".
nsteps
How many adaptive estimation steps? At least 2. We assume adaptive SCAD-net has only 1 adaptive estimation step.
nfolds
Fold numbers of cross-validation.
gammas
Vector of candidate gammas to use in SCAD-Net.
alphas
Vector of candidate alphas to use in SCAD-Net.
eps
Convergence threshhold to use in SCAD-net.
max.iter
Maximum number of iterations to use in SCAD-net.
gamma
Scaling factor for adaptive weights: weights = coefs^(-gamma).
seed
Two random seeds for cross-validation fold division in two estimation steps.
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 coefficients beta and ncvreg model object model.

Examples

Run this code
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,
                      gammas = 3.7, 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)

Run the code above in your browser using DataLab