cv.step.plr: Computes cross-validated deviance or prediction errors for...

Description Usage Arguments Details Author(s) References See Also Examples

View source: R/step.plr.R

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

1
2
3
4
  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 nfold=5.

folds

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 (2008) Penalized Logistic Regression for Detecting Gene Interactions

See Also

step.plr

Examples

1
2
3
4
5
6
7
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")

stepPlr documentation built on Jan. 28, 2018, 5:04 p.m.

Related to cv.step.plr in stepPlr...