cv.step.plr {stepPlr} | R Documentation |
Computes cross-validated deviance or prediction errors for step.plr
Description
This function computes cross-validated deviance or prediction errors
for step.plr.
The parameters that can be cross-validated are
lambda
and cp
.
Usage
cv.step.plr(x, y, weights = rep(1, length(y)),
nfold = 5, folds = NULL, lambda = c(1e-4, 1e-2, 1),
cp = c("aic", "bic"), cv.type=c("deviance", "class"),
trace = TRUE, ...)
Arguments
x |
matrix of features |
y |
binary response |
weights |
optional vector of weights for observations |
nfold |
number of folds to be used in cross-validation. Default is
|
folds |
list of cross-validation folds. Its length must be |
lambda |
vector of the candidate values for |
cp |
vector of the candidate values for |
cv.type |
If |
trace |
If |
... |
other options for |
Details
This function computes cross-validated deviance or prediction errors
for step.plr.
The parameters that can be cross-validated are
lambda
and cp
. If both are input as vectors (of length
greater than 1), then a two-dimensional cross-validation is done. If
either one is input as a single value, then the cross-validation is
done only on the parameter with multiple inputs.
Author(s)
Mee Young Park and Trevor Hastie
References
Mee Young Park and Trevor Hastie (2008) Penalized Logistic Regression for Detecting Gene Interactions
See Also
step.plr
Examples
n <- 100
p <- 5
x <- matrix(sample(seq(3), n * p, replace=TRUE), nrow=n)
y <- sample(c(0, 1), n, replace=TRUE)
level <- vector("list", length=p)
for (i in 1:p) level[[i]] <- seq(3)
cvfit <- cv.step.plr(x, y, level=level, lambda=c(1e-4, 1e-2, 1), cp="bic")