fda | R Documentation |
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.
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, ...)
X |
For the main functions: Training X-data ( |
y |
Training class membership ( |
nlv |
The number(s) of LVs to calculate. |
object |
A fitted model, output of a call to the main function. |
... |
Optional arguments. Not used. |
See the examples.
Saporta G., 2011. Probabilités analyse des données et statistique. Editions Technip, Paris, France.
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.