ldaErr: Calculate Error Rates for Linear Discriminant Model

Description Usage Arguments Value Examples

View source: R/ldaErr.R

Description

Given an lda model object, calculate training set error, leave-one-out cross-validation error, and test set error.

Usage

1
ldaErr(train.lda, train, test, group = "type")

Arguments

train.lda

Fitted lda model object.

train

Training set data frame.

test

Test set data frame.

group

Factor that identifies groups in training data.

Value

Vector that holds leave-one-out, training, and test error rates

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
## Not run: 
data(spam, package='kernlab')
spam[,-58] <- scale(spam[,-58])
nr <- sample(1:nrow(spam))
spam01 <- spam[nr[1:3601],]     ## Use for training,
spam2 <- spam[nr[3602:4601],]   ## Test
spam01.lda <- lda(type~., data=spam01)
ldaRates <- ldaErr(train.lda=spam01.lda, train=spam01, test=spam2, group="type")

## End(Not run)

gamclass documentation built on Nov. 14, 2020, 1:07 a.m.