PCA {FactoMineR}R Documentation

Principal Component Analysis (PCA)

Description

Performs Principal Component Analysis (PCA) with supplementary individuals, supplementary quantitative variables and supplementary qualitative variables.
Missing values are replaced by the column mean.

Usage

PCA(X, scale.unit = TRUE, ncp = 5, ind.sup = NULL, 
    quanti.sup = NULL, quali.sup = NULL, row.w = NULL, 
    col.w = NULL, graph = TRUE, axes = c(1,2))

Arguments

X a data frame with n rows (individuals) and p columns (numeric variables)
ncp number of dimensions kept in the results (by default 5)
scale.unit a boolean, if TRUE (value set by default) then data are scaled to unit variance
ind.sup a vector indicating the indexes of the supplementary individuals
quanti.sup a vector indicating the indexes of the quantitative supplementary variables
quali.sup a vector indicating the indexes of the qualitative supplementary variables
row.w an optional row weights (by default, uniform row weights)
col.w an optional column weights (by default, uniform column weights)
graph boolean, if TRUE a graph is displayed
axes a length 2 vector specifying the components to plot

Value

Returns a list including:

eig a matrix containing all the eigenvalues, the percentage of variance and the cumulative percentage of variance
var a list of matrices containing all the results for the active variables (coordinates, correlation between variables and axes, square cosine, contributions)
ind a list of matrices containing all the results for the active individuals (coordinates, square cosine, contributions)
ind.sup a list of matrices containing all the results for the supplementary individuals (coordinates, square cosine)
quanti.sup a list of matrices containing all the results for the supplementary quantitative variables (coordinates, correlation between variables and axes)
quali.sup a list of matrices containing all the results for the supplementary qualitative variables (coordinates of each categories of each variables, and v.test which is a criterion with a Normal distribution)


Returns the individuals factor map and the variables factor map.

Author(s)

Jeremy Mazet, Francois Husson Francois.Husson@agrocampus-ouest.fr

See Also

print.PCA, plot.PCA, dimdesc

Examples

data(decathlon)
res.pca <- PCA(decathlon, quanti.sup = 11:12, quali.sup=13)
## plot of the eigenvalues
## barplot(res.pca$eig[,1],main="Eigenvalues",names.arg=1:nrow(res.pca$eig))
plot(res.pca,choix="ind",habillage=13)
dimdesc(res.pca, axes = 1:2)
## To draw ellipses around the categories of the 13th variable (which is categorical)
aa=cbind.data.frame(decathlon[,13],res.pca$ind$coord)
bb=coord.ellipse(aa,bary=TRUE)
plot.PCA(res.pca,habillage=13,ellipse=bb)

[Package FactoMineR version 1.10 Index]