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

Questo esercizio fa parte del corso

Factor Analysis in R

Visualizza il corso

Istruzioni dell'esercizio

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

Esercizio pratico interattivo

Prova a risolvere questo esercizio completando il codice di esempio.

# 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[___, ]
Modifica ed esegui il codice