# NOT RUN {
# The taste example
data(taste)
data_taste <- taste[which(taste$Isup == 'Active'), ]
active <- data.frame(data_taste$TV, data_taste$Film, data_taste$Art, data_taste$Eat)
sup <- data.frame(data_taste$Gender, data_taste$Age, data_taste$Income)
# Multiple Correspondence Analysis
result.mca <- soc.mca(active, sup)
str(result.mca)
result.mca
variance(result.mca) # See p.46 in Le Roux(2010)
contribution(result.mca, 1)
contribution(result.mca, 2)
contribution(result.mca, 1:3, mode = "variable")
map.active(result.mca, point.fill = result.mca$variable)
map.active(result.mca,
map.title="Map of active modalities with size of contribution to 1. dimension",
point.size=result.mca$ctr.mod[, 1])
map.active(result.mca,
map.title="Map of active modalities with size of contribution to 2. dimension",
point.size=result.mca$ctr.mod[, 2])
map.ind(result.mca)
map.ind(result.mca, dim=c(1, 2), point.color=result.mca$ctr.ind[, 1],
point.shape=18) + scale_color_continuous(low="white", high="black")
# Plot of all dublets
map.ind(result.mca, map.title="Map of all unique individuals", point.color=duplicated(active))
map.ind(result.mca, map.title="Map with individuals colored by the TV variable",
point.color=active$TV)
# Ellipse
map <- map.ind(result.mca)
map.ellipse(result.mca, map, as.factor(data_taste$Age == '55-64'))
##### Specific Multiple Correspondence Analysis
options(passive= c("Film: CostumeDrama", "TV: Tv-Sport"))
result.smca <- soc.mca(active, sup)
result.smca
result.smca$names.passive
##### Class Specific Correspondence Analysis
options(passive=NULL)
class.age <- which(data_taste$Age == '55-64')
result.csca <- soc.csa(result.mca, class.age, sup)
str(result.csca)
# Correlations
csa.measures(result.csca)
variance(result.csca)
contribution(result.csca, 1)
contribution(result.csca, 2)
contribution(result.csca, 1:3, mode = "variable")
# Plots
map.ind(result.csca)
map.csa.mca(result.csca)
map.csa.mca.array(result.csca)
# }
Run the code above in your browser using DataLab