Mixed Effects Regression with R#
Course Description#
This course builds on your existing knowledge of regression to fit more complex models that can handle more complicated data sets. In this session you will learn about mixed effects regression model, when to use them, and how to interpret the results.
While it is delivered as a stand alone session, it is designed as a part of a series of Regression with R workshops where the content develops the ideas further to give you a comprehensive understanding how regression can be used to address a broad range of questions.
The complete series includes:
Introduction to Regression with R
Regression Analysis in R: Adapting to Varied Data Types
Mixed Effects Regression with R
Course Objectives#
Use regression answer to answer a wide range of research questions .
Fit a regression model with interactions between predictor variables.
Fit multi-level regression models
Extract and interpret the results from a range of regression models.
Design a regression model appropriate for addressing a specific research question.
Pre-requisite Knowledge#
This course will not include an introduction to R, or how to setup and use R or Rstudio. It is assumed you are comfortable coding in R and are familiar with:
How to write and execute commands in the R console.
What type of variables are available in R and how to work with these.
We also assume that you are comfortable with fitting in R and interpreting the output of:
Simple linear regression.
Multiple linear regression with categorical, binary or continuous predictor variables.
Logistic regression.
If not, we recommend that you consult our pre-requisite courses Introductory Regression Analysis with R and Regression Analysis in R: Adapting to Varied Data Types
Sign-up#
To check for upcoming course dates and to register, please visit the Workshop Schedule and Sign-up page available here.
Installation Guide#
All CfRR courses require attendees to use their own computer/laptop to follow workshop activities and take effective notes.
As this course extends upon Introduction to R, the installation instructions for the base R elements are the same, available here.
Alongside having R itself, three packages are needed for this workshop. The first two (devtools & learnr) are available from CRAN. The third is a package we have developed with the course materials and is available from GitHub (cfrrRTutorials).
This code will install these three packages.
install.packages("devtools")
install.packages("learnr")
library(devtools)
devtools::install_github("coding-for-reproducible-research/cfrrRtutorials")
If you encounter any difficulties with installation, please reach out.
Self Study Material Link#
The self-study material for this course is available as a tutorial through the cfrrRtutorials R package installed as part of the set up for this workshop. To launch the “Mixed Effects Regression with R” tutorial in Rstudio you can run:
learnr::run_tutorial("Mixed Effects Regression with R", "cfrrRtutorials")
When ready the tutorial may launch in a new window, or (more likely) there will be some output in red in the Jobs console that says something like:
Output created: Mixed-Effects-Regression-with-R.html
Listening on http://127.0.0.1:38555
+------------------------------------------------------------------------+
<U+2713> Open the tutorial in your browser: http://127.0.0.1:38555
! Stop or cancel this job to stop running the tutorial
+------------------------------------------------------------------------+
If the tutorial does not automatically launch in a new window, to launch it copy the web address in this case (http://127.0.0.1:38555) into a web browser of your choice, such as Chrome.
You can then start the workshop in this document. You can navigate through the sections using the menu on the side. Please note that the data required for the examples and exercises is preloaded within each interactive document, so the commands/exercises only work within it. They won’t work with the Rstudio console. When you come to apply what you have learned on your own datasets, you will need to ensure your data is loaded and edit the syntax to model the relevant variables.
Developers#
This workshop was developed by Eilis Hannon.
License Info#
Instructional Material
The instructional material in this course is copyright © 2024 University of Exeter and is made available under the Creative Commons Attribution 4.0 International licence. Instructional material consists of material that is contained within the “individual_modules/advanced_regression_analysis_with_R” folders in this repository, with the exception of code snippets and example programs found in files within these folders. Such code snippets and example programs are considered software for the purposes of this licence.
Software
Except where otherwise noted, software provided in this repository is made available under the MIT licence (https://opensource.org/licenses/MIT).
Copyright © 2024 University of Exeter
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
The software in this repository is adapted from software that is covered by the following copyright and permission notice:
Copyright © 2024 Software Carpentry
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.