Meus caros amigos, estou tentando usar um exemplo de aplicação de MCA, script abaixo:
#Usando MCA
# load packages
require(FactoMineR)
require(ggplot2)
# load data tea
data(tea)
tea
names(tea)
# select these columns
newtea = tea[, c("Tea", "How", "how", "sugar", "where", "always")]
# take a peek
head(newtea)
names(newtea)
str(newtea)
cats = apply(newtea, 2, function(x) nlevels(as.factor(x)))
cats
# apply MCA
mca1 = MCA(newtea, graph = FALSE)
# list of results
mca1
# table of eigenvalues
mca1$eig
#We can use the package "ggplot2()" to get a nice plot:
# data frame with variable coordinates
mca1_vars_df = data.frame(mca1$var$coord, Variable = rep(names(cats), cats))
# data frame with observation coordinates
mca1_obs_df = data.frame(mca1$ind$coord)
par(cex.axis=0.5)
# plot of variable categories
ggplot(data=mca1_vars_df,cex.axis=0.5, cex.lab=0.5,
aes(x = Dim.1, y = Dim.2, label = rownames(mca1_vars_df))) +
geom_hline(yintercept = 0, colour = "gray70") +
geom_vline(xintercept = 0, colour = "gray70") +
geom_text(aes(colour=Variable)) +
ggtitle("MCA plot of variables using R package FactoMineR")
# MCA plot of observations and categories
ggplot(data = mca1_obs_df, aes(x = Dim.1, y = Dim.2)) +
geom_hline(yintercept = 0, colour = "gray70") +
geom_vline(xintercept = 0, colour = "gray70") +
geom_point(colour = "gray50", alpha = 0.7) +
geom_density2d(colour = "gray80") +
geom_text(data = mca1_vars_df,
aes(x = Dim.1, y = Dim.2,
label = rownames(mca1_vars_df), colour = Variable)) +
ggtitle("MCA plot of variables using R package FactoMineR") +
scale_colour_discrete(name = "Variable")
Como faço para mudar o tamanho da fonte do título, dos eixos, legenda, etc.? Tentei os comandos cex, cex.axis, cex.lab, mas não consegui.
Alguém tem alguma sugestão?
[ ]'s.
Edson Lira
Estatístico
Manaus-Amazonas