predict.specproc_robust_da: Predictions of a Robust Discriminant Analysis

View source: R/robust_da.R

predict.specproc_robust_daR Documentation

Predictions of a Robust Discriminant Analysis

Description

Predicts the classes, or the posterior probabilities of the classes, of new observations with a model fitted by robust_da().

Usage

## S3 method for class 'specproc_robust_da'
predict(object, newdata, type = c("class", "prob"), ...)

Arguments

object

An object returned by robust_da().

newdata

A numeric matrix or data frame with the same variables as the training data.

type

"class" (default) for the predicted classes, or "prob" for the posterior probabilities.

...

Not used.

Value

With type = "class", a factor of the predicted classes. With type = "prob", a tibble with one column of posterior probabilities per class.

Author(s)

Christian L. Goueguel

See Also

robust_da()

Examples

# iris: train on 100 flowers, predict the 50 others
set.seed(1)
train <- sample(nrow(iris), 100)
fit <- robust_da(iris[train, 1:4], iris$Species[train], method = "quadratic")
head(predict(fit, iris[-train, 1:4]))
head(predict(fit, iris[-train, 1:4], type = "prob"))

specProc documentation built on Nov. 20, 2026, 5:11 p.m.