err.est.rqda: Restricted Quadratic Discriminant Analysis. True Error Rate...

View source: R/rqda.R

err.est.rqdaR Documentation

Restricted Quadratic Discriminant Analysis. True Error Rate Estimation

Description

Estimate the true error rate of quadratic classification rules built with additional information (in conjunction with rqda).

Usage

## S3 method for class 'rqda'
err.est(x, nboot = 50, gamma = x$gamma, prior = x$prior, ...)

Arguments

x

An object of class 'rqda'.

nboot

Number of bootstrap samples used to estimate the true error rate of the classification rules.

gamma

A vector of values specifying which rules to take among the ones in x. If unspecified, all rules built with x$gamma will be used. If present, gamma must be contained in x$gamma.

prior

The prior probabilities of class membership. If unspecified, x$prior probabilities are used. If present, the probabilities must be specified in the order of the factor levels.

...

Arguments based from or to other methods.

Details

This function is a method for the generic function err.est() for class 'rqda'.

Value

A list with components

call

The (matched) function call.

restrictions

Character vector with the restrictions on the means vector detailed.

prior

The prior probabilities of the classes used.

counts

The number of observations of the classes used.

N

The total number of observations used.

estimationError

Matrix with BT2, BT3, BT2CV and BT3CV true error rate estimates of the rules.

Note

To overcome singularity of the covariance matrices after bootstraping, the number of observations in each class must be greater than the number of explanatory variables divided by 0.632.

Author(s)

David Conde

References

Conde, D., Fernandez, M. A., Rueda, C., and Salvador, B. (2012). Classification of samples into two or more ordered populations with application to a cancer trial. Statistics in Medicine, 31, 3773-3786.

Conde, D., Fernandez, M. A., Salvador, B., and Rueda, C. (2015). dawai: An R Package for Discriminant Analysis with Additional Information. Journal of Statistical Software, 66(10), 1-19. URL http://www.jstatsoft.org/v66/i10/.

Conde, D., Salvador, B., Rueda, C. , and Fernandez, M. A. (2013). Performance and estimation of the true error rate of classification rules built with additional information. An application to a cancer trial. Statistical Applications in Genetics and Molecular Biology, 12(5), 583-602.

See Also

err.est, rqda, predict.rqda, rlda, predict.rlda, err.est.rlda

Examples

data(Vehicle2)
levels(Vehicle2$Class)
## "bus" "opel" "saab" "van"

data = Vehicle2[, c("Kurt.Maxis", "Holl.Ra", "Sc.Var.maxis")]
grouping = Vehicle2$Class
levels(grouping) <- c(3, 1, 1, 2)  
## now we can consider the following restrictions:
## mu11 >= mu21 >= mu31
## mu12 >= mu22 >= mu32
## 
## we can specify these restrictions by restext = "s>1,2"

set.seed(5561)
values <- runif(length(rownames(data)))
trainsubset <- values < 0.05
testsubset <- values >= 0.05
obj <- rqda(data, grouping, subset = trainsubset, restext = "s>1,2")
pred <- predict(obj, data[testsubset,], grouping = grouping[testsubset],
                prior = c(1/3, 1/3,1/3))
pred$error.rate
err.est(obj, 30, prior = c(1/3, 1/3, 1/3))

dawai documentation built on Oct. 15, 2024, 5:06 p.m.