112我的參加了六各測驗,包括非語言的普通智力測試general)、畫圖測試(picture)、積木圖案測試(blocks)、迷宮測驗(maze)、閱讀測驗(reading)和詞彙測驗(vocab),
潛在的心理學因素來解釋參與者的測驗得分?
數據集 ability.cov 提供了變量的協方差矩陣,你能夠用 cov2cor() 函數將其轉化爲相關係數矩陣。數據集沒有缺失值
> options(digits =2)
> covariances <- ability.cov$cov
> correlations <- cov2cor(covariances) #相關係數矩陣
> correlations
general picture blocks maze reading vocab
general 1.00 0.47 0.55 0.34 0.58 0.51
picture 0.47 1.00 0.57 0.19 0.26 0.24
blocks 0.55 0.57 1.00 0.45 0.35 0.36
maze 0.34 0.19 0.45 1.00 0.18 0.22
reading 0.58 0.26 0.35 0.18 1.00 0.79
vocab 0.51 0.24 0.36 0.22 0.79 1.00
由於要尋求用來
解釋數據的潛在結構,可以使用 EFA 方法。與使用 PCA 相同,下一步工做爲判斷須要提取幾個因子
能夠判斷提取的因子數
library(psych)
covariances <- ability.cov$cov
correlations <- cov2cor(covariances) #將協方差矩陣轉化爲相關係數矩陣
fa.parallel(correlations,
n.obs=112, #獲取樣本量
fa="both", #PCA和EFA都畫出
n.iter = 100, #模擬100次
show.legend = F,
#show.legend=T,
#legend=legend("topleft"),
main = "Scree plot with parallel analysis")
a、代碼中 fa=both ,因子圖形將會同時展現PCA、EFA
b、若是使用PCA方法,能夠選擇一個成分(碎石檢驗和平行分析)或者兩個檢驗(特徵值大於1),當搖擺不定時,高估因子一般比低估因子數的結果好,由於高估因子數通常較少曲解「真實」狀況
c、
對於 EFA ,kaiser-Harris準則的特許值大於0,而不是1,圖中該準則建議選擇兩個因子