cv.nc.hdsvm | R Documentation |
Conducts k-fold cross-validation for the 'nc.hdsvm()' function.
cv.nc.hdsvm(x, y, lambda = NULL, nfolds = 5L, foldid, ...)
x |
A numerical matrix with dimensions ( |
y |
Response variable. |
lambda |
Optional user-supplied sequence of |
nfolds |
Number of folds in the cross-validation, default is 5. |
foldid |
An optional vector that assigns each observation to a specific fold.
If provided, this parameter overrides |
... |
Additional arguments passed to |
This function estimates the average cross-validation error and its standard error across folds. It is primarily used to
identify the optimal lambda
value for fitting nonconvex penalized SVM models.
An object of class cv.nc.hdsvm
is returned,
which is a list with the ingredients of the cross-validated fit.
lambda |
the values of |
cvm |
the mean cross-validated error - a vector of length |
cvsd |
estimate of standard error of |
cvupper |
upper curve = |
cvlower |
lower curve = |
nzero |
number of non-zero coefficients at each |
name |
a text string indicating type of measure (for plotting purposes). |
nchdsvm.fit |
a fitted |
lambda.min |
The optimal value of |
lambda.1se |
The largest value of |
set.seed(315)
n <- 100
p <- 400
x1 <- matrix(rnorm(n / 2 * p, -0.25, 0.1), n / 2)
x2 <- matrix(rnorm(n / 2 * p, 0.25, 0.1), n / 2)
x <- rbind(x1, x2)
beta <- 0.1 * rnorm(p)
prob <- plogis(c(x %*% beta))
y <- 2 * rbinom(n, 1, prob) - 1
lam2 <- 0.01
lambda <- 10^(seq(1,-4, length.out=30))
cv.nc.fit <- cv.nc.hdsvm(x=x, y=y, lambda=lambda, lam2=lam2, pen="scad")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.