In this chapter, we will discuss the fundamental ideas underlying structural equation modeling, which are often overlooked in other books discussing structural equation modeling (SEM) in R, and then delve into how SEM is done in R. We will then discuss two R packages, OpenMx and lavaan. We can directly apply our discussion of the linear algebra underlying SEM using OpenMx. Because of this, we will go over OpenMx first. We will then discuss lavaan, which is probably more user friendly because it sweeps the matrices and linear algebra representations under the rug so that they are invisible unless the user really goes looking for them. Both packages continue to be developed and there will always be some features better supported in one of these packages than in the other.
The previous chapter introduced quantitative techniques that apply linear algebra to correlation or covariance matrices to gain some insight into the correlation or covariance structure of a large dataset. This chapter will continue this theme, discussing SEM and a common application of SEM, Confirmatory Factor Analysis (CFA).
In this chapter, we will discuss the following topics:
We will use three datasets in this chapter, which are discussed in the following sections to give you an idea of their content.
This is a dataset included in the lavaan package. This is a classic dataset for use in SEM. It contains variables concerned with political freedom movements and economic development in 1960 and 1965, as follows:
This is the National Health and Nutrition Examination Survey (NHANES) physical functioning dataset used in prior chapters. For the purpose of this chapter, it is worth noting that this is a dataset of complete data that has 20 ordinal categorical items concerned with how much difficulty a person faces during basic self-care tasks.
This is another classic dataset of structural equation modeling. We will use the data from the lavaan package (though other packages in R contain the same dataset). It has basic demographic data on students and nine items concerned with mental abilities.
We will simply look at the following variables from this dataset:
It is hypothesized that three domains of intellectual function, visual, textual, and speed, account for the responses of individuals to the nine items. We will apply such a model here.
3.135.187.210