## Run libraries
packages <- c(
"psych",
"REdaS",
"qgraph"
)
installed <- packages %in% rownames(installed.packages())
if (any(!installed)) {
install.packages(packages[!installed])
}
lapply(packages, library, character.only = TRUE)
## Import dataset
url <- "https://github.com/JasonMHoskin/quant632_assn3/raw/refs/heads/main/data_assn3.rda"
download.file(url, destfile = "file.RDA", mode = "wb")
load("file.RDA")
df1 <- assn3
## Remove unnecessary variables
rm(installed, packages, url)
options(digits = 3)
### Calculate descriptive statistics
describe(df1[, 2:20])
## vars n mean sd median trimmed mad min max range skew kurtosis se
## Q1 1 800 2.42 1.03 2 2.40 1.48 1 4 3 0.13 -1.12 0.04
## Q2 2 800 1.94 1.06 2 1.80 1.48 1 4 3 0.78 -0.71 0.04
## Q3 3 800 2.24 1.04 2 2.17 1.48 1 4 3 0.39 -1.02 0.04
## Q4 4 800 1.80 1.00 1 1.63 0.00 1 4 3 0.99 -0.25 0.04
## Q5 5 800 2.68 1.05 3 2.73 1.48 1 4 3 -0.20 -1.19 0.04
## Q6 6 800 2.40 1.07 2 2.38 1.48 1 4 3 0.17 -1.21 0.04
## Q7 7 800 1.82 1.01 1 1.66 0.00 1 4 3 0.99 -0.21 0.04
## Q8 8 800 2.55 1.06 2 2.56 1.48 1 4 3 0.03 -1.24 0.04
## Q9 9 800 2.51 1.07 3 2.52 1.48 1 4 3 -0.01 -1.26 0.04
## Q10 10 800 2.42 1.15 2 2.41 1.48 1 4 3 0.14 -1.41 0.04
## Q11 11 800 2.58 1.06 3 2.60 1.48 1 4 3 -0.05 -1.22 0.04
## Q12 12 800 2.39 1.07 2 2.36 1.48 1 4 3 0.15 -1.23 0.04
## Q13 13 800 2.74 1.06 3 2.81 1.48 1 4 3 -0.21 -1.25 0.04
## Q14 14 800 2.33 1.06 2 2.29 1.48 1 4 3 0.24 -1.17 0.04
## Q15 15 800 1.78 0.98 1 1.60 0.00 1 4 3 1.08 0.04 0.03
## Q16 16 800 2.50 1.11 2 2.50 1.48 1 4 3 0.05 -1.33 0.04
## Q17 17 800 2.57 1.14 3 2.58 1.48 1 4 3 -0.05 -1.42 0.04
## Q18 18 800 2.30 1.02 2 2.24 1.48 1 4 3 0.32 -1.02 0.04
## Q19 19 800 1.87 1.05 1 1.71 0.00 1 4 3 0.86 -0.60 0.04
lapply(df1[,2:20], table)
## $Q1
##
## 1 2 3 4
## 174 266 209 151
##
## $Q2
##
## 1 2 3 4
## 372 210 114 104
##
## $Q3
##
## 1 2 3 4
## 228 284 157 131
##
## $Q4
##
## 1 2 3 4
## 418 202 101 79
##
## $Q5
##
## 1 2 3 4
## 133 211 231 225
##
## $Q6
##
## 1 2 3 4
## 192 260 181 167
##
## $Q7
##
## 1 2 3 4
## 401 225 87 87
##
## $Q8
##
## 1 2 3 4
## 152 258 191 199
##
## $Q9
##
## 1 2 3 4
## 176 222 218 184
##
## $Q10
##
## 1 2 3 4
## 224 217 154 205
##
## $Q11
##
## 1 2 3 4
## 148 239 212 201
##
## $Q12
##
## 1 2 3 4
## 203 241 196 160
##
## $Q13
##
## 1 2 3 4
## 117 230 193 260
##
## $Q14
##
## 1 2 3 4
## 213 258 180 149
##
## $Q15
##
## 1 2 3 4
## 414 228 81 77
##
## $Q16
##
## 1 2 3 4
## 185 232 180 203
##
## $Q17
##
## 1 2 3 4
## 189 203 174 234
##
## $Q18
##
## 1 2 3 4
## 203 291 173 133
##
## $Q19
##
## 1 2 3 4
## 406 185 115 94
### Assess for NAs
colSums(is.na(df1))
## ID Q1 Q2 Q3 Q4 Q5 Q6 Q7 Q8 Q9 Q10 Q11 Q12 Q13 Q14 Q15 Q16 Q17 Q18 Q19
## 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
df1 <- na.omit(df1)
### Create correlation matrix
corr <- round(cor(df1[, 2:20], method = "pearson"), 2)
corr
## Q1 Q2 Q3 Q4 Q5 Q6 Q7 Q8 Q9 Q10 Q11 Q12 Q13 Q14 Q15
## Q1 1.00 0.28 0.38 0.33 0.38 0.61 0.34 0.45 0.47 0.34 0.68 0.42 0.43 0.45 0.31
## Q2 0.28 1.00 0.27 0.41 0.29 0.27 0.47 0.32 0.36 0.26 0.30 0.36 0.29 0.32 0.42
## Q3 0.38 0.27 1.00 0.33 0.50 0.34 0.32 0.42 0.34 0.66 0.38 0.37 0.68 0.26 0.33
## Q4 0.33 0.41 0.33 1.00 0.32 0.28 0.60 0.44 0.43 0.31 0.33 0.45 0.34 0.29 0.52
## Q5 0.38 0.29 0.50 0.32 1.00 0.29 0.35 0.42 0.30 0.51 0.36 0.35 0.54 0.28 0.33
## Q6 0.61 0.27 0.34 0.28 0.29 1.00 0.33 0.46 0.47 0.31 0.63 0.45 0.40 0.40 0.28
## Q7 0.34 0.47 0.32 0.60 0.35 0.33 1.00 0.45 0.45 0.32 0.35 0.49 0.37 0.34 0.56
## Q8 0.45 0.32 0.42 0.44 0.42 0.46 0.45 1.00 0.48 0.38 0.46 0.54 0.48 0.37 0.38
## Q9 0.47 0.36 0.34 0.43 0.30 0.47 0.45 0.48 1.00 0.36 0.46 0.52 0.41 0.32 0.38
## Q10 0.34 0.26 0.66 0.31 0.51 0.31 0.32 0.38 0.36 1.00 0.38 0.35 0.65 0.23 0.36
## Q11 0.68 0.30 0.38 0.33 0.36 0.63 0.35 0.46 0.46 0.38 1.00 0.46 0.49 0.44 0.32
## Q12 0.42 0.36 0.37 0.45 0.35 0.45 0.49 0.54 0.52 0.35 0.46 1.00 0.41 0.30 0.44
## Q13 0.43 0.29 0.68 0.34 0.54 0.40 0.37 0.48 0.41 0.65 0.49 0.41 1.00 0.26 0.37
## Q14 0.45 0.32 0.26 0.29 0.28 0.40 0.34 0.37 0.32 0.23 0.44 0.30 0.26 1.00 0.31
## Q15 0.31 0.42 0.33 0.52 0.33 0.28 0.56 0.38 0.38 0.36 0.32 0.44 0.37 0.31 1.00
## Q16 0.36 0.27 0.63 0.28 0.53 0.27 0.28 0.38 0.32 0.62 0.35 0.30 0.61 0.24 0.33
## Q17 0.38 0.32 0.58 0.34 0.46 0.34 0.34 0.38 0.44 0.67 0.45 0.39 0.65 0.24 0.36
## Q18 0.50 0.27 0.29 0.32 0.34 0.47 0.32 0.40 0.32 0.26 0.52 0.38 0.34 0.37 0.31
## Q19 0.34 0.44 0.25 0.41 0.30 0.33 0.51 0.38 0.42 0.29 0.32 0.41 0.30 0.29 0.38
## Q16 Q17 Q18 Q19
## Q1 0.36 0.38 0.50 0.34
## Q2 0.27 0.32 0.27 0.44
## Q3 0.63 0.58 0.29 0.25
## Q4 0.28 0.34 0.32 0.41
## Q5 0.53 0.46 0.34 0.30
## Q6 0.27 0.34 0.47 0.33
## Q7 0.28 0.34 0.32 0.51
## Q8 0.38 0.38 0.40 0.38
## Q9 0.32 0.44 0.32 0.42
## Q10 0.62 0.67 0.26 0.29
## Q11 0.35 0.45 0.52 0.32
## Q12 0.30 0.39 0.38 0.41
## Q13 0.61 0.65 0.34 0.30
## Q14 0.24 0.24 0.37 0.29
## Q15 0.33 0.36 0.31 0.38
## Q16 1.00 0.56 0.26 0.27
## Q17 0.56 1.00 0.29 0.31
## Q18 0.26 0.29 1.00 0.29
## Q19 0.27 0.31 0.29 1.00
### Create correlation plots
## Heat plot
cor.plot(corr)
## Network plot
qgraph(
corr,
shape = "rectangle",
vsize = 11,
cut = 0.5,
threshold = 0.3
)
### Kaiser-Meyer-Olkin (KMO) Measure of Sampling Adequacy (MSA)
KMO(df1[, 2:20])
## Kaiser-Meyer-Olkin factor adequacy
## Call: KMO(r = df1[, 2:20])
## Overall MSA = 0.95
## MSA for each item =
## Q1 Q2 Q3 Q4 Q5 Q6 Q7 Q8 Q9 Q10 Q11 Q12 Q13 Q14 Q15 Q16
## 0.93 0.95 0.94 0.94 0.96 0.94 0.93 0.96 0.96 0.93 0.93 0.96 0.95 0.96 0.95 0.94
## Q17 Q18 Q19
## 0.94 0.96 0.95
### Bartlett's Test of Sphericity
bart_spher(df1[, 2:20])
## Bartlett's Test of Sphericity
##
## Call: bart_spher(x = df1[, 2:20])
##
## X2 = 7521.583
## df = 171
## p-value < 2.22e-16
First, Conduct the Principal Component Analysis (PCA) without rotation. Then, retain the components with eigenvalues greater than 1.0. Then, run PCA again with varimax rotation.
# PCA (Principal Component Analysis) without rotation
pca0 <- principal(df1[,2:20], nfactors = 19, rotate = "none") # initial eigenvalues
pca0
## Principal Components Analysis
## Call: principal(r = df1[, 2:20], nfactors = 19, rotate = "none")
## Standardized loadings (pattern matrix) based upon correlation matrix
## PC1 PC2 PC3 PC4 PC5 PC6 PC7 PC8 PC9 PC10 PC11 PC12
## Q1 0.69 0.17 -0.45 0.04 0.06 -0.06 0.06 -0.16 -0.24 -0.06 -0.03 0.07
## Q2 0.55 0.26 0.34 0.27 0.38 -0.02 0.14 0.50 -0.15 0.01 -0.03 0.06
## Q3 0.69 -0.48 0.02 0.02 -0.04 -0.04 -0.08 0.06 0.01 0.16 -0.17 0.06
## Q4 0.62 0.26 0.39 -0.03 -0.26 -0.18 0.00 -0.12 -0.25 0.34 0.08 -0.04
## Q5 0.64 -0.29 0.04 0.24 -0.19 0.39 0.05 -0.03 -0.29 -0.25 0.20 -0.19
## Q6 0.64 0.23 -0.46 -0.14 0.09 -0.03 0.04 -0.02 -0.10 -0.05 -0.27 0.01
## Q7 0.66 0.31 0.40 0.01 -0.10 -0.04 0.00 -0.14 -0.07 0.07 -0.09 -0.15
## Q8 0.70 0.12 -0.04 -0.17 -0.26 0.30 -0.29 0.19 0.04 0.14 -0.11 0.22
## Q9 0.67 0.20 0.00 -0.39 0.21 -0.06 -0.17 -0.03 -0.05 -0.08 0.43 0.21
## Q10 0.68 -0.51 0.07 -0.02 0.09 -0.09 0.00 -0.07 0.14 0.02 0.00 -0.10
## Q11 0.71 0.14 -0.45 -0.02 0.06 -0.15 0.10 -0.01 -0.10 -0.02 -0.07 -0.13
## Q12 0.68 0.22 0.07 -0.35 -0.14 0.12 -0.05 0.23 0.19 -0.20 -0.04 -0.28
## Q13 0.75 -0.42 -0.03 -0.07 -0.02 -0.03 0.03 0.05 0.01 0.08 -0.10 0.00
## Q14 0.53 0.28 -0.23 0.50 0.09 -0.08 -0.50 -0.04 0.19 0.03 0.09 -0.13
## Q15 0.62 0.18 0.38 0.11 -0.21 -0.31 0.05 -0.10 0.14 -0.41 -0.13 0.19
## Q16 0.65 -0.50 0.05 0.14 0.04 0.07 -0.03 -0.06 -0.03 -0.07 0.00 0.28
## Q17 0.70 -0.40 0.05 -0.12 0.18 -0.19 0.08 0.02 0.13 0.07 0.16 -0.19
## Q18 0.58 0.22 -0.33 0.21 -0.29 0.05 0.43 0.09 0.29 0.15 0.22 0.11
## Q19 0.58 0.29 0.26 -0.01 0.37 0.39 0.15 -0.34 0.19 0.08 -0.11 0.02
## PC13 PC14 PC15 PC16 PC17 PC18 PC19 h2 u2 com
## Q1 0.16 -0.14 -0.06 -0.15 -0.22 0.20 -0.16 1 5.6e-16 3.6
## Q2 0.00 -0.01 0.03 -0.01 -0.05 -0.01 -0.03 1 4.4e-16 5.1
## Q3 0.16 0.23 0.01 -0.28 -0.04 0.06 0.25 1 -1.8e-15 3.4
## Q4 0.13 -0.07 0.25 0.03 0.11 -0.03 -0.05 1 -6.7e-16 5.0
## Q5 -0.12 0.04 0.08 -0.04 0.03 -0.01 0.05 1 -1.6e-15 4.6
## Q6 -0.16 0.30 0.21 0.19 0.10 0.06 -0.02 1 -4.4e-16 4.3
## Q7 -0.11 0.19 -0.39 0.14 -0.12 0.03 0.02 1 -4.4e-16 4.0
## Q8 -0.21 -0.22 0.01 0.05 -0.11 0.03 0.04 1 3.3e-16 3.8
## Q9 -0.04 0.16 -0.04 -0.07 0.01 -0.09 0.04 1 -1.1e-15 3.8
## Q10 -0.04 0.04 0.16 0.09 -0.34 -0.22 -0.13 1 -4.4e-16 3.3
## Q11 0.01 -0.25 -0.11 0.03 0.06 -0.27 0.23 1 -1.3e-15 3.3
## Q12 0.32 0.00 0.01 0.01 0.03 0.03 -0.06 1 -4.4e-16 3.9
## Q13 -0.14 -0.01 -0.17 -0.19 0.26 -0.10 -0.28 1 -6.7e-16 2.8
## Q14 0.02 0.04 0.02 -0.01 0.07 0.01 -0.04 1 -1.3e-15 4.6
## Q15 -0.10 -0.07 0.09 -0.09 0.02 0.01 0.04 1 0.0e+00 4.8
## Q16 0.28 -0.03 -0.10 0.33 0.12 0.01 0.00 1 -4.4e-16 3.8
## Q17 -0.17 -0.18 0.03 0.09 0.05 0.31 0.09 1 -2.2e-16 3.6
## Q18 0.01 0.11 -0.02 0.01 -0.02 0.00 -0.01 1 -2.2e-16 5.5
## Q19 0.03 -0.08 0.07 -0.09 0.06 -0.02 0.03 1 -1.3e-15 5.5
##
## PC1 PC2 PC3 PC4 PC5 PC6 PC7 PC8 PC9 PC10 PC11
## SS loadings 8.04 1.84 1.44 0.81 0.72 0.64 0.63 0.55 0.51 0.49 0.48
## Proportion Var 0.42 0.10 0.08 0.04 0.04 0.03 0.03 0.03 0.03 0.03 0.03
## Cumulative Var 0.42 0.52 0.60 0.64 0.68 0.71 0.74 0.77 0.80 0.83 0.85
## Proportion Explained 0.42 0.10 0.08 0.04 0.04 0.03 0.03 0.03 0.03 0.03 0.03
## Cumulative Proportion 0.42 0.52 0.60 0.64 0.68 0.71 0.74 0.77 0.80 0.83 0.85
## PC12 PC13 PC14 PC15 PC16 PC17 PC18 PC19
## SS loadings 0.45 0.41 0.40 0.37 0.34 0.32 0.29 0.26
## Proportion Var 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.01
## Cumulative Var 0.87 0.90 0.92 0.94 0.95 0.97 0.99 1.00
## Proportion Explained 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.01
## Cumulative Proportion 0.87 0.90 0.92 0.94 0.95 0.97 0.99 1.00
##
## Mean item complexity = 4.1
## Test of the hypothesis that 19 components are sufficient.
##
## The root mean square of the residuals (RMSR) is 0
## with the empirical chi square 0 with prob < NA
##
## Fit based upon off diagonal values = 1
# Determine number of eigenvalues > 1
pca0$values
## [1] 8.039 1.843 1.443 0.812 0.720 0.639 0.632 0.551 0.505 0.494 0.481 0.451
## [13] 0.411 0.403 0.367 0.344 0.318 0.290 0.259
nfactors <- sum(pca0$values > 1)
nfactors
## [1] 3
pca1 <- principal(df1[,2:20], nfactors = nfactors, rotate = "none")
pca1
## Principal Components Analysis
## Call: principal(r = df1[, 2:20], nfactors = nfactors, rotate = "none")
## Standardized loadings (pattern matrix) based upon correlation matrix
## PC1 PC2 PC3 h2 u2 com
## Q1 0.69 0.17 -0.45 0.71 0.29 1.9
## Q2 0.55 0.26 0.34 0.48 0.52 2.2
## Q3 0.69 -0.48 0.02 0.71 0.29 1.8
## Q4 0.62 0.26 0.39 0.60 0.40 2.1
## Q5 0.64 -0.29 0.04 0.50 0.50 1.4
## Q6 0.64 0.23 -0.46 0.67 0.33 2.1
## Q7 0.66 0.31 0.40 0.69 0.31 2.2
## Q8 0.70 0.12 -0.04 0.50 0.50 1.1
## Q9 0.67 0.20 0.00 0.49 0.51 1.2
## Q10 0.68 -0.51 0.07 0.73 0.27 1.9
## Q11 0.71 0.14 -0.45 0.72 0.28 1.8
## Q12 0.68 0.22 0.07 0.52 0.48 1.2
## Q13 0.75 -0.42 -0.03 0.73 0.27 1.6
## Q14 0.53 0.28 -0.23 0.41 0.59 1.9
## Q15 0.62 0.18 0.38 0.56 0.44 1.9
## Q16 0.65 -0.50 0.05 0.67 0.33 1.9
## Q17 0.70 -0.40 0.05 0.65 0.35 1.6
## Q18 0.58 0.22 -0.33 0.50 0.50 1.9
## Q19 0.58 0.29 0.26 0.49 0.51 1.9
##
## PC1 PC2 PC3
## SS loadings 8.04 1.84 1.44
## Proportion Var 0.42 0.10 0.08
## Cumulative Var 0.42 0.52 0.60
## Proportion Explained 0.71 0.16 0.13
## Cumulative Proportion 0.71 0.87 1.00
##
## Mean item complexity = 1.8
## Test of the hypothesis that 3 components are sufficient.
##
## The root mean square of the residuals (RMSR) is 0.03
## with the empirical chi square 299 with prob < 7.2e-18
##
## Fit based upon off diagonal values = 0.99
### Varimax rotation
pca2 <- principal(df1[,2:20], nfactors = nfactors, rotate = "varimax")
pca2
## Principal Components Analysis
## Call: principal(r = df1[, 2:20], nfactors = nfactors, rotate = "varimax")
## Standardized loadings (pattern matrix) based upon correlation matrix
## RC2 RC3 RC1 h2 u2 com
## Q1 0.25 0.78 0.16 0.71 0.29 1.3
## Q2 0.14 0.16 0.66 0.48 0.52 1.2
## Q3 0.80 0.19 0.17 0.71 0.29 1.2
## Q4 0.19 0.16 0.73 0.60 0.40 1.2
## Q5 0.62 0.22 0.25 0.50 0.50 1.6
## Q6 0.18 0.78 0.16 0.67 0.33 1.2
## Q7 0.17 0.19 0.79 0.69 0.31 1.2
## Q8 0.33 0.47 0.42 0.50 0.50 2.8
## Q9 0.25 0.45 0.47 0.49 0.51 2.5
## Q10 0.82 0.14 0.19 0.73 0.27 1.2
## Q11 0.29 0.78 0.16 0.72 0.28 1.4
## Q12 0.24 0.42 0.53 0.52 0.48 2.3
## Q13 0.78 0.29 0.20 0.73 0.27 1.4
## Q14 0.09 0.57 0.28 0.41 0.59 1.5
## Q15 0.25 0.13 0.69 0.56 0.44 1.3
## Q16 0.79 0.14 0.16 0.67 0.33 1.1
## Q17 0.74 0.21 0.24 0.65 0.35 1.4
## Q18 0.15 0.66 0.21 0.50 0.50 1.3
## Q19 0.14 0.24 0.64 0.49 0.51 1.4
##
## RC2 RC3 RC1
## SS loadings 4.09 3.62 3.62
## Proportion Var 0.22 0.19 0.19
## Cumulative Var 0.22 0.41 0.60
## Proportion Explained 0.36 0.32 0.32
## Cumulative Proportion 0.36 0.68 1.00
##
## Mean item complexity = 1.5
## Test of the hypothesis that 3 components are sufficient.
##
## The root mean square of the residuals (RMSR) is 0.03
## with the empirical chi square 299 with prob < 7.2e-18
##
## Fit based upon off diagonal values = 0.99
pca2$Vaccounted["Cumulative Var",]
## RC2 RC3 RC1
## 0.215 0.406 0.596
mean(pca0$complexity)
## [1] 4.13
mean(pca1$complexity)
## [1] 1.76
mean(pca2$complexity)
## [1] 1.5
pca1$Vaccounted["SS loadings",]
## PC1 PC2 PC3
## 8.04 1.84 1.44
pca2$Vaccounted["SS loadings",]
## RC2 RC3 RC1
## 4.09 3.62 3.62
fa.sort(pca2)
## Principal Components Analysis
## Call: principal(r = df1[, 2:20], nfactors = nfactors, rotate = "varimax")
## Standardized loadings (pattern matrix) based upon correlation matrix
## RC2 RC3 RC1 h2 u2 com
## Q10 0.82 0.14 0.19 0.73 0.27 1.2
## Q3 0.80 0.19 0.17 0.71 0.29 1.2
## Q16 0.79 0.14 0.16 0.67 0.33 1.1
## Q13 0.78 0.29 0.20 0.73 0.27 1.4
## Q17 0.74 0.21 0.24 0.65 0.35 1.4
## Q5 0.62 0.22 0.25 0.50 0.50 1.6
## Q1 0.25 0.78 0.16 0.71 0.29 1.3
## Q11 0.29 0.78 0.16 0.72 0.28 1.4
## Q6 0.18 0.78 0.16 0.67 0.33 1.2
## Q18 0.15 0.66 0.21 0.50 0.50 1.3
## Q14 0.09 0.57 0.28 0.41 0.59 1.5
## Q8 0.33 0.47 0.42 0.50 0.50 2.8
## Q7 0.17 0.19 0.79 0.69 0.31 1.2
## Q4 0.19 0.16 0.73 0.60 0.40 1.2
## Q15 0.25 0.13 0.69 0.56 0.44 1.3
## Q2 0.14 0.16 0.66 0.48 0.52 1.2
## Q19 0.14 0.24 0.64 0.49 0.51 1.4
## Q12 0.24 0.42 0.53 0.52 0.48 2.3
## Q9 0.25 0.45 0.47 0.49 0.51 2.5
##
## RC2 RC3 RC1
## SS loadings 4.09 3.62 3.62
## Proportion Var 0.22 0.19 0.19
## Cumulative Var 0.22 0.41 0.60
## Proportion Explained 0.36 0.32 0.32
## Cumulative Proportion 0.36 0.68 1.00
##
## Mean item complexity = 1.5
## Test of the hypothesis that 3 components are sufficient.
##
## The root mean square of the residuals (RMSR) is 0.03
## with the empirical chi square 299 with prob < 7.2e-18
##
## Fit based upon off diagonal values = 0.99
fa.diagram(pca2)
Questions 10—11 utilize the sorted component loadings matrix generated above.
Conduct the Principal Axis Factoring (PAF) without rotation but with the same number of factors retained at PCA. Then, run PAF again with varimax rotation.
paf1 <- fa(r=df1[,2:20], nfactors = nfactors, rotate = "none", fm = "pa")
paf1
## Factor Analysis using method = pa
## Call: fa(r = df1[, 2:20], nfactors = nfactors, rotate = "none", fm = "pa")
## Standardized loadings (pattern matrix) based upon correlation matrix
## PA1 PA2 PA3 h2 u2 com
## Q1 0.68 0.18 -0.40 0.65 0.35 1.8
## Q2 0.52 0.20 0.24 0.36 0.64 1.7
## Q3 0.68 -0.43 0.01 0.65 0.35 1.7
## Q4 0.60 0.22 0.33 0.52 0.48 1.9
## Q5 0.61 -0.22 0.03 0.42 0.58 1.3
## Q6 0.63 0.22 -0.38 0.59 0.41 1.9
## Q7 0.65 0.29 0.39 0.65 0.35 2.1
## Q8 0.67 0.11 -0.01 0.46 0.54 1.1
## Q9 0.64 0.17 0.01 0.44 0.56 1.1
## Q10 0.67 -0.47 0.05 0.68 0.32 1.8
## Q11 0.70 0.16 -0.41 0.69 0.31 1.7
## Q12 0.65 0.20 0.07 0.47 0.53 1.2
## Q13 0.74 -0.38 -0.04 0.69 0.31 1.5
## Q14 0.50 0.21 -0.13 0.31 0.69 1.5
## Q15 0.59 0.15 0.31 0.47 0.53 1.7
## Q16 0.63 -0.43 0.03 0.59 0.41 1.8
## Q17 0.68 -0.34 0.03 0.58 0.42 1.5
## Q18 0.55 0.19 -0.22 0.39 0.61 1.6
## Q19 0.55 0.22 0.20 0.39 0.61 1.6
##
## PA1 PA2 PA3
## SS loadings 7.58 1.42 1.00
## Proportion Var 0.40 0.07 0.05
## Cumulative Var 0.40 0.47 0.53
## Proportion Explained 0.76 0.14 0.10
## Cumulative Proportion 0.76 0.90 1.00
##
## Mean item complexity = 1.6
## Test of the hypothesis that 3 factors are sufficient.
##
## df null model = 171 with the objective function = 9.5 with Chi Square = 7522
## df of the model are 117 and the objective function was 0.35
##
## The root mean square of the residuals (RMSR) is 0.02
## The df corrected root mean square of the residuals is 0.03
##
## The harmonic n.obs is 800 with the empirical chi square 70.5 with prob < 1
## The total n.obs was 800 with Likelihood Chi Square = 278 with prob < 4.4e-15
##
## Tucker Lewis Index of factoring reliability = 0.968
## RMSEA index = 0.041 and the 90 % confidence intervals are 0.035 0.048
## BIC = -504
## Fit based upon off diagonal values = 1
## Measures of factor score adequacy
## PA1 PA2 PA3
## Correlation of (regression) scores with factors 0.97 0.88 0.84
## Multiple R square of scores with factors 0.95 0.78 0.71
## Minimum correlation of possible factor scores 0.89 0.56 0.42
paf2 <- fa(r=df1[,2:20], nfactors = nfactors, rotate = "varimax", fm = "pa")
paf2
## Factor Analysis using method = pa
## Call: fa(r = df1[, 2:20], nfactors = nfactors, rotate = "varimax",
## fm = "pa")
## Standardized loadings (pattern matrix) based upon correlation matrix
## PA2 PA1 PA3 h2 u2 com
## Q1 0.25 0.20 0.74 0.65 0.35 1.4
## Q2 0.17 0.55 0.19 0.36 0.64 1.4
## Q3 0.75 0.19 0.20 0.65 0.35 1.3
## Q4 0.20 0.67 0.18 0.52 0.48 1.3
## Q5 0.55 0.27 0.23 0.42 0.58 1.9
## Q6 0.18 0.20 0.72 0.59 0.41 1.3
## Q7 0.17 0.77 0.19 0.65 0.35 1.2
## Q8 0.32 0.42 0.43 0.46 0.54 2.8
## Q9 0.25 0.45 0.42 0.44 0.56 2.6
## Q10 0.78 0.20 0.16 0.68 0.32 1.2
## Q11 0.28 0.19 0.76 0.69 0.31 1.4
## Q12 0.24 0.51 0.39 0.47 0.53 2.4
## Q13 0.75 0.21 0.30 0.69 0.31 1.5
## Q14 0.13 0.29 0.46 0.31 0.69 1.9
## Q15 0.25 0.62 0.16 0.47 0.53 1.5
## Q16 0.73 0.18 0.16 0.59 0.41 1.2
## Q17 0.69 0.25 0.23 0.58 0.42 1.5
## Q18 0.17 0.25 0.54 0.39 0.61 1.7
## Q19 0.16 0.55 0.25 0.39 0.61 1.6
##
## PA2 PA1 PA3
## SS loadings 3.67 3.20 3.13
## Proportion Var 0.19 0.17 0.16
## Cumulative Var 0.19 0.36 0.53
## Proportion Explained 0.37 0.32 0.31
## Cumulative Proportion 0.37 0.69 1.00
##
## Mean item complexity = 1.6
## Test of the hypothesis that 3 factors are sufficient.
##
## df null model = 171 with the objective function = 9.5 with Chi Square = 7522
## df of the model are 117 and the objective function was 0.35
##
## The root mean square of the residuals (RMSR) is 0.02
## The df corrected root mean square of the residuals is 0.03
##
## The harmonic n.obs is 800 with the empirical chi square 70.5 with prob < 1
## The total n.obs was 800 with Likelihood Chi Square = 278 with prob < 4.4e-15
##
## Tucker Lewis Index of factoring reliability = 0.968
## RMSEA index = 0.041 and the 90 % confidence intervals are 0.035 0.048
## BIC = -504
## Fit based upon off diagonal values = 1
## Measures of factor score adequacy
## PA2 PA1 PA3
## Correlation of (regression) scores with factors 0.92 0.89 0.9
## Multiple R square of scores with factors 0.85 0.79 0.8
## Minimum correlation of possible factor scores 0.70 0.57 0.6
pca1$Vaccounted["Cumulative Var",]
## PC1 PC2 PC3
## 0.423 0.520 0.596
paf1$Vaccounted["Cumulative Var",]
## PA1 PA2 PA3
## 0.399 0.474 0.527
pca2$Vaccounted["Cumulative Var",]
## RC2 RC3 RC1
## 0.215 0.406 0.596
paf2$Vaccounted["Cumulative Var",]
## PA2 PA1 PA3
## 0.193 0.362 0.527
## Compare and contrast communalities for PCA and PAF
data.frame(PCA = pca2$communality, PAF = paf2$communality,
Difference = pca2$communality - paf2$communality)
## PCA PAF Difference
## Q1 0.706 0.654 0.0525
## Q2 0.480 0.363 0.1167
## Q3 0.706 0.647 0.0595
## Q4 0.602 0.518 0.0846
## Q5 0.497 0.424 0.0735
## Q6 0.672 0.586 0.0862
## Q7 0.693 0.655 0.0383
## Q8 0.502 0.460 0.0414
## Q9 0.487 0.439 0.0473
## Q10 0.729 0.676 0.0530
## Q11 0.725 0.688 0.0368
## Q12 0.518 0.470 0.0477
## Q13 0.732 0.694 0.0389
## Q14 0.408 0.310 0.0978
## Q15 0.561 0.469 0.0924
## Q16 0.673 0.590 0.0833
## Q17 0.650 0.585 0.0649
## Q18 0.497 0.388 0.1090
## Q19 0.486 0.390 0.0956
14.In PAF, how many factors do you want to retain? Explain your answer.
paf1$Vaccounted["SS loadings",]
## PA1 PA2 PA3
## 7.58 1.42 1.00
fa.parallel(df1[,2:20], fa="fa")
## Parallel analysis suggests that the number of factors = 3 and the number of components = NA
fa.plot(paf2, labels = colnames(df1[,2:20]))
principal(df1[,2:20], nfactors = 3, rotate="oblimin")$Phi
## Loading required namespace: GPArotation
## TC2 TC1 TC3
## TC2 1.000 0.480 0.499
## TC1 0.480 1.000 0.496
## TC3 0.499 0.496 1.000