Part (a)
mentalCov <- matrix(c(.165, .031, .055, .038, .031, .205, 0.089, 0.040, .055, 0.089, .165, .053, .038, 0.040, .053, .172), nrow = 4, ncol = 4)
rownames(mentalCov)<- c("Comfortable", "Benefits", "Anonymity", "Discussed")
colnames(mentalCov)<- c("Comfortable", "Benefits", "Anonymity", "Discussed")
mentalCov
## Comfortable Benefits Anonymity Discussed
## Comfortable 0.165 0.031 0.055 0.038
## Benefits 0.031 0.205 0.089 0.040
## Anonymity 0.055 0.089 0.165 0.053
## Discussed 0.038 0.040 0.053 0.172
R <- solve(sqrt(diag(diag(mentalCov)))) %*% mentalCov %*%
t(solve(sqrt(diag(diag(mentalCov)))))
rownames(R)<- c("Comfortable", "Benefits", "Anonymity", "Discussed")
colnames(R)<- c("Comfortable", "Benefits", "Anonymity", "Discussed")
R
## Comfortable Benefits Anonymity Discussed
## Comfortable 1.0000000 0.1685554 0.3333333 0.2255680
## Benefits 0.1685554 1.0000000 0.4839173 0.2130192
## Anonymity 0.3333333 0.4839173 1.0000000 0.3146079
## Discussed 0.2255680 0.2130192 0.3146079 1.0000000
Part (b)
Rpredictors <- R[2:4, 2:4]
eigenvalues <- eigen(Rpredictors)$values
joliffe <- sum(eigenvalues > .7)
library(psych)
## Warning: package 'psych' was built under R version 4.0.5
rotatedPredictors <- pca(Rpredictors, joliffe, rotate = "varimax")$loadings[]
rotatedPredictors
## RC1 RC2
## Benefits 0.8917286 0.02004494
## Anonymity 0.8036748 0.27631981
## Discussed 0.1461694 0.97938309
Part (c)
We only have one response variable, which is "Comfortable", so it wouldn't make sense to do dimensionality reduction. We can't reduce one dimension to less than one dimension.