| 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 |
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.
- Create a new .Rmd file for this week’s exercises.
- Save it somewhere you can find it again.
- Give it a clear name (for example,
dapr3_lab03.Rmd). - In the first code chunk, load the packages you’ll need this week:
tidyverselme4lmerTeststats(forxtabs())
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?
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
Write the R formula for the fixed effects part of this model (that is, the y ~ x + z part).
🗂️ See Fixed effects flash card.
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
pptappear with more than one distinct value ofprice? Can we include a random slope overpricebyppt? - Do at least some levels of
pptappear with more than one distinct value ofcondition? Can we include a random slope overconditionbyppt?
🗂️ See Identify possible random effects flash card.
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.
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 |
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
Write the R formula for the fixed effects part of this model.
🗂️ See Fixed effects flash card.
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.
Write out the complete R formula for this maximal model.
🗂️ See Add random effects to a model formula flash card.
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 |
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:
pptandjoke_label/joke_id(two forms of the same information; for simplicity we can just usejoke_id)
Write the R formula for the fixed effects part of this model.
🗂️ See Fixed effects flash card.
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.
Write out the complete R formula for this maximal model.
🗂️ See Add random effects to a model formula flash card.
Practice interpreting the LMM summary
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:
- What does the model’s intercept mean?
- What does the coefficient
deliveryvideomean?
By-participant random effects:
- Within what range will approximately 95% of participant-level intercepts fall?
- Within what range will approximately 95% of participant-level slopes over
deliveryfall? - Could some participants show an effect of
deliverythat goes in the opposite direction than the fixed effect?
By-joke random effects:
- Within what range will approximately 95% of joke-level intercepts fall?
- Within what range will approximately 95% of joke-level slopes over
deliveryfall? - Could some jokes elicit an effect of
deliverythat goes in the opposite direction than the fixed effect?
🗂️ See Interpret LMM summary flash card.