DAPR3 Lab Exercises
  • Linear mixed models
    • Identifying grouping structure
    • Modelling group-level variability using random effects
    • Building maximal models and interpreting LMM estimates
  • Measurement & Factor Analysis

On this page

  • Clothing
  • Monkey status
  • Laughs
  • Practice interpreting the LMM summary

Building maximal models and interpreting LMM estimates

In this lab, you’ll apply the tools you saw in the lectures this week to the same three datasets you got to know in Week 1. You’ll work out the maximal model structure for each one.

And in Question 10 (which is more substantial than the first nine), you’ll fit one of those maximal models and interpret its estimates.

NoteGet set up
  1. Create a new .Rmd file for this week’s exercises.
  2. Save it somewhere you can find it again.
  3. Give it a clear name (for example, dapr3_lab03.Rmd).
  4. In the first code chunk, load the packages you’ll need this week:
    • tidyverse
    • lme4
    • lmerTest
    • stats (for xtabs())

Clothing

Read in the dataset located at https://uoepsy.github.io/data/dapr3_mannequin.csv and name it clothing.

RQ: Are people more likely to purchase clothing when they see it displayed on a model, and is this association dependent on item price?

variable description
purch_rating Purchase rating (sliding scale 0 to 100, with higher ratings indicating greater perceived likelihood of purchase)
price Price presented for item (range £5 to £100)
ppt Participant identifier
condition Whether items are seen on a model or on a white background
NoteMore detail about this dataset

Thirty participants were presented with a set of pictures of items of clothing, and rated each item how likely they were to buy it. Each participant saw 20 items, ranging in price from £5 to £100. 15 participants saw these items worn by a model, while the other 15 saw the items hanging against a white background.

From the Week 1 lab, here’s the key information about clothing:

  • Outcome: purch_rating
  • Predictors: price, condition (and their interaction)
  • Randomly-varying grouping variable: ppt
Question 1

Write the R formula for the fixed effects part of this model (that is, the y ~ x + z part).

🗂️ See Fixed effects flash card.

Solution 1.

purch_rating ~ price * condition

(Note: We know this has to be an interaction model because the RQ is asking about how an association between predictor and outcome depends on the value of another predictor.)

Question 2

In the Week 1 lab, you identified the randomly-varying grouping variable(s) in this dataset. For each randomly-varying grouping variable, we know that a maximal model requires a random intercept—an adjustment to the fixed intercept for each level of the grouping variable. Additionally, for each of those variables, a maximal model may contain a random slope over each predictor—an adjustment to the fixed slope for each level of the grouping variable.

Identify the random slopes that this model can contain. You can figure this out by asking: for a given randomly-varying grouping variable, do at least some of its levels appear with more than one distinct value of a given predictor? If yes, then it’s possible to include a random slope over the given predictor by the given grouping variable.

Specifically, for clothing:

  • Do at least some levels of ppt appear with more than one distinct value of price? Can we include a random slope over price by ppt?
  • Do at least some levels of ppt appear with more than one distinct value of condition? Can we include a random slope over condition by ppt?

🗂️ See Identify possible random effects flash card.

Solution 2.

clothing <- read_csv("https://uoepsy.github.io/data/dapr3_mannequin.csv")

Do at least some levels of ppt appear with more than one distinct value of price? Yes, every ppt sees every price once. In other words, price varies within ppt.

xtabs(~ ppt + price, data = clothing)
        price
ppt      5 10 15 20 25 30 35 40 45 50 55 60 65 70 75 80 85 90 95 100
  ppt_1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1   1
  ppt_10 1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1   1
  ppt_11 1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1   1
  ppt_12 1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1   1
  ppt_13 1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1   1
  ppt_14 1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1   1
  ppt_15 1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1   1
  ppt_16 1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1   1
  ppt_17 1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1   1
  ppt_18 1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1   1
  ppt_19 1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1   1
  ppt_2  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1   1
  ppt_20 1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1   1
  ppt_21 1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1   1
  ppt_22 1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1   1
  ppt_23 1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1   1
  ppt_24 1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1   1
  ppt_25 1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1   1
  ppt_26 1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1   1
  ppt_27 1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1   1
  ppt_28 1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1   1
  ppt_29 1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1   1
  ppt_3  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1   1
  ppt_30 1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1   1
  ppt_4  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1   1
  ppt_5  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1   1
  ppt_6  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1   1
  ppt_7  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1   1
  ppt_8  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1   1
  ppt_9  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1   1

Each value of ppt appears with more than one value of price (that is, each participant sees more than one price), so we can include a random slope over price by ppt.


Do at least some levels of ppt appear with more than one distinct value of condition? No, every ppt sees only one condition or the other, not both. In other words, condition varies between ppts.

xtabs(~ ppt + condition, data = clothing)
        condition
ppt      item_only model
  ppt_1         20     0
  ppt_10        20     0
  ppt_11        20     0
  ppt_12        20     0
  ppt_13        20     0
  ppt_14        20     0
  ppt_15        20     0
  ppt_16         0    20
  ppt_17         0    20
  ppt_18         0    20
  ppt_19         0    20
  ppt_2         20     0
  ppt_20         0    20
  ppt_21         0    20
  ppt_22         0    20
  ppt_23         0    20
  ppt_24         0    20
  ppt_25         0    20
  ppt_26         0    20
  ppt_27         0    20
  ppt_28         0    20
  ppt_29         0    20
  ppt_3         20     0
  ppt_30         0    20
  ppt_4         20     0
  ppt_5         20     0
  ppt_6         20     0
  ppt_7         20     0
  ppt_8         20     0
  ppt_9         20     0

Each value of ppt appears with only one value of condition (that is, each participant sees only one condition, not both), so we cannot include a random slope over condition by ppt.

Question 3

Write out the complete R formula for this maximal model (expanding on the fixed-effects-only model you wrote above by adding on the appropriate random effects).

🗂️ See Add random effects to a model formula flash card.

Solution 3.

purch_rating ~ price * condition + (1 + price | ppt)

Monkey status

Read in the dataset located at https://uoepsy.github.io/data/msmr_monkeystatus.csv and name it monkey.

RQ: How is the social status of monkeys associated with their ability to solve problems, while controlling for the difficulty of the problem?

variable description
status Social status of monkey (adolescent, subordinate adult, or dominant adult)
difficulty Problem difficulty ('easy' vs 'difficult')
monkeyID Monkey name
solved Whether or not the problem was successfully solved by the monkey
NoteMore detail about this dataset

Researchers have given a sample of Rhesus Macaques various problems to solve in order to receive treats. Troops of Macaques have a complex social structure, but adult monkeys tend can be loosely categorised as having either a “dominant” or “subordinate” status. The monkeys in our sample are either adolescent monkeys, subordinate adults, or dominant adults. Each monkey attempted various problems before they got bored/distracted/full of treats. Each problems were classed as either “easy” or “difficult”, and the researchers recorded whether or not the monkey solved each problem.

From the Week 1 lab, here’s the key information about monkeystatus:

  • Outcome: solved
  • Predictors: status, difficulty
  • Randomly-varying grouping variable: monkeyID
Question 4

Write the R formula for the fixed effects part of this model.

🗂️ See Fixed effects flash card.

Solution 4.

solved ~ status + difficulty

(Note: We know this is not an interaction model because the RQ is asking for us to control for a specific variable, not to estimate how one effect depends on a different variable. To control for a specific covariate, we just need to add it on.)

Question 5

We already know what random intercepts the model must have (one per randomly-varying grouping variable).

Identify the possible random slopes.

🗂️ See Identify possible random effects flash card.

Solution 5.

monkey <- read_csv('https://uoepsy.github.io/data/msmr_monkeystatus.csv')

Do at least some levels of monkeyID appear with more than one distinct value of status? No, every monkeyID has only one status.

xtabs(~ monkeyID + status, data = monkey)
           status
monkeyID    adolescent dominant subordinate
  Aliyya             0        7           0
  Ashley             6        0           0
  Billy              0        7           0
  Brianna            0        5           0
  Catherine          9        0           0
  Celestina          5        0           0
  Cheyenne           6        0           0
  Cinoi              0        0          10
  Courtney           0        7           0
  Daniel             0        0           8
  David              0        0          11
  Delray             6        0           0
  Devonte            0        5           0
  Efren              0        7           0
  Eric               0        8           0
  Erik               6        0           0
  Fuaad              0        0           6
  Gienry             0       11           0
  Iffat              0        8           0
  Jaarallah          0       11           0
  Jashjaun           0        6           0
  Jason              0       10           0
  Jayson            10        0           0
  Jennifer          10        0           0
  Jessica            0        0           8
  Jonathan           7        0           0
  Kaamil            11        0           0
  Maya               0        7           0
  Micah              0        0          10
  Nadheera           0        0           7
  Najiyya            0       11           0
  Nathan             0        5           0
  Nichol             0        0          10
  Peter              7        0           0
  Rachel             0       11           0
  Rebecca            9        0           0
  Richard            0        0           3
  Riley              0        0           8
  Robert             7        0           0
  Saydie             0        8           0
  Sean               0        9           0
  Seunghoo           0        0           9
  Shajee'a           0       10           0
  Shannon           10        0           0
  Sierra             0        6           0
  Sydney             0        8           0
  Taylor             0        6           0
  Van               10        0           0
  Vance              0        8           0
  Young Joo          7        0           0

Because each monkey only has one status, no random slope over status is possible.


Do at least some levels of monkeyID appear with more than one distinct value of difficulty? Yes, nearly every monkeyID sees both levels of difficulty.

xtabs(~ monkeyID + difficulty, data = monkey)
           difficulty
monkeyID    difficult easy
  Aliyya            3    4
  Ashley            3    3
  Billy             3    4
  Brianna           3    2
  Catherine         4    5
  Celestina         3    2
  Cheyenne          2    4
  Cinoi             4    6
  Courtney          2    5
  Daniel            5    3
  David             5    6
  Delray            5    1
  Devonte           2    3
  Efren             4    3
  Eric              3    5
  Erik              2    4
  Fuaad             5    1
  Gienry            5    6
  Iffat             1    7
  Jaarallah         5    6
  Jashjaun          2    4
  Jason             6    4
  Jayson            5    5
  Jennifer          7    3
  Jessica           4    4
  Jonathan          2    5
  Kaamil            7    4
  Maya              2    5
  Micah             5    5
  Nadheera          0    7
  Najiyya           5    6
  Nathan            3    2
  Nichol            4    6
  Peter             1    6
  Rachel            5    6
  Rebecca           4    5
  Richard           3    0
  Riley             3    5
  Robert            4    3
  Saydie            4    4
  Sean              3    6
  Seunghoo          3    6
  Shajee'a          7    3
  Shannon           6    4
  Sierra            5    1
  Sydney            4    4
  Taylor            3    3
  Van               3    7
  Vance             7    1
  Young Joo         3    4

Because at least some monkeys have seen both levels of difficulty, we can include a random slope by monkey over difficulty.

(It’s fine that Nadheera and Richard only see one difficulty level each—we have enough data from the other monkeys to still be able to estimate the random slopes.)

Question 6

Write out the complete R formula for this maximal model.

🗂️ See Add random effects to a model formula flash card.

Solution 6.

solved ~ status + difficulty + (1 + difficulty | monkeyID)

Laughs

Read in the dataset located at https://uoepsy.github.io/data/lmm_laughs.csv and name it laughs.

RQ: How is the delivery format of jokes (audio-only vs. audio AND video) associated with differences in humour ratings?

variable description
ppt Participant identification number
joke_label Joke presented
joke_id Joke identification number
delivery Experimental manipulation: whether joke was presented in audio-only ('audio') or in audiovideo ('video')
rating Humour rating chosen on a slider from 0 to 100
NoteMore detail about this dataset

These data are simulated to imitate an experiment that investigates the effect of visual non-verbal communication (i.e., gestures, facial expressions) on joke appreciation. Ninety participants took part in the experiment, in which they each rated how funny they found a set of 30 jokes. For each participant, the order of these 30 jokes was randomised for each run of the experiment. For each participant, the set of jokes was randomly split into two halves, with the first half being presented in audio-only, and the second half being presented in audio and video. This meant that each participant saw 15 jokes with video and 15 without, and each joke would be presented with video roughly half of the time.

From the Week 1 lab, here’s the key information about laughs:

  • Outcome: rating
  • Predictors: delivery
  • Randomly-varying grouping variables: ppt and joke_label/joke_id (two forms of the same information; for simplicity we can just use joke_id)
Question 7

Write the R formula for the fixed effects part of this model.

🗂️ See Fixed effects flash card.

Solution 7.

rating ~ delivery

Question 8

We already know what random intercepts the model must have (one per randomly-varying grouping variable).

Identify the possible random slopes.

🗂️ See Identify possible random effects flash card.

Solution 8.

laughs <- read_csv('https://uoepsy.github.io/data/lmm_laughs.csv')

Do at least some levels of ppt appear with more than one distinct value of delivery? Yes, every ppt sees both kinds of delivery.

xtabs(~ ppt + delivery, data = laughs)
         delivery
ppt       audio video
  PPTID1     15    15
  PPTID10    15    15
  PPTID11    15    15
  PPTID12    15    15
  PPTID13    15    15
  PPTID14    15    15
  PPTID15    15    15
  PPTID16    15    15
  PPTID17    15    15
  PPTID18    15    15
  PPTID19    15    15
  PPTID2     15    15
  PPTID20    15    15
  PPTID21    15    15
  PPTID22    15    15
  PPTID23    15    15
  PPTID24    15    15
  PPTID25    15    15
  PPTID26    15    15
  PPTID27    15    15
  PPTID28    15    15
  PPTID29    15    15
  PPTID3     15    15
  PPTID30    15    15
  PPTID31    15    15
  PPTID32    15    15
  PPTID33    15    15
  PPTID34    15    15
  PPTID35    15    15
  PPTID36    15    15
  PPTID37    15    15
  PPTID38    15    15
  PPTID39    15    15
  PPTID4     15    15
  PPTID40    15    15
  PPTID41    15    15
  PPTID42    15    15
  PPTID43    15    15
  PPTID44    15    15
  PPTID45    15    15
  PPTID46    15    15
  PPTID47    15    15
  PPTID48    15    15
  PPTID49    15    15
  PPTID5     15    15
  PPTID50    15    15
  PPTID51    15    15
  PPTID52    15    15
  PPTID53    15    15
  PPTID54    15    15
  PPTID55    15    15
  PPTID56    15    15
  PPTID57    15    15
  PPTID58    15    15
  PPTID59    15    15
  PPTID6     15    15
  PPTID60    15    15
  PPTID61    15    15
  PPTID62    15    15
  PPTID63    15    15
  PPTID64    15    15
  PPTID65    15    15
  PPTID66    15    15
  PPTID67    15    15
  PPTID68    15    15
  PPTID69    15    15
  PPTID7     15    15
  PPTID70    15    15
  PPTID71    15    15
  PPTID72    15    15
  PPTID73    15    15
  PPTID74    15    15
  PPTID75    15    15
  PPTID76    15    15
  PPTID77    15    15
  PPTID78    15    15
  PPTID79    15    15
  PPTID8     15    15
  PPTID80    15    15
  PPTID81    15    15
  PPTID82    15    15
  PPTID83    15    15
  PPTID84    15    15
  PPTID85    15    15
  PPTID86    15    15
  PPTID87    15    15
  PPTID88    15    15
  PPTID89    15    15
  PPTID9     15    15
  PPTID90    15    15

Because each participant has seen each kind of delivery, we can include random slopes over delivery by ppt.


Do at least some levels of joke_id appear with more than one distinct value of delivery? Yes, every joke_id is told with both kinds of delivery.

xtabs(~ joke_id + delivery, data = laughs)
       delivery
joke_id audio video
     1     40    50
     2     43    47
     3     48    42
     4     46    44
     5     43    47
     6     35    55
     7     39    51
     8     52    38
     9     45    45
     10    48    42
     11    46    44
     12    47    43
     13    36    54
     14    47    43
     15    49    41
     16    52    38
     17    50    40
     18    39    51
     19    46    44
     20    42    48
     21    54    36
     22    45    45
     23    47    43
     24    44    46
     25    39    51
     26    46    44
     27    39    51
     28    56    34
     29    40    50
     30    47    43

Because each joke was told in each kind of delivery, we can include random slopes over delivery by joke_id.

Question 9

Write out the complete R formula for this maximal model.

🗂️ See Add random effects to a model formula flash card.

Solution 9.

rating ~ delivery + (1 + delivery | ppt) + (1 + delivery | joke_id)

Practice interpreting the LMM summary

Question 10

Fit the LMM that you have developed for the laughs dataset, using the maximal model formula you wrote for Q9. (You can just use R’s default treatment coding for delivery, so that audio is the reference level and video is the non-reference level.)

Use the model summary to respond to the following questions.

Fixed effects:

  1. What does the model’s intercept mean?
  2. What does the coefficient deliveryvideo mean?

By-participant random effects:

  1. Within what range will approximately 95% of participant-level intercepts fall?
  2. Within what range will approximately 95% of participant-level slopes over delivery fall?
  3. Could some participants show an effect of delivery that goes in the opposite direction than the fixed effect?

By-joke random effects:

  1. Within what range will approximately 95% of joke-level intercepts fall?
  2. Within what range will approximately 95% of joke-level slopes over delivery fall?
  3. Could some jokes elicit an effect of delivery that goes in the opposite direction than the fixed effect?

🗂️ See Interpret LMM summary flash card.

Solution 10.

joke_mod <- lmer(
  rating ~ delivery + 
    (1 + delivery | joke_id) +
    (1 + delivery | ppt), 
  data = laughs
)

summary(joke_mod)
Linear mixed model fit by REML. t-tests use Satterthwaite's method [
lmerModLmerTest]
Formula: rating ~ delivery + (1 + delivery | joke_id) + (1 + delivery |  
    ppt)
   Data: laughs

REML criterion at convergence: 17575

Scaled residuals: 
   Min     1Q Median     3Q    Max 
-3.484 -0.663  0.016  0.651  3.353 

Random effects:
 Groups   Name          Variance Std.Dev. Corr
 ppt      (Intercept)   12.32    3.51         
          deliveryvideo  3.18    1.78     0.00
 joke_id  (Intercept)    4.61    2.15         
          deliveryvideo  5.03    2.24     0.39
 Residual               34.03    5.83         
Number of obs: 2700, groups:  ppt, 90; joke_id, 30

Fixed effects:
              Estimate Std. Error     df t value Pr(>|t|)    
(Intercept)     39.020      0.562 71.179    69.4   <2e-16 ***
deliveryvideo    1.410      0.504 36.487     2.8   0.0082 ** 
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Correlation of Fixed Effects:
            (Intr)
deliveryvid 0.131 

Solution 11.

  1. What does the model’s intercept mean?
  • The average estimated humour rating when jokes were presented in audio-only format (the reference level of delivery, coded as 0) is 39.02 points.
  1. What does the coefficient deliveryvideo mean?
  • On average, presenting a joke in audio-video format increases its humour rating by an estimated 1.41 points compared to audio-only presentation.
  • This change is significantly different from zero (\(p\) = 0.008).

Solution 12.

  1. Within what range will approximately 95% of participant-level intercepts fall?
  • The fixed intercept is 39.02 points, and the SD of participant-level intercept adjustments is 3.51 points.
  • To get the approximate bounds of the central 95% of participant-level intercepts, use the following formulas.
  • Lower bound:

\[ \begin{align} & ~\text{fixed estimate} - (2 \times \text{group-level SD}) \\ =&~ 39.02 - (2 \times 3.51) \\ =&~ 32.00 \\ \end{align} \]

  • Upper bound:

\[ \begin{align} & ~\text{fixed estimate} - (2 \times \text{group-level SD}) \\ =&~ 39.02 + (2 \times 3.51) \\ =&~ 46.04 \\ \end{align} \]

  • Approximately 95% of participant-level intercepts will fall between 32 and 46.04 points.
TipCalculate central 95% of participant-level intercepts with R
fixed_int <- fixef(joke_mod)[['(Intercept)']]
by_ppt_int_sd <- attributes( VarCorr(joke_mod)$ppt )$stddev[['(Intercept)']]

c(
  lower = (fixed_int - 2*by_ppt_int_sd) |> round(2),
  upper = (fixed_int + 2*by_ppt_int_sd) |> round(2)
)
lower upper 
   32    46 
  1. Within what range will approximately 95% of participant-level slopes over delivery fall?
  • The fixed slope over delivery is 1.41 points, and the SD of participant-level adjustments to the slope over delivery is 1.78 points.
  • Lower bound:

\[ \begin{align} & ~\text{fixed estimate} - (2 \times \text{group-level SD}) \\ =&~ 1.41 - (2 \times 1.78) \\ =&~ -2.15 \\ \end{align} \]

  • Upper bound:

\[ \begin{align} & ~\text{fixed estimate} + (2 \times \text{group-level SD}) \\ =&~ 1.41 + (2 \times 1.78) \\ =&~ 4.97 \\ \end{align} \]

  • Approximately 95% of participant-level slopes over delivery will fall between –2.15 and 4.97 points.
TipCalculate central 95% of participant-level intercepts with R
fixed_slp <- fixef(joke_mod)[['deliveryvideo']]
by_ppt_slp_sd <- attributes( VarCorr(joke_mod)$ppt )$stddev[['deliveryvideo']]

c(
  lower = (fixed_slp - 2*by_ppt_slp_sd) |> round(2),  
  upper = (fixed_slp + 2*by_ppt_slp_sd) |> round(2)
)
lower upper 
-2.16  4.98 

The R code yields slightly different values because it takes into account a lot of decimal places, while we only used two, so the difference is due to rounding error. This is not a big deal (the values are approximations anyway), so either version is acceptable.

  1. Could some participants show an effect of delivery that goes in the opposite direction than the fixed effect?
  • The fixed effect is positive, but some participants are estimated to show a negative slope.
  • We know this because the lower bound of the range where 95% of participant-level slopes fall is negative (the opposite direction from the fixed effect).
  • So: yes! It’s estimated that some people find audio-only presentation to be funnier than audio-video presentation.

Solution 13.

  1. Within what range will approximately 95% of joke-level intercepts fall?
  • The fixed intercept is 39.02 points, and the SD of joke-level intercept adjustments is 2.15 points.
  • Lower bound:

\[ \begin{align} & ~\text{fixed estimate} - (2 \times \text{group-level SD}) \\ =&~ 39.02 - (2 \times 2.15) \\ =&~ 34.72 \\ \end{align} \]

  • Upper bound:

\[ \begin{align} & ~\text{fixed estimate} - (2 \times \text{group-level SD}) \\ =&~ 39.02 + (2 \times 2.15) \\ =&~ 43.32 \\ \end{align} \]

  • Approximately 95% of joke-level intercepts will fall between 34.72 and 43.32 points.
TipCalculate central 95% of participant-level intercepts with R
fixed_int <- fixef(joke_mod)[['(Intercept)']]
by_joke_int_sd <- attributes( VarCorr(joke_mod)$joke_id )$stddev[['(Intercept)']]

c(
  lower = (fixed_int - 2*by_joke_int_sd) |> round(2),
  upper = (fixed_int + 2*by_joke_int_sd) |> round(2)
)
lower upper 
 34.7  43.3 
  1. Within what range will approximately 95% of joke-level slopes over delivery fall?
  • The fixed slope over delivery is 1.41 points, and the SD of joke-level adjustments to the slope over delivery is 2.24 points.
  • Lower bound:

\[ \begin{align} & ~\text{fixed estimate} - (2 \times \text{group-level SD}) \\ =&~ 1.41 - (2 \times 2.24) \\ =&~ -3.07 \\ \end{align} \]

  • Upper bound:

\[ \begin{align} & ~\text{fixed estimate} + (2 \times \text{group-level SD}) \\ =&~ 1.41 + (2 \times 2.24) \\ =&~ 5.89 \\ \end{align} \]

  • Approximately 95% of joke-level slopes over delivery will fall between –3.07 and 5.89 points.
  • This range is wider for jokes than for participants, so the effect of delivery varies more from joke to joke than from person to person.
TipCalculate central 95% of participant-level intercepts with R
fixed_slp <- fixef(joke_mod)[['deliveryvideo']]
by_joke_slp_sd <- attributes( VarCorr(joke_mod)$joke_id )$stddev[['deliveryvideo']]

c(
  lower = (fixed_slp - 2*by_joke_slp_sd) |> round(2),  
  upper = (fixed_slp + 2*by_joke_slp_sd) |> round(2)
)
lower upper 
-3.07  5.89 
  1. Could some jokes elicit an effect of delivery that goes in the opposite direction than the fixed effect?
  • The fixed effect is positive, but some jokes are estimated to show a negative slope.
  • We know this because the lower bound of the range where 95% of joke-level slopes fall is negative (the opposite direction from the fixed effect).
  • So: yes! It’s estimated that some jokes are rated as funnier in audio-only format than they are in audio-video format.