開始使用免費開始

切分 BFI 資料集

在本章中,你會使用 bfi 資料集,內容是 25 個題項對大五人格特質的作答。為了方便你練習,我已將資料集裁剪成只保留題項作答。因為你會在此資料上進行探索性與驗證性因素分析,所以一開始需要先把資料集切分。切分方式與你在第 1 章處理 gcbs 資料集時學到的流程相同。

本練習屬於課程

R 中的因素分析

檢視課程

練習說明

  • 使用兩組索引(indices_EFAindices_CFA)將 bfi 對半切分,以決定每列資料要分到哪個子資料集。
  • 使用第一組索引建立用於 EFA 的資料集,再使用第二組索引建立用於 CFA 的資料集。

動手互動練習

試著完成這個範例程式碼,體驗一下這個練習。

# Establish two sets of indices to split the dataset
N <- nrow(___)
indices <- seq(___, ___)
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
bfi_EFA <- bfi[___, ]
bfi_CFA <- bfi[___, ]
編輯並執行程式碼