Fits the SparseStep model for a chosen values of the regularization parameter.
sparsestep(
x,
y,
lambda = c(0.1, 0.5, 1, 5, 10),
gamma0 = 1000,
gammastop = 1e-04,
IMsteps = 2,
gammastep = 2,
normalize = TRUE,
intercept = TRUE,
force.zero = TRUE,
threshold = 1e-07,
XX = NULL,
Xy = NULL,
use.XX = TRUE,
use.Xy = TRUE
)matrix of predictors
response
regularization parameter
starting value of the gamma parameter
stopping value of the gamma parameter
number of steps of the majorization algorithm to perform for each value of gamma
factor to decrease gamma with at each step
if TRUE, each variable is standardized to have unit L2 norm, otherwise it is left alone.
if TRUE, an intercept is included in the model (and not penalized), otherwise no intercept is included
if TRUE, absolute coefficients smaller than the provided threshold value are set to absolute zero as a post-processing step, otherwise no thresholding is performed
threshold value to use for setting coefficients to absolute zero
The X'X matrix; useful for repeated runs where X'X stays the same
The X'y matrix; useful for repeated runs where X'y stays the same
whether or not to compute X'X and return it (boolean)
whether or not to compute X'y and return it (boolean)
A "sparsestep" S3 object is returned, for which print, predict, coef, and plot methods exist. It has the following items:
The call that was used to construct the model.
The value(s) of lambda used to construct the model.
The gamma0 value of the model.
The gammastop value of the model
The IMsteps value of the model
The gammastep value of the model
Boolean indicating if an intercept was fitted in the model
Boolean indicating if a force zero-setting was performed.
The threshold used for a forced zero-setting
The resulting coefficients stored in a sparse matrix format (dgCMatrix). This matrix has dimensions nvar x nlambda
The intercept vector for each value of gamma of length nlambda
Vector used to normalize the columns of x
Vector of column means of x
The matrix X'X if use.XX was set to TRUE
The matrix X'y if use.Xy was set to TRUE
Van den Burg, G.J.J., Groenen, P.J.F. and Alfons, A. (2017). SparseStep: Approximating the Counting Norm for Sparse Regularization, arXiv preprint arXiv:1701.06967 [stat.ME]. URL https://arxiv.org/abs/1701.06967.
coef, print, predict,
plot, and path.sparsestep.
# NOT RUN {
x <- matrix(rnorm(100*20), 100, 20)
y <- rnorm(100)
fit <- sparsestep(x, y)
# }
Run the code above in your browser using DataLab