Learn R Programming

DAAG (version 1.17)

CVbinary: Cross-Validation for Regression with a Binary Response

Description

These functions give training (internal) and cross-validation measures of predictive accuracy for regression with a binary response. The data are randomly divided between a number of `folds'. Each fold is removed, in turn, while the remaining data are used to re-fit the regression model and to predict at the omitted observations.

Usage

CVbinary(obj, rand=NULL, nfolds=10, print.details=TRUE)

cv.binary(obj, rand=NULL, nfolds=10, print.details=TRUE)

Arguments

obj
a glm object
rand
a vector which assigns each observation to a fold
nfolds
the number of folds
print.details
logical variable (TRUE = print detailed output, the default)

Value

  • cvhatpredicted values from cross-validation
  • internalinternal or (better) training predicted values
  • trainingtraining predicted values
  • acc.cvcross-validation estimate of accuracy
  • acc.internalinternal or (better) training estimate of accuracy
  • acc.trainingtraining estimate of accuracy

See Also

glm

Examples

Run this code
frogs.glm <- glm(pres.abs ~ log(distance) + log(NoOfPools),
                 family=binomial,data=frogs)
CVbinary(frogs.glm)
mifem.glm <- glm(outcome ~ ., family=binomial, data=mifem)
CVbinary(mifem.glm)

Run the code above in your browser using DataLab