factor_analysis_examples
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision | ||
factor_analysis_examples [2019/11/20 08:55] – [Personality] hkimscil | factor_analysis_examples [2019/12/06 13:45] – created hkimscil | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== | + | ====== |
+ | {{:r:EFA.csv}} | ||
+ | |||
+ | < | ||
+ | # read the dataset into R variable using the read.csv(file) function | ||
+ | data <- read.csv(" | ||
+ | head(data) | ||
+ | </ | ||
+ | |||
+ | < | ||
+ | # install the package | ||
+ | # install.packages(" | ||
+ | # install.packages(" | ||
+ | # load the package | ||
+ | library(psych) | ||
+ | library(GPArotation) | ||
+ | </ | ||
+ | |||
+ | < | ||
+ | # calculate the correlation matrix | ||
+ | corMat <- cor(data) | ||
+ | # display the correlation matrix | ||
+ | round(corMat, | ||
+ | </ | ||
+ | |||
+ | < | ||
+ | # use fa() to conduct an oblique principal-axis exploratory factor analysis | ||
+ | # save the solution to an R variable | ||
+ | solution <- fa(r = corMat, nfactors | ||
+ | solution2 <- fa(data, | ||
+ | # display the solution output | ||
+ | solution | ||
+ | solution2 | ||
+ | </ | ||
+ | |||
+ | < | ||
+ | fa.sort(solution) | ||
+ | </ | ||
factor_analysis_examples.txt · Last modified: 2022/05/05 15:02 by hkimscil