factor_analysis_examples
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
factor_analysis_examples [2019/12/06 14:01] – hkimscil | factor_analysis_examples [2022/05/05 15:02] (current) – [2] hkimscil | ||
---|---|---|---|
Line 180: | Line 180: | ||
Proportion Explained | Proportion Explained | ||
Cumulative Proportion 0.27 0.51 0.68 0.84 1.00 | Cumulative Proportion 0.27 0.51 0.68 0.84 1.00 | ||
+ | </ | ||
+ | |||
+ | ====== 2 ====== | ||
+ | < | ||
+ | food <- read.csv(" | ||
+ | | ||
+ | str(food) | ||
+ | </ | ||
+ | |||
+ | < | ||
+ | food.ini <- fa(food) | ||
+ | food.ini$e.values | ||
+ | </ | ||
+ | |||
+ | < | ||
+ | food.fa <- factanal(food, | ||
+ | food.fa | ||
+ | food.fa$uniquenesses | ||
+ | apply(food.fa$loadings^2, | ||
+ | 1 - apply(food.fa$loadings^2, | ||
+ | </ | ||
+ | |||
+ | < | ||
+ | Lambda <- food.fa$loadings | ||
+ | Psi <- diag(food.fa$uniquenesses) | ||
+ | S <- food.fa$correlation | ||
+ | Sigma <- Lambda %*% t(Lambda) + Psi | ||
+ | </ | ||
+ | |||
+ | < | ||
+ | round(S - Sigma, 6) | ||
+ | </ | ||
+ | |||
+ | < | ||
+ | food.fa.none <- factanal(food, | ||
+ | food.fa.varimax <- factanal(food, | ||
+ | food.fa.promax <- factanal(food, | ||
+ | |||
+ | par(mfrow = c(1,3)) | ||
+ | plot(food.fa.none$loadings[, | ||
+ | | ||
+ | xlab = " | ||
+ | ylab = " | ||
+ | ylim = c(-1,1), | ||
+ | xlim = c(-1,1), | ||
+ | main = "No rotation" | ||
+ | abline(h = 0, v = 0) | ||
+ | |||
+ | plot(food.fa.varimax$loadings[, | ||
+ | | ||
+ | xlab = " | ||
+ | ylab = " | ||
+ | ylim = c(-1,1), | ||
+ | xlim = c(-1,1), | ||
+ | main = " | ||
+ | |||
+ | text(food.fa.varimax$loadings[, | ||
+ | | ||
+ | colnames(food), | ||
+ | col=" | ||
+ | abline(h = 0, v = 0) | ||
+ | |||
+ | plot(food.fa.promax$loadings[, | ||
+ | | ||
+ | xlab = " | ||
+ | ylab = " | ||
+ | ylim = c(-1,1), | ||
+ | xlim = c(-1,1), | ||
+ | main = " | ||
+ | abline(h = 0, v = 0) | ||
+ | |||
+ | par(mfrow = c(1,1)) | ||
</ | </ |
factor_analysis_examples.1575608466.txt.gz · Last modified: 2019/12/06 14:01 by hkimscil