| 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 |
Troubleshooting, checking assumptions and diagnostics
In this lab, you’ll start with the maximal model you developed last week for the clothing dataset. The questions will guide you through troubleshooting the model, and once you have a version that fits, you’ll practice checking assumptions and diagnostics.
- 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_lab04.Rmd). - In the first code chunk, load the packages you’ll need this week:
tidyverselme4lmerTestHLMdiag
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 3 lab, here’s the maximal model for this data and RQ:
purch_rating ~ price * condition + (1 + price | ppt)
Fit the model
The following code aims to fit the maximal model. Copy and run this code.
clothing_m1 <- lmer(
purch_rating ~ price * condition + (1 + price | ppt),
data = clothing
)What warning messages do you get? What problems do these warning messages indicate?
🗂️ See Troubleshoot common issues flash card.
Change the model’s optimiser to bobyqa and re-fit the model (call it clothing_m2).
What warning messages do you see now?
🗂️ See Change optimiser flash card.
We’ll have to rescale the predictor. Changing that might solve the convergence issue too.
- Convert
priceinto a z-score and call the new variableprice_z. - Check that the mean of
price_zis 0 and that the standard deviation is 1. - In the code to fit
clothing_m1, replacepricewithprice_zand re-fit the model (call itclothing_m3). - Are there any warning messages or other indications of singularity?
🗂️ See DAPR2’s Data transformations > Standardisation flash card.
See also Troubleshoot common issues flash card.
Check assumptions
Let’s move on to checking clothing_m3’s assumptions.
Are you satisfied with the assumption that the association between predictor and outcome is sufficiently linear?
🗂️ See Check assumptions flash card.
Are you satisfied with the assumption that the errors are independent?
🗂️ See Check assumptions flash card.
Are you satisfied with the assumption that the errors are normally distributed?
🗂️ See Check assumptions flash card.
Are you satisfied with the assumption that the errors have equal variance?
🗂️ See Check assumptions flash card.
Are you satisfied with the assumption that each set of participant-level adjustments is normally distributed?
🗂️ See Check assumptions flash card.
Check influence diagnostics
Let’s move on to the influence diagnostics.
Compute and plot the approximate Cook’s Distance for each observation and for each participant.
🗂️ See Detect influential points and groups flash card.
One of those diagnostic checks from Q9 reveals a particularly high-influence unit.
Run a sensitivity analysis to check whether this unit impacts the pattern of results and changes the conclusions we would draw from this model.
🗂️ See Detect influential points and groups flash card.






