Assignment 2

Parameter estimation in clustered data

true
05-28-2021
library(tidyverse)
library(brms)

theme_set(theme_grey(base_size = 14) +
            theme(panel.grid = element_blank()))

Exercise 1

Use the simulate_treament() function to generate data. Vary the parameter settings, and then attempt to recover the known parameters using brm().

Exercise 2

Use the simulate_treament() function to generate data. Give your data to a colleague and they will give you theirs in return. Try to recover the (unknown to you) parameters using brm().

Exercise 3

Load the dataset sleepstudy from the lme4 package. These are data from a sleep deprivation study, in which the average reaction time per day (in milliseconds) was recorded.

Have a look at the data, and then try to estimate the effect of day on reaction time.

It’s always a good idea to plot the data before you do anything else.

library(lme4)
glimpse(sleepstudy)
Rows: 180
Columns: 3
$ Reaction <dbl> 249.5600, 258.7047, 250.8006, 321.4398, 356.8519, 4…
$ Days     <dbl> 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, …
$ Subject  <fct> 308, 308, 308, 308, 308, 308, 308, 308, 308, 308, 3…

References

Corrections

If you see mistakes or want to suggest changes, please create an issue on the source repository.

Reuse

Text and figures are licensed under Creative Commons Attribution CC BY 4.0. Source code is available at https://github.com/awellis/learnmultilevelmodels, unless otherwise noted. The figures that have been reused from other sources don't fall under this license and can be recognized by a note in their caption: "Figure from ...".

Citation

For attribution, please cite this work as

Ellis (2021, May 28). Learn multilevel models: Assignment 2. Retrieved from https://awellis.github.io/learnmultilevelmodels/asssignment-2.html

BibTeX citation

@misc{ellis2021assignment,
  author = {Ellis, Andrew},
  title = {Learn multilevel models: Assignment 2},
  url = {https://awellis.github.io/learnmultilevelmodels/asssignment-2.html},
  year = {2021}
}