W10: LMMs - Moderation and Comparisons Flashcards

1
Q

The “j” subscript on intercept (b0) includes what kind of effects?
yij = b0j + b1 * x1j + eij

A
  • Fixed effect (mean intercept) and
  • Random effect (individual unit deviations)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What does the “i” and “j” subscript on the outcome (y) mean?
yij = b0j + b1 * x1j + eij

A

Outcome varies within and between people

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What does regression coefficient (b1) without any subscripts mean:
yij = b0j + b1 * x1j + eij

A

Fixed effect only

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What does the “j” subscript on the predictor (x) mean?
yij = b0j + b1 * x1j + eij

A

It’s a between person variable/predictor only

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What does the “i” and “j” subscript on the predictor (x) mean?
yij = b0j + b1 * x1j + b2 * x2ij + eij

A

It’s a between and within person variable/predictor

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

If the predictors (x) has “i” subscript, this means the outcome (y) must..

A

vary within units/people too

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What does the subscript “i” mean?

A

Smallest unit, ith observation for specific unit
E.g on a certain day

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What does the subscript “j” mean?

A

jth unit, usually means person

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What does the “i” and “j” subscript on the residuals (e) mean?
yij = b0j + b1 * x1j + b2 * x2ij + eij

A

They vary within and between units/persons

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

A between variable can have what kinds of effect(s)?

A

Fixed effect only

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

A within variable can have what kinds of effect(s)?

A
  • Fixed effect only
  • Fixed and random effects
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

The “j” subscript on the regression coefficient (b2) means what for the predictor?
yij = b0j + b1 * x1j + b2j * x2ij + eij

A

It controls predictor to be a random effect (but also as a fixed effect)
lmer(y ~ x + dstress + (dStress | ID) )

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Why does subscript “i” have to come with subscript “j” on PREDICTORS (x)?

A

Random effects have their own fixed effect/average

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What does the following show:
b2 * x2ij

A

Fixed effect slope for a within person variable
but the variable can have random slope if b2 is b2j

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What is the corresponding code for this using lmer():
energy ij = b0j + b1 * loneliness j + eij

A

lmer(energy ~ loneliness + (1 | ID) )

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Will “Bstress” have “i” and/or “j” subscript?
What subscripts can the regression coefficient (b) have for it?

A

Bstress has j subscript only (between person variable)
No subscripts for b, only fixed effects allowed

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

Will “Wstress” have “i” and/or “j” subscript?
What subscripts can the regression coefficient (b) have for it?

A

Wstress have i and j subscripts (within person variable)
b can have no subscript (fixed) or j subscript (fixed and random effect)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

What is a cross level interaction?

A

Interaction of a between and within person variable
E.g b3 * (xj * xij)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

How do you interpret the following:
energyij = b0j + b1 * lonelinessj + (b2 + b3 * lonelinessj) * stressij + eij

A
  • Simple effect of stress on energy varies by /depends on loneliness
  • Association between DAILY stress (within) and energy on SAME DAY depends on loneliness of participants that SAME DAY
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
20
Q

How do you interpret the following:
energyij = b0j + (b1+ b3 * stressij) * lonelinessj + b2 * stressij + eij

A
  • Simple effect of loneliness on energy varies by / depends on stress
  • Association between AVERAGE loneliness (fixed) and AVERAGE energy depends on SAME DAY stress
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
21
Q

What are between unit interactions?
What subscripts do those variables (x’s) have?

A

Interactions with between person variables only
x’s only have j subscript

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
22
Q

How do you interpret the following:
energyij = b0j + (b1+ b3 * sexj) * lonelinessj + b2 * sexj + eij

A
  • Simple effect of loneliness varies by / depends on sex
  • Association between AVERAGE loneliness and AVERAGE energy depends on participant’s sex
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
23
Q

What are within unit interactions?
What subscripts do those variables (x’s) have?

A
  • Interactions with within person variables only
  • x’s have both i and j subscripts
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
24
Q

How do you interpret the following:
energyij = b0j + (b1+ b3 * stressj) * SEij + b2 * stressij + eij

A
  • Simple effects of SE on energy varies by / depends on stress
  • Association of DAILY SE and SAME DAY energy depends on how stressed someone is on a given day
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
25
Q

What are continuous interactions?

A
  • Interactions with variables that have multiple/repeated observations
  • Can have random effects (slopes / intercepts)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
26
Q

What should you do if there is no significant interaction term in your model?

A

Remove the interaction term, re-run model, analyze main effects on their own

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
27
Q

When plotting a continuous interactions model, what does the moderator show as and what the variable being moderated show as?

A

Moderator is showed as breaks (different regression lines)
Variable being moderated is on the x axis

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
28
Q

When putting multiple model results side by side together using list(), what are the 3 things they’re helpful for comparing?
APAStyler(list(
Energy = modelTest(m), 1st model
Mood = modelTest(mtest1) 2nd model

A
  1. Compare models with and w/o covariates
  2. Compare if removing EVs change results substantially
  3. Compare models with different outcomes (y)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
29
Q

What do you put in the breaks() when plotting continuous interaction models?
What function do you use to get those values?

A

Mean +/- 1 SD of the moderator
Using egltable(), remove duplicates because repeated observations
egltable(c(“neuroticism”), data = dm[!duplicated(ID)])

30
Q

When you have a significant interaction, instead of interpreting it based on regression coefficient, what should you do?

A

Graph the simple slopes based on the moderator

31
Q

Why do we test simple slopes / effects from a SIGNIFICANT interaction model?

A

To see which level (low / high) of the moderator shows a significant association.

32
Q

What function is used to calculate significance of simple effects/slopes of continuous interactions?

A

emtrends()
mem <- emtrends(m, var = “dStress”,
at = list(neuroticism = c(3.46-1.11,
3.46+1.11)),
lmer.df = “satterthwaite”)
summary(mem, infer=TRUE) to show p-values

33
Q

For continuous x categorical interactions, which variable is used to calculate simple slopes / used as moderators?

A

Categorical variable e.g sex

34
Q

Factor variables (e.g sex) do NOT work well with modelTest().
What is the solution to this?

A

Manually dummy code to categorical variable
dm[, female := as.integer(sex == “female”)]

35
Q

When plotting simple slopes for continuous X categorical moderators, what are the values in breaks() ?
What function do we use to get these values?

A

Using emtrends(), values are categorical variable itself
mem <- emtrends(mconcat, var = “dEnergy”,
at = list(sex = c(“male”, “female”)),
lmer.df = “satterthwaite”)
summary(mem, infer = TRUE)

36
Q

What function do you use to calculate simple slopes / effects for categorical x categorical interactions?

A

emmeans(), want to test group differences of mean in outcome
em <- emmeans(mcat2, “Int_Str”, by = “cons3”,
lmer.df = “satterthwaite”)
summary(em, infer = TRUE)

37
Q

When plotting simple effects for categorical x categorical interactions using emmip() instead of visreg(), do we take the output from emmeans() or lmer()?

A

emmeans()
* e.g emmip(em, cons3~Int_Str, CIs = TRUE) +
theme_pubr() +
ylab(“Predicted Energy”)

38
Q

What are 3 things model comparisons are used for?

A
  1. Evaluate which model provides best fit to data
  2. Evaluate how reg coeffs change across models
  3. Calculate significance for 1 or more multiple predictors
39
Q

What are nested models?

A

When 1 model is a restricted/constrained version of another model
* Based on parameters of the model

40
Q

Is the following nested models?
Model A:
moodij = boj + b1 * lonelinessj + b2 * stressij + eij
Model B:
moodij = boj + b1 * lonelinessj +0 * stressij + eij

A

Yes, Model B is nested in Model A
*0 * stress ij = 0, so predictor is left out of model

41
Q

What are 2 conditions nested models must follow?

A
  1. Both use the same dataset
  2. Both have the same number of observations (using the same dataset)
42
Q

Is Model B nested in Model A if additional parameters (predictors) in Model A has missing data?

A

No, subset cases would be used for Model A

43
Q

What test can we use to see if there is a statistically significant difference (goodness of fit test) between NESTED models?

A

Likelihood Ratio Test (LRT)

44
Q

What is the LRT test statistic and what does it mean?

A

Lambda = 2x the difference in log likelihoods of models A and B
* lambda = -2 * (LLB - LLA)

45
Q

LRT follows what type of distribution to determine it’s p-value and dfs?
What do dfs mean?

A
  • chi-squared distribution
  • dfs = difference in parameters used in models A and B
46
Q

Since LRTs are based on LLs from the model, do we use REML or ML estimation?

A
  • Maximum likelihood (ML) estiamtion
  • REML = FALSE
    modela <- lmer(dMood ~ loneliness + dStress + (1 | ID), data = dm, REML = FALSE)
47
Q

What function is used to see if 2 models have the same number of observations?

A

nobs(modela/b)

48
Q

Which function is used to calculate LRT in R?

A

anova( modela, modelb, test = “LRT”)

49
Q

Log likelihoods are a goodness of fit measure which are also known as?

A

Fit index / fit indicies
Tells us how well the parameters fit the model

50
Q

What value determines which model is significantly better from the “anova( modela, modelb, test = “LRT”)” output?

A

Higher LL (logLik) value + significant p-value

51
Q

What are non-nested models?

A

When 1 model is NOT strictly a constrained version of a more complex (full) model

52
Q

Are these models nested:
Model A:
moodij = b0j + b1 * lonelinessj + b2 * stressij + eij
Model B:
moodij = b0j + b1 * lonelinessj + b2 * sexj + 0 *stressij + eij

A

No, Model B has an addition of sex parameter/predictor

53
Q

What test is used compare non-nested models?

A

Information criterion: AIC or BIC
CANNOT use LRT

54
Q

Why is it bad to use LL alone to determine model fit from the output of AIC/BIC?

A

LL will always stay the same / increase with additional parameters (predictors) added to model
So will always choose more complex model as better fit

55
Q

What are the benefits of AIC and BIC compared to LRTs?

A

They adjust for model complexity / incorporate penalty so it doesn’t always choose the more complex model as better fit

56
Q

What is the difference between AIC and BIC in their calculations?

A

BIC takes sample size (n) into account
BIC = loge(n)k - 2 * LL

57
Q

What is “k” in AIC and BIC calculations?

A

k = number of parameters

58
Q

What is the equation for AIC and BIC?

A

AIC = 2k - 2 * LL
BIC = loge(n)k - 2 * LL

59
Q

Because BIC takes into account of sample size (n), any model with more than 7 observations mean a stronger/weaker penalty?

A

Stronger penalty and will favour less complex (more parsimonious) models

60
Q

Does higher or low AIC / BIC value determine a better model?

A

Lower AIC / BIC value

61
Q

Do both AIC and BIC require observations (n) to be larger or smaller than number of parameters (k)?

A

Larger

62
Q

What models can AIC and BIC used to compare?

A

Nested AND non-nested models

63
Q

Why do we fit polynomials in lmer() models and what do each degree of poly stand for?

A
  • To examine non-linear relationships, x is not always linear with y and can compare them with non-linear relationships
    *y ~ ploy(x, 1) is linear (straight line)
    *y ~ ploy(x, 2) is quadratic (U line)
    *y ~ ploy(x, 3) is cubic (inverted S line)
64
Q

How do you interpret the following:
energy = b1 * Wstressij + eij
The association between…

A

For that day, was the deviation of stress from that person’s usual stress predicting energy on that same day
* is association (slope) between stress deviation + energy on that day = same for each person

65
Q

For between unit interactions, variables ideally would only be measured how many times?

A

once (e.g sex)

66
Q

For within unit interactions, variables would be measured how many times?

A

multiple times

67
Q

Under what condition should you calculate simple slopes?

A

Only when interaction term is significant

68
Q

Significant LRT would mean model A is better than model B (nested) because of…

A

the additional parameter in model A

69
Q

If model A and model B fit the data the same, this means their LL are the same, so LRT (lambda) would be…

A

not significant

70
Q

Using LRT / AIC / BIC measures how well the model fits the data in comparison to the other model (relative measure of model fit). If the result was significant, can we say that one model is a good model on its own?

A

No, it’s only better fit IN COMPARISON to another model

71
Q

Are m0 and malt nested?
m0 <- lmer(dMood ~ 1 + (1 | ID) )
malt <- lmer(dMood ~ dEnergy + (1 | ID) )

A

Yes, m0 is an intercept only model

72
Q

Are these models nested and what test can we use?
m4 <- lmer(dMood ~ dStress + (1 + dStress | ID)
m1 <- lmer(dMood ~ poly(dStress, 1) + (1 | ID)
m0 <- lmer(dMood ~ 1 + (1 | ID) )

A

Yes, m1 and m0 are nested in m4 because m4 just has an addition of random slope
* Can use LRT test