CommencerCommencer gratuitement

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.

Cet exercice fait partie du cours

Factor Analysis in R

Afficher le cours

Instructions

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

Exercice interactif pratique

Essayez cet exercice en complétant cet exemple de code.

# 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[___, ]
Modifier et exécuter le code