lda: Linear Discrimination

Description Usage Arguments Value See Also Examples

View source: R/lda.R

Description

Finds the coefficients a_k and constants c_k for Fisher's linear discrimination function d_k in (11.31) and (11.32).

Usage

1
lda(x, y)

Arguments

x

The N x P data matrix.

y

The N-vector of group identities, assumed to be given by the numbers 1,...,K for K groups.

Value

A list with the following components:

a

A P x K matrix, where column K contains the coefficents a_k for (11.31). The final column is all zero.

c

The K-vector of constants c_k for (11.31). The final value is zero.

See Also

sweep

Examples

1
2
3
4
5
# Iris example
x.iris <- as.matrix(iris[, 1:4])
# Gets group vector (1, ... , 1, 2, ... , 2, 3, ..., 3)
y.iris <- rep(1:3, c(50, 50, 50))
ld.iris <- lda(x.iris, y.iris)

msos documentation built on Oct. 31, 2020, 9:07 a.m.