# NOT RUN {
# Principal Component Analysis
# ++++++++++++++++++++++++++
data(iris)
res.pca <- prcomp(iris[, -5], scale = TRUE)
# Extract eigenvalues/variances
get_eig(res.pca)
# Default plot
fviz_eig(res.pca, addlabels = TRUE, ylim = c(0, 85))
# Scree plot - Eigenvalues
fviz_eig(res.pca, choice = "eigenvalue", addlabels=TRUE)
# Use only bar or line plot: geom = "bar" or geom = "line"
fviz_eig(res.pca, geom="line")
# }
# NOT RUN {
# Correspondence Analysis
# +++++++++++++++++++++++++++++++++
library(FactoMineR)
data(housetasks)
res.ca <- CA(housetasks, graph = FALSE)
get_eig(res.ca)
fviz_eig(res.ca, linecolor = "#FC4E07",
barcolor = "#00AFBB", barfill = "#00AFBB")
# Multiple Correspondence Analysis
# +++++++++++++++++++++++++++++++++
library(FactoMineR)
data(poison)
res.mca <- MCA(poison, quanti.sup = 1:2,
quali.sup = 3:4, graph=FALSE)
get_eig(res.mca)
fviz_eig(res.mca, linecolor = "#FC4E07",
barcolor = "#2E9FDF", barfill = "#2E9FDF")
# }
# NOT RUN {
# }
Run the code above in your browser using DataLab