MulaiMulai sekarang secara gratis

Splitting the BFI dataset

For this chapter, you'll be using the bfi dataset, which consists of responses to 25 items measuring the Big Five personality traits. I've trimmed the dataset down to only the item responses for your use. Since you'll be doing both exploratory and confirmatory factor analyses on this data, you'll want to start out by splitting the dataset. You'll use the same process that you learned in Chapter 1 when you split the gcbs dataset.

Latihan ini adalah bagian dari kursus

Factor Analysis in R

Lihat Kursus

Petunjuk latihan

  • Split bfi in half using two sets of indices (indices_EFA and indices_CFA) to determine which rows belong to each dataset.
  • Use the first set of indices to create a dataset for your EFA, then use the second set for your CFA dataset.

Latihan interaktif praktis

Cobalah latihan ini dengan menyelesaikan kode contoh berikut.

# 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[___, ]
Edit dan Jalankan Kode