Learn R Programming

candisc (version 1.1.0)

scores.lda: Extract Observation Discriminant Scores for Linear Discriminant Analysis

Description

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

Usage

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

Value

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

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

Author

Michael Friendly

See Also

predict_discrim(), MASS::lda()

Examples

Run this code
library(MASS)   # for lda()

iris.lda <- lda(Species ~ ., iris)
scores(iris.lda) |>
   str()
 

Run the code above in your browser using DataLab