RMDL – Week 5

Varying effects I

1 Introduction

Create a Quarto RStudio project for this course

Create an RStudio project for the course and within that add the usual folders data/ and code/ (do not include the forward slash / in the name! It is just there to mark that those are folders.)

When working through these tutorials, make sure you are in the course Quarto/RStudio Project you created.

You know you are in a Quarto Project because you can see the name of the Project in the top-right corner of RStudio, next to the light-blue cube icon.

If you see Project (none) in the top-right corner, that means you are not in a Quarto Project.

To make sure you are in the Quarto project, you can open the project by going to the project folder in File Explorer (Win) or Finder (macOS) and double click on the .Rproj file.

In this tutorial, you have to run Bayesian regression models with data from Winter 2012 (DOI 10.1016/j.wocn.2012.08.006).

You can get the data here (right-click and download). This page explains the meaning of the columns in the data: https://uoelel.github.io/qml-data/data/winter2012/polite.html.

2 Mean f0

Fit a regression model to answer the following question:

Do the months spent in Germany modulate the effect of attitude on mean f0?

The model should have the following variables:

  • f0mn as the outcome variable.
  • gender, months_ger and attitude as predictors. Use indexing (0 +).
  • Add multilevel effects as needed.

3 H1-H2 difference

If you have time, run another regression model to answer the following research question:

Does being a music student modulate the effect of attitude on the H1-H2 difference?

The H1-H2 difference is correlated with breathiness: the higher the difference, the more breathy the voice quality.

4 Reporting

You should mention the varying effects you included when reporting the model specification. For example, for the following model:

ota_bm_2 <- brm(
  Words.RT ~ 0 + Condition:Contrast +
    (0 + Condition:Contrast | Subject) +
    (0 + Condition:Contrast | Version),
  family = lognormal,
  data = ota2009,
  seed = my_seed,
  cores = 4,
  file = "data/cache/ota_bm_2"
)

As varying (aka random) effects, we included by-participant and by-list varying terms for the interaction between condition and contrast.