User Tools

Site Tools


factor_analysis_examples

This is an old revision of the document!


1

efa.csv

# read the dataset into R variable using the read.csv(file) function
data <- read.csv("http://commres.net/wiki/_media/r/efa.csv")
head(data)
# install the package
# install.packages("psych")
# install.packages("GPArotation")
# load the package
library(psych)
library(GPArotation)
# calculate the correlation matrix
corMat <- cor(data)
# display the correlation matrix
round(corMat,3)
# use fa() to conduct an oblique principal-axis exploratory factor analysis
# save the solution to an R variable
solution <- fa(r = corMat, nfactors = 2, rotate = "oblimin", fm = "pa")
solution2 <- fa(data,  nfactors = 2, rotate = "oblimin", fm = "pa")
# display the solution output
solution 
solution2 
fa.sort(solution)
factor_analysis_examples.1575607514.txt.gz · Last modified: 2019/12/06 13:45 by hkimscil

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki