Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

confusion

Confusion Matrices


Description

Compute the confusion matrix between two factors, or for an fda or mda object.

Usage

## Default S3 method:
confusion(object, true, ...)
## S3 method for class 'fda'
confusion(object, data, ...)

Arguments

object

the predicted factor, or an fda or mda model object.

true

the true factor.

data

a data frame (list) containing the test data.

...

further arguments to be passed to or from methods.

Details

This is a generic function.

Value

For the default method essentially table(object, true), but with some useful attribute(s).

See Also

Examples

data(iris)
irisfit <- fda(Species ~ ., data = iris)
confusion(predict(irisfit, iris), iris$Species)
##            Setosa Versicolor Virginica 
##     Setosa     50          0         0
## Versicolor      0         48         1
##  Virginica      0          2        49
## attr(, "error"):
## [1] 0.02

mda

Mixture and Flexible Discriminant Analysis

v0.5-2
GPL-2
Authors
S original by Trevor Hastie & Robert Tibshirani. Original R port by Friedrich Leisch, Kurt Hornik and Brian D. Ripley. Balasubramanian Narasimhan has contributed to the upgrading of the code.
Initial release
2020-06-26

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.