Skip to contents

This is a thin wrapper for predict_discrim() to provide a scores() method for discriminant analysis from MASS::lda().

Usage

# S3 method for class 'lda'
scores(x, prior = x$prior, dimen, ...)

Arguments

x

An object of class "lda" such as results from MASS::lda()

prior

The prior probabilities of the classes. By default, taken to be the proportions in what was set in the call to MASS::lda()

dimen

The dimension of the space to be used. If this is less than the number of available dimensions, \(min(p, ng-1)\), only the first dimen discriminant components are used.

...

Unused; for compatibility with the generic

Value

a data frame for the observations with columns LD1, LD2, ... for the discriminant dimensions

Author

Michael Friendly

Examples

library(MASS)   # for lda()

iris.lda <- lda(Species ~ ., iris)
scores(iris.lda) |>
   str()
#> Error in UseMethod("scores"): no applicable method for 'scores' applied to an object of class "lda"