Get Started

Calculating eigenvalues

To empirically determine the dimensionality of your data, a common strategy is to examine the eigenvalues. Eigenvalues are numeric representations of the amount of variance explained by each factor or component. Eigenvalues are calculated from a correlation matrix, so you'll need to use cor() to calculate and store the dataset's correlation matrix before calculating eigenvalues. You'll need to specify that you want to use pairwise complete observations. The default is to use everything, but if your dataset has any missing values, this will leave you with a matrix full of NAs.

You'll do these calculations on the bfi_EFA dataset you just created - remember, you're saving the data in bfi_CFA for your confirmatory analysis!

This is a part of the course

“Factor Analysis in R”

View Course

Exercise instructions

  • Use cor() to calculate the correlation matrix for your EFA dataset. Set the value of the use argument to use pairwise-complete observations.
  • Next, use that correlation matrix with the eigen() function to get eigenvalues.
  • The eigenvalues are stored in the values element of the eigenvals list object. Take a look!

Hands-on interactive exercise

Have a go at this exercise by completing this sample code.

# Calculate the correlation matrix first
bfi_EFA_cor <- ___(bfi_EFA, use = ___)

# Then use that correlation matrix to calculate eigenvalues
eigenvals <- ___(bfi_EFA_cor)

# Look at the eigenvalues returned
___$___
Edit and Run Code

This exercise is part of the course

Factor Analysis in R

AdvancedSkill Level
4.2+
12 reviews

Explore latent variables, such as personality, using exploratory and confirmatory factor analyses.

This chapter will show you how to extend the single-factor EFA you learned in Chapter 1 to multidimensional data.

Exercise 1: Determining dimensionalityExercise 2: Splitting the BFI datasetExercise 3: Calculating eigenvalues
Exercise 4: Creating a scree plotExercise 5: Interpreting the scree plotExercise 6: Understanding multidimensional dataExercise 7: Conducting a multidimensional EFAExercise 8: Interpreting the resultsExercise 9: Investigating model fitExercise 10: Interpret absolute model fit statisticsExercise 11: Selecting the best model

What is DataCamp?

Learn the data skills you need online at your own pace—from non-coding essentials to data science and machine learning.

Start Learning for Free