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.
# S3 method for formula
nclreg(formula, data, weights, offset=NULL, contrasts=NULL, ...)
# S3 method for matrix
nclreg(x, y, weights, offset=NULL, ...)
# S3 method for default
nclreg(x, ...)
symbolic description of the model, see details.
argument controlling formula processing
via model.frame
.
optional numeric vector of weights. If standardize=TRUE
, weights are renormalized to weights/sum(weights). If standardize=FALSE
, weights are kept as original input
input matrix, of dimension nobs x nvars; each row is an observation vector
response variable. Quantitative for rfamily="clossR"
and -1/1 for classification.
Not implemented yet
the contrasts corresponding to levels
from the
respective models
Other arguments passing to nclreg_fit
An object with S3 class "nclreg"
for the various types of models.
the call that produced this object
Intercept sequence of length length(lambda)
A nvars x
length(lambda)
matrix of coefficients.
The actual sequence of lambda
values used
number of observations
if type.path="naive"
, 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
if type.path="naive"
, 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
predicted values depending on standardize
, internal use only
The sequence of robust models implied by lambda
is fit by majorization-minimization along with coordinate
descent. Note that the objective function is $$1/2*weights*loss + \lambda*penalty,$$ if standardize=FALSE
and $$1/2*
\frac{weights}{\sum(weights)}*loss + \lambda*penalty,$$ if standardize=TRUE
.
print
, predict
, coef
and plot
methods, and the cv.nclreg
function.
# NOT RUN {
#binomial
x=matrix(rnorm(100*20),100,20)
g2=sample(c(-1,1),100,replace=TRUE)
fit=nclreg(x,g2,s=1,rfamily="closs")
# }
Run the code above in your browser using DataLab