# Learning Statistical Models Through Simulation in R

*2020-11-05*

# Overview

This textbook approaches statistical analysis through the General Linear Model, taking a simulation-based approach in the R software environment. The overarching goal is to teach students how to translate a description of the design of a study into a linear model to analyze data from that study. The focus is on the skills needed to analyze data from psychology experiments.

The following topics are covered:

- linear modeling workflow;
- variance-covariance matrices;
- multiple regression;
- interactions (continuous-by-categorical; categorical-by-categorical);
- linear mixed-effects regression;
- generalized linear mixed-effects regression.

The material in this course forms the basis for a one-semester course for third-year undergradautes taught by Dale Barr at the University of Glasgow School of Psychology. It is part of the PsyTeachR series of course materials developed by University of Glasgow Psychology staff.

Unlike other textbooks you may have encountered, this is an **interactive textbook**. Each chapter contains embedded exercises as well as web applications to help students better understand the content. The interactive content will only work if you access this material through a web browser. Printing out the material is not recommended. If you want to access the textbook without an internet connection or have a local version to keep in case this site changes or moves, you can download a version for offline use. Just extract the files from the ZIP archive, locate the file `index.html`

in the `docs`

directory, and open this file using a web browser.

## How to cite this book

Barr, Dale J. (2020). *Learning statistical models through simulation in R: An interactive textbook*. Version 0.9-3. Retrieved from https://psyteachr.github.io/book/ug3-stats.

## Information for educators

You are free to re-use and modify the material in this textbook for your own purposes, with the stipulation that you cite the original work. Please note additional terms of the Creative Commons CC-BY-SA 4.0 license governing re-use of this material.

The book was built using the R ** bookdown** package. The source files are available at github.