fda: Factorial discriminant analysis

View source: R/fda.R

fdaR Documentation

Factorial discriminant analysis

Description

Factorial discriminant analysis (FDA). The functions maximize the compromise p'Bp / p'Wp, i.e. max p'Bp with constraint p'Wp = 1. Vectors p are the linear discrimant coefficients "LD".

- fda: Eigen factorization of W^(-1)B

- fdasvd: Weighted SVD factorization of the matrix of the class centers.

If W is singular, W^(-1) is replaced by a MP pseudo-inverse.

Usage


fda(X, y, nlv = NULL)

fdasvd(X, y, nlv = NULL)

## S3 method for class 'Fda'
transform(object, X, ..., nlv = NULL) 

## S3 method for class 'Fda'
summary(object, ...) 

Arguments

X

For the main functions: Training X-data (n, p). — For auxiliary functions: New X-data (m, p) to consider.

y

Training class membership (n). Note: If y is a factor, it is replaced by a character vector.

nlv

The number(s) of LVs to calculate.

object

A fitted model, output of a call to the main function.

...

Optional arguments. Not used.

Value

See the examples.

References

Saporta G., 2011. Probabilités analyse des données et statistique. Editions Technip, Paris, France.

Examples


data(iris)

X <- iris[, 1:4]
y <- iris[, 5]
table(y)

fm <- fda(X, y)
headm(fm$T)
transform(fm, X[1:3, ])
## Tcenters = projection of the class centers in the score space
fm$Tcenters
## X-loadings matrix
## = coefficients of the linear discriminant function
## = "LD" of function lda of package MASS
fm$P
## Explained variance by PCA of the class centers 
## in transformed scale
summary(fm)
plotxy(fm$T, group = y, ellipse = TRUE, 
    zeroes = TRUE, pch = 16, cex = 1.5, ncol = 2)
points(fm$Tcenters, pch = 8, col = "blue", cex = 1.5)


mlesnoff/rchemo documentation built on April 15, 2023, 1:25 p.m.