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

View source: R/scores.lda.R

scores.ldaR Documentation

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 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(s)

Michael Friendly

See Also

predict_discrim(), MASS::lda()

Examples

library(MASS)   # for lda()

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

candisc documentation built on Nov. 25, 2025, 9:07 a.m.