5.1.1 library(languageR) affixProductivity[c("Mormon", "Austen", "Carroll", "Gao"), c(5:10, 29)] affixes.pr = prcomp(affixProductivity[, 1:(ncol(affixProductivity)-3)]) names(affixes.pr) round(affixes.pr$sdev, 4) summary(affixes.pr) props = round((affixes.pr$sdev^2/sum(affixes.pr$sdev^2)), 3) props[1:6] barplot(props, col = as.numeric(props > 0.05), xlab = "principal components", ylab = "proportion of variance explained") abline(h = 0.05) plot(affixes.pr) affixes.pr$x[c("Mormon", "Austen", "Carroll", "Gao"), 1:3] library(lattice) super.sym = trellis.par.get("superpose.symbol") splom(data.frame(affixes.pr$x[,1:3]), groups = affixProductivity$Registers, panel = panel.superpose, key = list(title = "texts in productivity space", text = list(c("Religious", "Children", "Literary", "Other")), points = list(pch = super.sym$pch[1:4], col = super.sym$col[1:4]))) dim(affixes.pr$rotation) affixes.pr$rotation[1:10, 1:3] biplot(affixes.pr, scale = 0, var.axes = F, col = c("darkgrey", "black"), cex = c(0.9, 1.2)) affixes.pr = prcomp(affixProductivity[ ,1:27], scale = T, center = T) biplot(affixes.pr, var.axes = F, col = c("darkgrey", "black"), cex = c(0.6, 1), xlim = c(-0.42, 0.38)) 5.1.2 affixes.fac = factanal(affixProductivity[ ,1:27], factors = 3) affixes.fac loadings = loadings(affixes.fac) plot(loadings, type = "n", xlim = c(-0.4, 1)) text(loadings, rownames(loadings), cex = 0.8) affixes.fac2 = factanal(affixProductivity[ ,1:27], factors = 3, rotation = "promax") loadings2 = loadings(affixes.fac2) plot(loadings2, type = "n", xlim = c(-0.4, 1)) text(loadings2, rownames(loadings)) abline(h = -0.1, col = "darkgrey")