Steps of conducting Confirmatory Factor Analysis (CFA) in R

The CFA requires the model/structure to be specified. Suppose this is the structure we want to test is as:

  • Subscale1 (extraversion)
  • Subscale2 (neuroticism)
  • Subscale3 (agreeableness)
  • Subscale4 (conscientiousness)
  • Subscale5 (openness to experience)

We will conduct confirmatory factor analysis using lavaan package.

First install and load the package:

install.packages(“lavaan”)

library(lavaan)

##  lavaan is BETA software! Please report any bugs.

##

## Attaching package: ‘lavaan’ ## The following object is masked from ‘package:psych’:

##

## cor2cov

Then we define the model by specifying the relationship between items and factors:

path <- ‘
f1 =~ E1 + E2 + E3 + E4 + E5 + E6 + E7 + E8 + E9 + E10
f2 =~ N1 + N2 + N3 + N4 + N5 + N6 + N7 + N8 + N9 + N10 f3 =~ A1 + A2 + A3 + A4 + A5 + A6 + A7 + A8 + A9 + A10 f4 =~ C1 + C2 + C3 + C4 + C5 + C6 + C7 + C8 + C9 + C10 f5 =~ O1 + O2 + O3 + O4 + O5 + O6 + O7 + O8 + O9 + O10

The last step is to fit the model and output the results:

model <- cfa(path, data= pcafit)
summary(model, fit.measures=TRUE)

Output:

Note: The first thing to do when conducting a factor analysis is to look at the correlations of the variables. If got warning message about non-positive definite (NPD) matrix, this may be due to the linear dependencies among the variables. If you request a factor extraction method other than principal components (PC) or unweighted least squares (ULS), an NPD matrix will cause the procedure to stop without extracting factors. If one or more of the eigenvalues are negative, then PC and ULS extraction will also terminate.

Write up:

Regarding the CFA we used goodness of fit indices to evaluate the model. Based on the literature, the CFI and TLI cut-off scores should be above 0.9. We got a CFI value of 0.75, and a TLI value of 0.73, which are not good fit indices for the internal validity. The value of RMSEA is 0.06, and SRMR is 0.07, which is a little above the cut-of score of .05. All of the estimate coefficients loadings are significant. However, some of them have a negative sign which indicate that they need to be recoded. All variances have a positive sign which is good. The first factor (Extraversion) has five negative items; E2, E4, E6, E8, and E10. The second factor (Neuroticism) has two negative items; N2 and N4. The third factor (Agreeableness) has six negative items; A2, A4, A6, A8, A9, and A10. The fourth factor, which is Conscientiousness, has four negative items; C2, C4, C6, and C8. The fifth factor, which is Openness to experience, has three negative items; O2, O4, and O6. We should look at the item content to decide if they need to be recoded, deleted, or changed. According to Kline (2005), negative variance estimates or loadings are unacceptable.

Reference:

Goldberg, L. R. (1992). The development of markers for the Big-Five factor structure. Psychological Assessment, 4(1), 26–42. https://doi.org/10.1037/1040-3590.4.1.26

Kline, R. B. (2005). Principles and practice of structural equation modeling (2nd ed). Guilford Press.

Sources:

https://openpsychometrics.org/tests/IPIP-BFFM https://ipip.ori.org/new_ipip-50-item-scale.htm