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 [2022/05/05 14:49] – hkimscil | factor_analysis_examples [2022/05/05 15:02] (current) – [2] hkimscil | ||
---|---|---|---|
Line 189: | Line 189: | ||
</ | </ | ||
+ | < | ||
+ | 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.1651729796.txt.gz · Last modified: 2022/05/05 14:49 by hkimscil