cor_lda: Calculate Structure Correlations from Discriminant Analysis

View source: R/cor_lda.R

cor_ldaR Documentation

Calculate Structure Correlations from Discriminant Analysis

Description

cor_lda() calculates the "structure" correlations between the observed variables and the discriminant dimension scores from a linear discriminant analysis provided by MASS::lda(). These more directly assess the direction and strength of the relations between the two sets than do the scaling weights returned by lda(). They are useful for plotting the discriminant scores, showing the contributions of the variables by vectors.

Usage

cor_lda(
  object,
  prior = object$prior,
  dimen,
  method = c("pearson", "kendall", "spearman"),
  ...
)

Arguments

object

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.

method

a character string indicating which correlation coefficient is to be computed. One of "pearson" (default), "kendall", or "spearman": can be abbreviated. See stats::cor() for details

...

other arguments (presently ignored)

Value

  a numeric matrix of correlations, of size `nv` = number of predictor variables * `dimen`

Author(s)

Michael Friendly

See Also

predict_discrim(), MASS::lda(), stats::cor()

Examples

library(candisc)
library(MASS)   # for lda()

iris.lda <- lda(Species ~ ., iris)
cor_lda(iris.lda)


candisc documentation built on Nov. 5, 2025, 7:08 p.m.