Skip to content

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

Repository files navigation

Analysis of Factorial Designs foR Psychologists


Last updated 2022-01-31.

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. Although the focus is on ANOVAs, the materials regarding follow-up analyses (~80% of the course) are applicable to linear mixed models, and even regression 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.1 or above).
  2. RStudio IDE (optional, but recommended).
  3. The following packages, listed by lesson:
Lesson Packages
01 ANOVA made easy afex, emmeans, effectsize, ggeffects, tidyr
02 ANCOVA afex
03 Main and simple effects analysis afex, emmeans, ggeffects
04 Interaction analysis afex, emmeans, ggeffects
05 Effect sizes and multiple comparisons afex, emmeans, effectsize
06 Assumption check and non-parametric tests afex, ggeffects, performance, parameters, permuco, emmeans, car
07 Accepting nulls afex, effectsize, lme4, bayestestR, emmeans, dplyr
08 ANOVA and (G)LMMs afex, patchwork, emmeans

(Bold denotes the first lesson in which the package was used.)

You can install all the packages used by running:

# in alphabetical order:

pkgs <- c(
  "afex", "bayestestR", "car", "dplyr", "effectsize", "emmeans",
  "ggeffects", "lme4", "parameters", "patchwork", "performance",
  "permuco", "tidyr"
)

install.packages(pkgs, repos = c("https://easystats.r-universe.dev", getOption("repos")))
Package Versions

Run on Windows 10 x64 (build 22000), with R version 4.1.1.

The packages used here:

  • afex 1.0-1 (CRAN)
  • bayestestR 0.11.5.1 (Local version)
  • car 3.0-12 (CRAN)
  • dplyr 1.0.7 (CRAN)
  • effectsize 0.4.5-4 (Local version)
  • emmeans 1.7.1-1 (CRAN)
  • ggeffects 1.1.1 (CRAN)
  • lme4 1.1-27.1 (CRAN)
  • parameters 0.16.0 (CRAN)
  • patchwork 1.1.1 (CRAN)
  • performance 0.8.0.1 (https://easystats.r-universe.dev)
  • permuco 1.1.1 (CRAN)
  • tidyr 1.1.4 (CRAN)