Skip to content

mattansb/Analysis-of-Factorial-Designs-foR-Psychologists

Repository files navigation

Analysis of Factorial Designs foR Psychologists

Last updated 2026-04-04.

This Github repo contains all lesson files for Analysis of Factorial Designs foR Psychologists. The goal is to impart students with the basic tools to fit and evaluate statistical models for factorial designs (w/ plots) using afex, and and conduct follow-up analyses (simple effects, planned contrasts, post-hoc test; w/ plots) using emmeans (or marginaleffects). Although the focus is on ANOVAs, the materials regarding follow-up analyses (~80% of the course) are applicable to linear mixed models, and really any regression model with factorial predictors.

These topics were taught in the graduate-level course Analyses of Variance (Psych Dep., Ben-Gurion University of the Negev, Spring, 2019). 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.5 or above).
  2. RStudio IDE (optional, but recommended).
  3. The following packages, listed by lesson:
Lesson Packages
01 ANOVA made easy afex, effectsize, tidyr, datawizard
02 main and simple effects analysis afex, emmeans, marginaleffects
03 interaction analysis afex, emmeans, marginaleffects, ggplot2
04 effect sizes afex, emmeans, marginaleffects, effectsize, dplyr
05 multiple comparisons dplyr, afex, emmeans, marginaleffects
06 accepting the null afex, lmerTest, effectsize, bayestestR, afex, emmeans, marginaleffects, dplyr
07 assumption check and non-parametric tests afex, ggeffects, performance, permuco
08 ANOVA vs (G)LMMs patchwork, afex, emmeans, lmerTest

Installing R Packages

You can install all the R packages used by running:

# in alphabetical order:

pak::pak(
  c(

    "cran::afex", # 1.5-1
    "cran::easystats", # 0.7.5
    "cran::emmeans", # 2.0.2
    "cran::ggeffects", # 2.3.2
    "cran::lmerTest", # 3.2-1
    "github::vincentarelbundock/marginaleffects", # 0.32.0.5
    "cran::patchwork", # 1.3.2
    "cran::permuco", # 1.1.3
    "cran::tidyverse" # 2.0.0

  )
)

About

Lesson files used in the Analysis of Factorial Designs for Psychologists.

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages