arcv.glmnet | R Documentation |
This functions evaluates elastic net repeated cross validation for alpha and
lambda based on glmnet::cv.glmnet()
.
arcv.glmnet(
x, y,
lambda = NULL,
alpha = seq(0L, 1L, by = 0.1),
nrepcv = 100L, nfolds = 10L, foldid = NULL, balanced = FALSE,
...,
trace.it = interactive()
)
which.min.error(x, s = c("lambda.1se", "lambda.min"), maxnnzero = Inf)
## S3 method for class 'arcv.glmnet'
print(x, digits = max(3L, getOption("digits") - 3L), ...)
x |
|
y |
response as in |
lambda |
|
alpha |
|
nrepcv |
|
nfolds |
|
foldid |
|
balanced |
|
... |
further arguments passed to |
trace.it |
|
s |
|
maxnnzero |
|
digits |
|
An object of class arcv.glmnet
that extends the rcv.glmnet
and
cv.glmnet
class.
numeric
index of model with minimal error.
Sebastian Gibb
Jerome Friedman, Trevor Hastie, Robert Tibshirani (2010). Regularization Paths for Generalized Linear Models via Coordinate Descent. Journal of Statistical Software, 33(1), 1-22. URL https://www.jstatsoft.org/v33/i01/.
Noah Simon, Jerome Friedman, Trevor Hastie, Rob Tibshirani (2011). Regularization Paths for Cox's Proportional Hazards Model via Coordinate Descent. Journal of Statistical Software, 39(5), 1-13. URL https://www.jstatsoft.org/v39/i05/.
glmnet::cv.glmnet()
# Examples taken from ?"glmnet::cv.glmnet"
set.seed(1010)
n <- 1000
p <- 100
nzc <- trunc(p/10)
x <- matrix(rnorm(n * p), n, p)
beta <- rnorm(nzc)
fx <- x[, seq(nzc)] %*% beta
eps <- rnorm(n) * 5
y <- drop(fx + eps)
set.seed(1011)
# nrepcv should usually be higher but to keep the runtime of the example low
# we choose 2 here
arcvob <- arcv.glmnet(x, y, alpha = c(0, 0.5, 1), nrepcv = 2, nfolds = 3)
plot(arcvob)
title("Gaussian Family", line = 2.5)
plot(arcvob, what = "lambda.min")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.