切分你的資料集
在量表發展的過程中,務必要在不同的資料集上分別進行 EFA 與 CFA,因為使用同一個資料集會導致模型配適指標被高估。做法是把資料集對半切分,一半用於 EFA,另一半用於 CFA。
本練習屬於課程
R 中的因素分析
練習說明
- 使用兩組索引將資料集對半切分,以決定每筆列資料應屬於哪一個資料集。
- 先用第一組索引建立 EFA 的資料集,再用第二組索引建立 CFA 的資料集。
動手互動練習
試著完成這個範例程式碼,體驗一下這個練習。
# Establish two sets of indices to split the dataset
N <- nrow(gcbs)
indices <- seq(1, ___)
indices_EFA <- sample(indices, floor((.5*___)))
indices_CFA <- indices[!(indices %in% ___)]
# Use those indices to split the dataset into halves for your EFA and CFA
gcbs_EFA <- gcbs[___, ]
gcbs_CFA <- gcbs[___, ]