Internal function to conduct k-fold cross-validation for nclreg, produces a plot,
and returns cross-validated log-likelihood values for lambda
cv.nclreg_fit(x, y, weights, lambda=NULL, balance=TRUE,
rfamily=c("clossR", "closs", "gloss", "qloss"), s=1.5, nfolds=10, foldid,
type = c("loss", "error"), plot.it=TRUE, se=TRUE, n.cores=2, ...)
x
matrix as in nclreg
.
response y
as in nclreg
.
Observation weights; defaults to 1 per observation
Optional user-supplied lambda sequence; default is
NULL
, and nclreg
chooses its own sequence
for rfamily="closs", "gloss", "qloss"
only
response variable distribution and nonconvex loss function
nonconvex loss tuning parameter for robust regression and classification.
number of folds >=3, default is 10
an optional vector of values between 1 and nfold
identifying what fold each observation is in. If supplied,
nfold
can be missing and will be ignored.
cross-validation criteria. For type="loss"
, loss function values and type="error"
is misclassification error.
a logical value, to plot the estimated log-likelihood values if TRUE
.
a logical value, to plot with standard errors.
The number of CPU cores to use. The cross-validation loop will attempt to send different CV folds off to different cores.
Other arguments that can be passed to nclreg
.
an object of class "cv.nclreg"
is returned, which is a
list with the ingredients of the cross-validation fit.
a fitted nclreg object for the full data.
matrix of log-likelihood values with row values for lambda
and column values for k
th cross-validation
The mean cross-validated log-likelihood values - a vector of length
length(lambda)
.
estimate of standard error of cv
.
an optional vector of values between 1 and nfold
identifying what fold each observation is in.
a vector of lambda
values
index of lambda
that gives minimum cv
value.
value of lambda
that gives minimum cv
value.
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 log-likelihood 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
.
nclreg
and plot
, predict
, and coef
methods for "cv.nclreg"
object.