Description Usage Arguments Details Value Examples
Does k
-fold cross-validation for fwelnet
.
1 2 3 4 5 6 7 8 9 10 11 12 13 |
x |
|
y |
|
z |
|
family |
Response type. Either |
lambda |
A user supplied |
type.measure |
Loss to use for cross-validation. Currently five options, not all available for all models. The default is type.measure="deviance", which uses squared-error for gaussian models (a.k.a type.measure="mse" there) and deviance for logistic regression. type.measure="class" applies to binomial logistic regression only, and gives misclassification error. type.measure="auc" is for two-class logistic regression only, and gives area under the ROC curve. type.measure="mse" or type.measure="mae" (mean absolute error) can be used by all models. |
nfolds |
Number of folds for CV (default is 10). Although |
foldid |
An optional vector of values between 1 and |
keep |
If |
verbose |
Print information as model is being fit? Default is FALSE. |
... |
Other arguments that can be passed to |
This function runs fwelnet nfolds+1
times: the first to get the
lambda
sequence, and the remaining nfolds
times to compute the
fit with each of the folds omitted. The error is accumulated, and the mean
error and standard deviation over the folds is computed. Note that
cv.pcLasso
does NOT search for values of alpha
. A specific
value of alpha
should be supplied.
An object of class "cv.fwelnet"
, which is a list with the
ingredients of the cross-validation fit.
glmfit |
A fitted |
lambda |
The values of |
nzero |
The number of non-zero coefficients in the model |
fit.preval |
If |
cvm |
The mean cross-validated error: a vector of length
|
cvsd |
Estimate of standard error of |
cvlo |
Lower curve = |
cvup |
Upper curve = |
lambda.min |
The value of |
lambda.1se |
The largest value of |
foldid |
If |
name |
Name of error measurement used for CV. |
call |
The call that produced this object. |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | set.seed(1)
n <- 100; p <- 20
x <- matrix(rnorm(n * p), n, p)
beta <- matrix(c(rep(2, 5), rep(0, 15)), ncol = 1)
y <- x %*% beta + rnorm(n)
z <- cbind(1, abs(beta) + rnorm(p))
cvfit1 <- cv.fwelnet(x, y, z)
# change no. of CV folds
cvfit2 <- cv.fwelnet(x, y, z, nfolds = 5)
# specify which observations are in each fold
foldid <- sample(rep(seq(5), length = length(y)))
cvfit3 <- cv.fwelnet(x, y, z, foldid = foldid)
# keep=TRUE to have pre-validated fits and foldid returned
cvfit4 <- cv.fwelnet(x, y, z, keep = TRUE)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.