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 an optional vector of weights for observations
nfold number of folds to be used in cross-validation. Default is nfold=5.
folds the list of cross-validation folds. Its length must be nfold. If NULL, the folds are randomly generated.
lambda vector of the candidate values for lambda in step.plr
cp vector of the candidate values for cp in step.plr
cv.type If cv.type=deviance, cross-validated deviances are returned. If cv.type=class, cross-validated prediction errors are returned.
trace If TRUE, the steps are printed out.
... other options for step.plr

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 (2006) Penalized Logistic Regression for Detecting Gene Interactions - available at the authors' websites, http://stat.stanford.edu/~mypark or http://stat.stanford.edu/~hastie/pub.htm.

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)
cvfit1 <- cv.step.plr(x,y,level=level,lambda=c(1e-4,1e-2,1),cp="bic")
cvfit2 <- cv.step.plr(x,y,level=level,lambda=1e-4,cp=c(2,3,4))
cvfit3 <- cv.step.plr(x,y,level=level,lambda=c(1e-4,1e-2,1),cp=c(2,3,4))

[Package stepPlr version 0.91 Index]