W9: LMM Part 2 Flashcards
What are 2 random effects you can include in a LMM?
Random intercept
Random slope
What distribution does 1 random effect assume to follow and what are the parameters of that distribution?
Normal distribution
1. Mean (across all participants, equivalent to fixed effect)
2. Standard deviation (how much the effect varies by person / variance)
What is variance?
How much 1 variable varies within the sample/population
What is covariance?
How much 2 or more variables vary together in the same direction
Only shows DIRECTION (pos / neg), not strength so it’s unstandardized correlation
What is correlation?
Change in 1 variable = change in another variable
Same (shows) direction AND strength (how close data is to line of best fit)
What distribution do we assume more than 1 random effects follow?
Multivariate normal distribution (MVD)
- All distributed normally together
Each random effect follows a univariate normal distribution
Does univariate normal distribution imply MVN?
No
Does MVN imply univariate distribution?
Yes
If we assume random effects are uncorrelated, what do we set the covariance / correlation of them to?
0, i.e follow MVN distribution (each effect have their own distribution)
In an intercept only model, people with more observations/data, will they have BLUPs closer/further to the observed mean of their own data?
Closer
Can we get BLUPs for random slopes and intercepts?
Yes
What does Mahalanobis distance (MD) evaluate?
If LMMs with multiple random effects follow MVN distribution and identify multivariate outliers
What does the Mahalanobis Distance (MD) measure?
Distance between a point and a space defined by (vector of means, covariance matrix (variance))
What distribution do the calaculated MDs for each row of data follow?
Chi-squared distribution
What do the degrees of freedom from chi-square distribution of MD equal to?
Number of dimensions (p)
df = p if raw data follow MVN
How can we tell if data are MVN from calculating Mahalanobis distance?
It MD follows / matches a chi-squared distribution
What fixed and random components are in this model:
lmer(dStress ~ dEnergy + (1 + dEnergy | ID)
Are random effects correlated?
- dEnergy as fixed effect
- dEnergy as random slope/effect
- Random intercept
*Random slope + random intercept are correlated because they are in the same parenthesis
What fixed and random components are in this model:
lmer(dStress ~ dEnergy + (1| ID) + (0 + dEnergy | ID) )
- dEnergy as fixed effect
- Random intercept
- dEnergy as random slope / effect
- Random intercept and random slope are NOT correlated (separate parantheses)
For this model:
lmer(dStress ~ dEnergy + (dEnergy | ID) )
How do you interpret the correlation of -0.80 of the random slope of dEnergy in the output?
People who have higher level of stress when energy is 0 tend to have more negative slope of association between stress and energy
For the positive correlation between intercept and slope:
People with higher intercept tend to incline faster / slower ?
Faster (more positive the intercept, more positive the slope)
For the negative correlation between intercept and slope:
People with higher intercept tend to decline faster / slower?
Faster (more positive intercept = faster decline)
Prone to floor effects (e.g a more severe D symptoms = faster improvements than less severe D symptoms)
From plot(modelDiagnositics()) output, what does the graph titled “ID : MV Normal” evaluate?
Whether random effects (slope and intercept) by ID follow MVN using Mahalanobis distance.
Compared against chi-squared distribution (dotted black line)
What function do you use to identify observable EVs from modelDiagnostics plots?
md.plot$extremeValues
What are 3 ways to remove EVs?
- Remove 1 at a time
dm[-unique(m1.diag$extremeValues$Index)] - Remove extreme residuals (i.e selected IDs)
dm[ID %nin% c(23, 109, 143)] - Remove selected effect type
dm[-unique(m1.diag$extremeValues
[EffectType == “Multivariate Random Effect ID”]$Index)
What fixed and random components are in this model:
lmer(dStress ~ Benergy + Wenergy +
(Wenergy | ID)
- Fixed effect of Benergy
- Fixed effect of Wenergy
- Random intercept (provided by default in R)
- Random slope / effect of Wenergy
What variables should you calculate ICC for in this model:
lmer(dStress ~ Benergy + Wenergy +
(Wenergy | ID)
- dStress
iccMixed(“dStress”,id=”ID”,data=dm) - dEnergy
iccMixed(“dEnergy”, id =”ID”, data=dm)
For this model:
lmer(dStress ~ Benergy + Wenergy +
(Wenergy | ID)
What does the Std. Dev. of random Wenergy from output show?
- Individual differences in Wenergy scores.
- If random slopes (Wenergy) assumed to follow normal distribution, expected to fall between estimate of fixed Wenergy +/- Std. Dev. of random Wenergy
How do you interpret a significant fixed effect of Wenergy on stress?
On days where people had 1 unit higher energy than…
On days where people had 1 unit higher energy than their own average,
people were expected to have x higher/lower stress that SAME day on average.
What do convergence warnings mean
Computer was unable to identify optimal estimates for model
What do singularity warnings mean and often directed at?
- Almost always in random effects
- Means you either have very similar variables included / there’s not enough observations per person for stable estimation
What are 3 solutions to solve for singularity / convergence issues?
- Remove random effect (always keep random intercept so random slopes)
- Assume correlation between random slope and intercept = 0
- Use a different optimizer
lmerControl()
lmer (… control = strictControl)
What are marginal effects?
Based on averages (i.e fixed effect portion of model)
Can be made for new data (plug in b0 and b1)
What are conditional effects?
Both fixed and random effects of model
Predictions can only be made for existing data
How many regression lines do you expect from modelling marginal effects?
1 (fixed average for everyone)
When graphing conditional effects, what argument do you need to add to separate effect by unit (person)?
by = “ID”
breaks = c (10, 35, 69, 101) specifies which IDs you want to graph
When graphing conditional effects, what argument do you have to add to specify a predictor is a random effect?
re.form = ~ (Wenergy | ID)
The regression lines plotted from conditional effects graph are conditional predictions. This means what is included?
Shrinkage (of random intercept and slope to overall sample’s average intercept and slope)
When graphing conditional effects (multiple regression lines), the function overlay = TRUE allows for what?
Display of all IDs’ regression lines
When graphing conditional effects, and you want to only graph random intercepts only, what function do you use?
re.form = ~ (1 | ID)
Regression lines will all have same slopes but different intercepts
When graphing conditional effects and we leave out the re.form argument completely, what do we get as output?
The marginal intercept + slope (identical for all IDs)
I.e fixed effect portion of the model
Adding a random slope means there are how many random effects?
2 (slope + LMMs always have a random intercept)
In an intercept only model, will people with more data/observations will have BLUPs have closer or further to the observed mean of their own data?
Closer
Is std.error larger and p-value higher (less significant) for models with fixed and random effects or model with fixed effects only?
Models with fixed and random effects