Structural-Equation-Modeling-foR-Psychologists
Structural-Equation-Modeling-foR-Psychologists copied to clipboard
Lesson files used in the Structural Equation Modeling for Psychologists.
Structural Equation Modeling foR Psychologists
Last updated 2021-04-21.
This Github repo contains all lesson files for SEM - Practical
Applications in R. The goal is to impart students with the basic tools
to construct, evaluate and compare Structural Equation Models (SEM; w/
plots), using lavaan.
These topics were taught in the graduate-level course Structural Equation Modeling (Psych Dep., Ben-Gurion University of the Negev, Spring, 2021). This course assumes basic competence in R (importing, regression modeling, plotting, etc.), along the lines of Practical Applications in R for Psychologists.
Notes:
- This repo contains only materials relating to Practical Applications in R, and does not contain any theoretical or introductory materials.
- Please note that some code does not work on purpose, to force students to learn to debug.
Setup
You will need:
- A fresh installation of
R(preferably version 4.0 or above). - RStudio IDE (optional, but recommended).
- The following packages, listed by lesson:
| Lesson | Packages |
|---|---|
| 01 path analysis | lavaan, tidySEM, dplyr, ggplot2 |
| 02 CFA | lavaan, tidySEM, dplyr, semTools, psychTools, patchwork |
| 03 SEM with CLPM | lavaan, tidySEM, magrittr, bayestestR |
| 04 multiple group analysis | lavaan, tidySEM, bayestestR, semTools |
| 05 (mediated) moderation | lavaan, semTools |
| 06 latent growth curve + multi-level SEM | lavaan, tidySEM |
| 07 assumption checks | lavaan, semTools, MVN, car |
| 08 EFA | lavaan, psych, parameters, nFactors, GPArotation, psychTools |
You can install all the packages used by running:
# in alphabetical order:
pkgs <- c(
"bayestestR", "car", "dplyr", "ggplot2", "GPArotation", "lavaan",
"magrittr", "MVN", "nFactors", "parameters", "patchwork", "psych",
"psychTools", "semTools", "tidySEM"
)
install.packages(pkgs, dependencies = TRUE)
Package Versions
The package versions used here:
bayestestR0.9.0 (Dev)car3.0-10 (CRAN)dplyr1.0.5 (CRAN)ggplot23.3.3 (CRAN)GPArotation2014.11-1 (CRAN)lavaan0.6-7 (CRAN)magrittr2.0.1 (CRAN)MVN5.8 (CRAN)nFactors2.4.1 (CRAN)parameters0.13.0 (CRAN)patchwork1.1.1 (CRAN)psych2.0.12 (CRAN)psychTools2.0.8 (CRAN)semTools0.5-4 (CRAN)tidySEM0.1.9.2 (Github: cjvanlissa/tidySEM)
Other Useful Resources
Other Courses
In addition to lavaan’s
toutorials, you might find
the following online courses useful:
- Sacha Epskamp’s online course and
YouTube
lectures.
- See also the
psychonetricspackage for psychometric network modeling.
- See also the
- Michael Hallquist’s course.
Selected Quantitude (podcast) Episods
These are selected episodes from the Quantitude podcast related to SEM: