LoslegenKostenlos loslegen

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.

Diese Übung ist Teil des Kurses

Factor Analysis in R

Kurs anzeigen

Anleitung zur Übung

  • 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.

Interaktive Übung

Versuche dich an dieser Übung, indem du diesen Beispielcode vervollständigst.

# 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[___, ]
Code bearbeiten und ausführen