Hi there, welcome. This website supplies the supplementary materials for the longitudinal structural equation modeling (LSEM) short course taught by Dr. Gregory R. Hancock.

In class, you have already gained a good knowledge about how to use Mplus with a variety of models. Here we are going to introduce you to another useful tool that can be used to conduct latent variable analysis: lavvan.

lavaan is a free open-source package in R that is developed for latent variable modeling. lavaan is a powerful tool that can accomodate most of the models you have learned in this course. The authors of lavaan package has developed a series of tutorials for lavaan users. We would recommend you to go over their tutorials if you are new to lavaan. After all, the developers have the best knowledge of their software package.

For some models, we will use the OpenMx package to complete the tasks. OpenMx is also a free open-source package that is highly flexible and has some functionality that is beyond the current version of lavaan.

The tutorials we supply here are all based on the examples and exercises you have already seen in class, where you have practiced with Mplus. We will walk you through these examples using R in our tutorials. Mplus, lavaan, and OpenMx are all great tools for SEM. We provide the R tutorials here with the hope to help you better learn about SEM in this course. First, with the tutorial materials available, you can better focus on the more important contents when you are in the class. It can be frustrating and distracting when you want to focus on the lectures while R is yelling at you with some error message. We want to take that burden off you so you can enjoy your class time better. Actually, once you have had a solid grasp on the mechanisms of SEM, it will not be too difficult to translate your knowledge to a software language (Mplus, lavaan, LISREL, OpenMx, STATA…). Providing the parallel R materials here, in addition to the Mplus materials you have learned in class, we wish to add to your toolkit by showing you how to use lavaan (and OpenMx), such that you will have an additional (free) tool at your disposal when you need to employ SEM in your own research projects.


To get you started:

Before we get started, please make sure you have installed R or RStuido, as well as the lavaan package on your device.

  1. Install the latest version of RStudio or R.
  2. Install lavaan from CRAN.
install.packages("lavaan", dependencies=TRUE)
library(lavaan)

Important

Please make sure you have correctly set up your working directory to where your data are stored. To see your current working directory:

getwd()

To change your working directory, you can either use the setwd() function, or click the “Session –> Set Working Directory” button in the menu.

mypath <- "/SEM Second Course Mplus 2019/Advanced Examples/5. Growth Examples"
setwd(mypath)

In-class Examples

  1. Panel Models
  2. Simple Mean Structure Modeling
  3. Repeated Measures Means Models
  4. Linear Latent Growth Models
  5. More Latent Growth Models
  6. Nonlinear Latent Growth Models
  7. Linear Latent Growth Models Extensions
  8. Power Analysis

Hands-on Exercises

  1. Structured Means Analysis Exercise
  2. Repeated Measure Means Exercise
  3. Latent Growth Models Exercise
  4. Conditional Latent Growth Models Exercise
  5. Power Analysis

© Copyright 2024 @Yi Feng and @Gregory R. Hancock.