Fit a linear model via penalized nonconvex loss function. The regularization path is computed for the lasso (or elastic net penalty), scad (or snet) and mcp (or mnet penalty), at a grid of values for the regularization parameter lambda. The name refers to N onC onvex L oss with REG ularization.
## S3 method for class 'formula'nclreg(formula, data, weights, offset=NULL, contrasts=NULL,...)## S3 method for class 'matrix'nclreg(x, y, weights, offset=NULL,...)## Default S3 method:nclreg(x,...)
Arguments
formula: symbolic description of the model, see details.
data: argument controlling formula processing via model.frame.
weights: optional numeric vector of weights. If standardize=TRUE, weights are renormalized to weights/sum(weights). If standardize=FALSE, weights are kept as original input
x: input matrix, of dimension nobs x nvars; each row is an observation vector
y: response variable. Quantitative for rfamily="clossR" and -1/1 for classification.
offset: Not implemented yet
contrasts: the contrasts corresponding to levels from the respective models
...: Other arguments passing to nclreg_fit
Details
The sequence of robust models implied by lambda is fit by majorization-minimization along with coordinate descent. Note that the objective function is
weights∗loss+λ∗penalty,
if standardize=FALSE and
∑(weights)weights∗loss+λ∗penalty,
if standardize=TRUE.
Returns
An object with S3 class "nclreg" for the various types of models. - call: the call that produced this object
b0: Intercept sequence of length length(lambda)
beta: A nvars x length(lambda) matrix of coefficients.
lambda: The actual sequence of lambda values used
nobs: number of observations
risk: if type.path="nonactive", a matrix with number of rows iter and number of columns nlambda, loss values along the regularization path. If type.path="fast", a vector of length nlambda, loss values along the regularization path
pll: if type.path="nonactive", a matrix with number of rows iter and number of columns nlambda, penalized loss values along the regularization path. If type.path="fast", a vector of length nlambda, penalized loss values along the regularization path
fitted.values: predicted values depending on standardize, internal use only
References
Zhu Wang (2021), MM for Penalized Estimation, TEST, tools:::Rd_expr_doi("10.1007/s11749-021-00770-2")
print, predict, coef and plot methods, and the cv.nclreg function.
Examples
#binomialx=matrix(rnorm(100*20),100,20)g2=sample(c(-1,1),100,replace=TRUE)### different solution paths via a combination of type.path, decreasing and type.initfit1=nclreg(x,g2,s=1,rfamily="closs",type.path="active",decreasing=TRUE,type.init="bst")fit2=nclreg(x,g2,s=1,rfamily="closs",type.path="active",decreasing=FALSE,type.init="bst")fit3=nclreg(x,g2,s=1,rfamily="closs",type.path="nonactive",decreasing=TRUE,type.init="bst")fit4=nclreg(x,g2,s=1,rfamily="closs",type.path="nonactive",decreasing=FALSE,type.init="bst")fit5=nclreg(x,g2,s=1,rfamily="closs",type.path="active",decreasing=TRUE,type.init="ncl")fit6=nclreg(x,g2,s=1,rfamily="closs",type.path="active",decreasing=FALSE,type.init="ncl")fit7=nclreg(x,g2,s=1,rfamily="closs",type.path="nonactive",decreasing=TRUE,type.init="ncl")fit8=nclreg(x,g2,s=1,rfamily="closs",type.path="nonactive",decreasing=FALSE,type.init="ncl")