Practical Applications in R for Psychologists
Last updated 2023-06-11.
This Github repo contains all lesson files for Practical Applications
in R for Psychologists. The goal is to impart students with the basic
tools to process data, describe data (w/ summary statistics and plots),
and the foundations of building, evaluating and comparing statistical
models in R
, focusing on linear regression modeling (using both
frequentist and Bayesian approaches).
These topics were taught in the graduate-level course Advanced Research Methods for Psychologists (Psych Dep., Ben-Gurion University of the Negev), laying the foundation for the following topic-focused courses:
- Hierarchical linear models (HLM)
- Machine Learning (ML)
- Structural equation modelling (SEM)
- Analysis of Factorial Designs (ANOVA)
Notes:
- This repo contains only materials relating to Practical Applications in R. Though statistics are naturally discussed in many lessons, the focus is generally on the application and not on the theory.
- Please note that some code does not work on purpose and without warning, to force students to learn to debug.
Setup
You will need:
- A fresh installation of
R
(preferably version 4.1.1 or above). - RStudio IDE (optional, but recommended).
- The following packages, listed by lesson:
(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", "BayesFactor", "bayesplot", "bayestestR", "correlation",
"datawizard", "dplyr", "effectsize", "emmeans", "finalfit", "ggeffects",
"ggplot2", "haven", "Hmisc", "insight", "marginaleffects", "mediation",
"mice", "modelbased", "parameters", "performance", "permuco",
"psych", "psychTools", "pwr", "qqplotr", "ragg", "readxl", "see",
"summarytools", "tidyr", "tidySEM", "tidyverse"
)
install.packages(pkgs, repos = c("https://easystats.r-universe.dev", getOption("repos")))
Package Versions
Run on Windows 10 x64 (build 22621), with R version 4.2.2.
The packages used here:
afex
1.3-0 (CRAN)BayesFactor
0.9.12-4.4 (CRAN)bayesplot
1.10.0 (CRAN)bayestestR
0.13.1 (CRAN)correlation
0.8.4 (CRAN)datawizard
0.7.1 (CRAN)dplyr
1.1.1 (CRAN)effectsize
0.8.3.11 (Local version)emmeans
1.8.6 (CRAN)finalfit
1.0.6 (CRAN)ggeffects
1.2.1.9 (Github: strengejacke/ggeffects)ggplot2
3.4.2 (CRAN)haven
2.5.2 (CRAN)Hmisc
5.0-1 (CRAN)insight
0.19.1 (CRAN)marginaleffects
0.11.2 (CRAN)mediation
4.5.0 (CRAN)mice
3.15.0 (CRAN)modelbased
0.8.6 (CRAN)parameters
0.21.0 (CRAN)performance
0.10.3 (CRAN)permuco
1.1.2 (CRAN)psych
2.3.3 (CRAN)psychTools
2.3.3 (CRAN)pwr
1.3-0 (CRAN)qqplotr
0.0.6 (CRAN)ragg
1.2.5 (CRAN)readxl
1.4.2 (CRAN)see
0.7.5 (CRAN)summarytools
1.0.1 (CRAN)tidyr
1.3.0 (CRAN)tidySEM
0.2.3 (CRAN)tidyverse
2.0.0 (CRAN)