fda {rchemo}R 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 the 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

For the main functions: The number(s) of LVs to calculate. — For the auxiliary functions: The number(s) of LVs to consider.

object

For the auxiliary functions: A fitted model, output of a call to the main function.

...

For the auxiliary functions: Optional arguments. Not used.

Value

For fda and fdasvd:

T

X-scores matrix (n,nlv).

P

X-loadings matrix (p,nlv) = coefficients of the linear discriminant function = "LD" of function lda of package MASS.

Tcenters

projection of the class centers in the score space.

eig

vector of eigen values

sstot

total variance

W

unbiased within covariance matrix

xmeans

means of the X variables

lev

y levels

ni

number of observations per level of the y variable

For transform.Fda: scores of the new X-data in the model.

For summary.Fda:

explvar

Explained variance by PCA of the class centers in transformed scale.

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, ])

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)


[Package rchemo version 0.1-1 Index]