• Stars
    star
    131
  • Rank 269,383 (Top 6 %)
  • Language
    R
  • License
    Other
  • Created over 4 years ago
  • Updated about 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Lesson files used in the Structural Equation Modeling for Psychologists.

Structural Equation Modeling foR Psychologists


Last updated 2023-06-03.

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). 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:

  1. A fresh installation of R (preferably version 4.0 or above).
  2. RStudio IDE (optional, but recommended).
  3. 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, tidyverse, recipes, parameters, factoextra, performance, nFactors, GPArotation, psychTools

You can install all the packages used by running:

# in alphabetical order:

pkgs <-
  c(
    "bayestestR", "car", "dplyr", "factoextra", "ggplot2", "GPArotation",
    "lavaan", "magrittr", "MVN", "nFactors", "parameters", "patchwork",
    "performance", "psych", "psychTools", "recipes", "semTools",
    "tidySEM", "tidyverse"
  )

install.packages(pkgs, dependencies = TRUE)
Package Versions

The package versions used here:

  • bayestestR 0.13.1 (CRAN)
  • car 3.1-2 (CRAN)
  • dplyr 1.1.1 (CRAN)
  • factoextra 1.0.7 (CRAN)
  • ggplot2 3.4.2 (CRAN)
  • GPArotation 2023.3-1 (CRAN)
  • lavaan 0.6-15 (CRAN)
  • magrittr 2.0.3 (CRAN)
  • MVN 5.9 (CRAN)
  • nFactors 2.4.1.1 (CRAN)
  • parameters 0.21.0 (CRAN)
  • patchwork 1.1.2 (CRAN)
  • performance 0.10.3 (CRAN)
  • psych 2.3.3 (CRAN)
  • psychTools 2.3.3 (CRAN)
  • recipes 1.0.5 (CRAN)
  • semTools 0.5-6.917 (Dev)
  • tidySEM 0.2.3 (CRAN)
  • tidyverse 2.0.0 (CRAN)

Other Useful Resources

Other Courses

In addition to lavaan’s toutorials, you might find the following online courses useful:

Selected Quantitude (podcast) Episods

These are selected episodes from the Quantitude podcast related to SEM: