cv.nclreg {mpath} | R Documentation |
Cross-validation for nclreg
Description
Does k-fold cross-validation for nclreg, produces a plot,
and returns cross-validated loss values for lambda
Usage
## S3 method for class 'formula'
cv.nclreg(formula, data, weights, offset=NULL, ...)
## S3 method for class 'matrix'
cv.nclreg(x, y, weights, offset=NULL, ...)
## Default S3 method:
cv.nclreg(x, ...)
## S3 method for class 'cv.nclreg'
plot(x,se=TRUE,ylab=NULL, main=NULL, width=0.02, col="darkgrey", ...)
## S3 method for class 'cv.nclreg'
coef(object,which=object$lambda.which, ...)
Arguments
formula |
symbolic description of the model, see details. |
data |
argument controlling formula processing
via |
x |
|
y |
response |
weights |
Observation weights; defaults to 1 per observation |
offset |
Not implemented yet |
object |
object of |
which |
Indices of the penalty parameter |
se |
logical value, if |
ylab |
ylab on y-axis |
main |
title of plot |
width |
width of lines |
col |
color of standard error curve |
... |
Other arguments that can be passed to |
Details
The function runs nclreg
nfolds
+1 times; the
first to compute the lambda
sequence, and then to
compute the fit with each of the folds omitted. The error or the loss value is
accumulated, and the average value and standard deviation over the
folds is computed. Note that cv.nclreg
can be used to search for
values for alpha
: it is required to call cv.nclreg
with a fixed vector foldid
for different values of alpha
.
Value
an object of class "cv.nclreg"
is returned, which is a
list with the ingredients of the cross-validation fit.
fit |
a fitted nclreg object for the full data. |
residmat |
matrix of loss values with row values for |
bic |
matrix of BIC values with row values for |
cv |
The mean cross-validated loss values - a vector of length
|
cv.error |
estimate of standard error of |
foldid |
an optional vector of values between 1 and |
lambda |
a vector of |
lambda.which |
index of |
lambda.optim |
value of |
Author(s)
Zhu Wang <zwang145@uthsc.edu>
References
Zhu Wang (2021), MM for Penalized Estimation, TEST, doi: 10.1007/s11749-021-00770-2
See Also
nclreg
and plot
, predict
, and coef
methods for "cv.nclreg"
object.