R Tutorial: Model Specification

Erin Buchanan explains structural equation modeling in R using the lavaan package. Manifest variables like Block Design and Digit Span are direct measurements; latent variables are abstract constructs they indicate. She walks through building a one-factor model with the Holzinger and Swineford dataset, requiring at least three manifest indicators per latent factor and using the =~ operator to specify relationships.
Chapters
Hi, my name is Erin Buchanan and I'm a statistician who studies the use of statistics and computational linguistics. We are going to begin learning about structural equation models, often abbreviated to SIM and the lavaan package, by starting with some important terminology and defining our first model. The main goal of CEM is to explore the relationship between variables similar to regression analyses. Furthermore, SIM allows you to confirm if previously developed models fit well with new data, which often occurs after an exploratory analysis like a factor analysis. In SIM models there are two types of variables. First, there are manifest variables which are direct measurements in your data set. For example, you can directly measure the longest number of sequential digits a person can accurately remember or digit span. Manifest variables are represented by squares on this diagram. Second are latent variables which are represented by circles on this diagram. This variable is the abstract underlying phenomenon you're trying to measure indirectly using the measurements from the manifest variables. The idea is that the manifest variables are indirect measures of the latent variables and therefore the latent variable has a causal relationship to the values obtained with manifest variables. In this example, we will use Block Design, digitspan, and Matrix Reasoning subtests as manifest variables to indirectly measure the latent variable intelligence. These three manifest variables are used to measure abstract reasoning, attention, and visual perception, which are believed to be core components of IQ. Let's create a one factor model of the Holzinger and Swineford 1939 data set. This data set contains nine manifest variables measuring the mental ability of children covering visual tasks, writing, word comprehension, and processing speed tasks. One factor models have one latent variable with at least three manifest variables. We will create a model measuring a visual speed factor using six of the nine manifest variables. X, 1, 2, and 3 are measurements of visual perception while X, 7, 8, and 9 are speed, accounting and addition tasks. You will need to name your model and a good habit is to use the word model to add help distinguish between the specified and fitted models. Second, you will name your latent variable any name you like as long as it's not a name in the data set you loaded. An important symbol here is equals tilde which indicates the direction of the prediction. This denotes that we expect the latent variable to predict the scores on the items. Last, you will use the names of the columns in the data set to define the items related to the latent variable. These item names must match names in the data frame and be spelled exactly the same. You will use plus signs between them in a similar fashion to how a regression model is defined. The model is bookended by quotation marks, and you can use either single or double quotation marks. Let's set up some models to make sure you've got these key concepts.
More from Richie

#359 My Best Friend is AI with Valerie Tiberius, Professor of Philosophy at University of Minnesota

How AI Agents Will Work While You Sleep | Ruslan Salakhutdinov, Professor at Carnegie Mellon

#358 How AI Agents Will Work While You Sleep | Ruslan Salakhutdinov, Professor at Carnegie Mellon







