cv.glmpath {glmpath} | R Documentation |
This function computes cross-validated (minus) log-likelihoods or
prediction errors for glmpath.
cv.glmpath(x, y, data, family = binomial, weight = rep(1, length(y)), nfold = 10, fraction = seq(from=0, to=1, length=100), type = c("loglik","response"), mode = c("norm","lambda"), plot.it = TRUE, se = TRUE, ...)
x |
matrix of features |
y |
response |
data |
a list consisting of x: a matrix of features and y:
response. data is not needed if above x and y
are input separately.
|
family |
name of a family function that represents the distribution of y to
be used in the model. It must be binomial , gaussian ,
or poisson . For each one, the canonical link function is
used; logit for binomial, identity for gaussian, and
log for poisson distribution. Default is binomial.
|
weight |
an optional vector of weights for observations |
nfold |
number of folds to be used in cross-validation. Default is
nfold=10.
|
fraction |
fraction of the L1 norm or log(λ) with respect to their
maximum values at which CV values are computed. Default is
seq(0,1,length=100).
|
type |
If type=loglik, cross-validated minus log-likelihoods are
computed. If type=response, cross-validated prediction errors
are computed. Default is loglik.
|
mode |
If mode=norm, cross-validation is done at certain values of
L1 norm. If mode=lambda, cross-validation is done at certain
values of log(λ). Default is norm.
|
plot.it |
If TRUE, the CV curve is plotted.
|
se |
If TRUE, the standard errors are plotted.
|
... |
other options for glmpath |
Mee Young Park and Trevor Hastie
Mee Young Park and Trevor Hastie (2006) L1 Regularization Path Algorithm for Generalized Linear Models - available at the authors' websites, http://www.stanford.edu/~mypark or http://stat.stanford.edu/~hastie/pub.htm.
glmpath, plot.glmpath, predict.glmpath
data(heart.data) attach(heart.data) cv.a <- cv.glmpath(x, y, family=binomial) cv.b <- cv.glmpath(x, y, family=binomial, type="response") detach(heart.data)