Get startedGet started for free

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.

This exercise is part of the course

Factor Analysis in R

View Course

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

Hands-on interactive exercise

Have a go at this exercise by completing this sample 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[___, ]
Edit and Run Code