Learn R Programming

dawai (version 1.2.7)

err.est.rlda: Restricted Linear Discriminant Analysis. True Error Rate estimation

Description

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

Usage

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

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.

Arguments

x

An object of class 'rlda'.

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.

Author

David Conde

Details

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

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, rlda, predict.rlda, rqda, predict.rqda, err.est.rqda

Examples

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

data = Vehicle2[, c("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
## 
## we can specify these restrictions by restext = "s>1"

set.seed(-1007)
values <- runif(length(rownames(data)))
trainsubset <- values < 0.05
testsubset <- values >= 0.05
obj <- rlda(data, grouping, subset = trainsubset, restext = "s>1")
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))

Run the code above in your browser using DataLab