Cross Validated Asked by E. Wade on January 3, 2022
Question: Have I correctly translated my lmer models into formulas depicting each individual level, as well as the composite formula? Specific questions about my work below.
Information about my models and the data
I have two two-level models representing experimental time series data. One model includes two-way interactions and the other model includes three-way interactions (the latter are terms of greatest interest). I am testing if participants’ previous values in the time series (the lagged variable) predict their current time series value, depending on the valence of the stimulus (positive, negative, ambiguous), a personality trait of interest, and the interactions between these. Values are nested within trial, which are nested within the participant.
To clarify, each participant completed 36 trials. In each of the 36 trials, there are 120 data points (value) collected. Therefore, each participant should have 4,320 data points.
Here are some basic attributes of the data:
> summary(data)
ID value lagged_value Ambiguous_Valence Negative_Valence
9999 : 3528 Min. :-10.00000 Min. :-12.072000 Min. :0.0000 Min. :-0.5
4431 : 3528 1st Qu.: -3.00000 1st Qu.: -2.360544 1st Qu.:0.0000 1st Qu.:-0.5
f6498 : 3528 Median : 0.00000 Median : -0.005669 Median :0.0000 Median :-0.5
f7876 : 3528 Mean : -0.09446 Mean : 0.000000 Mean :0.1667 Mean : 0.0
f8100 : 3528 3rd Qu.: 3.00000 3rd Qu.: 2.139739 3rd Qu.:0.0000 3rd Qu.: 0.5
f8102 : 3528 Max. : 10.00000 Max. : 13.139740 Max. :1.0000 Max. : 1.5
(Other):211680
Positive_Valence Trait
Min. :-0.5 Min. :-9.79126
1st Qu.:-0.5 1st Qu.:-3.26158
Median :-0.5 Median : 1.32634
Mean : 0.0 Mean : 0.01372
3rd Qu.: 0.5 3rd Qu.: 3.43316
Max. : 1.5 Max. : 6.98598
> str(data)
'data.frame': 232848 obs. of 7 variables:
$ ID : Factor w/ 77 levels "9999","4431",..: 1 1 1 1 1 1 1 1 1 1 ...
$ value : int -2 -1 -3 -1 -1 -2 -1 -1 -1 -1 ...
$ lagged_value : num -1.237 -1.237 -2.237 -1.237 -0.237 ...
$ Ambiguous_Valence : int 1 1 1 1 1 1 1 1 1 1 ...
$ Negative_Valence : num -0.5 -0.5 -0.5 -0.5 -0.5 -0.5 -0.5 -0.5 -0.5 -0.5 ...
$ Positive_Valence : num -0.5 -0.5 -0.5 -0.5 -0.5 -0.5 -0.5 -0.5 -0.5 -0.5 ...
$ Trait : num 0.796 0.796 0.796 0.796 0.796 ...
For below, I’m sorry, the Positive_Valence and Trait columns are too close together – I couldn’t figure out how to space them out without going onto the next line. 0.7958646 is the value for every row in the Trait column.
> head(data, 10)
ID value lagged_value Ambiguous_Valence Negative_Valence Positive_Valence Trait
1 9999 -2 -1.2372449 1 -0.5 -0.5 0.7958646
2 9999 -1 -1.2372449 1 -0.5 -0.5 0.7958646
3 9999 -3 -2.2372449 1 -0.5 -0.5 0.7958646
5 9999 -1 -1.2372449 1 -0.5 -0.5 0.7958646
7 9999 -1 -0.2372449 1 -0.5 -0.5 0.7958646
8 9999 -2 -1.2372449 1 -0.5 -0.5 0.7958646
9 9999 -1 -1.2372449 1 -0.5 -0.5 0.7958646
10 9999 -1 -1.2372449 1 -0.5 -0.5 0.7958646
11 9999 -1 -1.2372449 1 -0.5 -0.5 0.7958646
12 9999 -1 -1.2372449 1 -0.5 -0.5 0.7958646
Model with two-way interaction terms:
Here is the model:
lmer(value ~ Negative_Valence*Lagged_Value + Positive_Valence*Lagged_Value + Ambiguous_Valence*Lagged_Value + Trait*Lagged_Value + (-1 + Lagged_Value |ID), data = data)
For the equations at each level, I have:
Level 1:
$$Y_{ti} = beta_{0} + beta_{1i}Value_{(t-10)i} + e_{ti}$$
where $beta_{0}$ is the global intercept and $beta_{1i}$ is the intercept in level-2 unit (participant) i. For this we have the level 2 model:
Level 2:
$$beta_{1i} = gamma_{10} + gamma_{11}Trait_{i} + gamma_{12}NegativeValence_{i} + gamma_{13}PositiveValence_{i} + gamma_{14}AmbiguousValence_{i} + u_{1i}$$
Where $gamma_{10}$ is the average intercept in level-2 unit (participant) i
Composite:
$$Y_{ti} = beta_{0} + gamma_{10}Value_{(t-10)i} + gamma_{11}(Trait_{i}*Value_{(t-10)i}) + gamma_{12}(NegativeValence_{i}* Value_{(t-10)i}) + gamma_{13}(PositiveValence_{i}*Value_{(t-10)i}) + gamma_{14}(AmbiguousValence_{i}*Value_{(t-10)i}) + e_{ti} + u_{1i}$$
This results in 8 estimates from the model, 6 fixed effects, $beta_{0}$, $gamma_{10}$, $gamma_{11}$, $gamma_{12}$, $gamma_{13}$, and $gamma_{14}$, and 2 random effects: $e_{ti}$ and $u_{1i}$
$beta_{0}$ is the global intercept; it is the mean of the time series when the fixed effects $Value_{(t-10)i}$, $NegativeValence_{i}$, $PositiveValence_{i}$, $AmbiguousValence_{i}$, and $Trait_{i}$ are all at zero.
$gamma_{10}$ represents the expected difference in the time series’ for a one unit change in the lagged value ($Value_{(t-10)i}$), when $Trait_{i}$, $NegativeValence_{i}$, $PositiveValence_{i}$, and $AmbiguousValence_{i}$ all equal zero.
$gamma_{11}$ represents the extent to which the relationship between the time series value ($Y_{ti}$) and the lagged value $Value_{(t-10)i}$ depends on the personality trait of interest ($Trait_{i}$), with $NegativeValence_{i}$, $PositiveValence_{i}$, $AmbiguousValence_{i}$ held constant
$gamma_{12}$ represents the extent to which the relationship between the time series value ($Y_{ti}$) and the lagged value $Value_{(t-10)i}$ depends on $NegativeValence_{i}$, with all other fixed effects ($Trait_{i}$, $PositiveValence_{i}$ and $AmbiguousValence_{i}$) held constant. And same for $gamma_{13}$ and $gamma_{14}$ with $PositiveValence_{i}$ and $AmbiguousValence_{i}$ respectively.
$u_{1i}$ is the random intercept for individuals and the software will estimate a variance for this (I am wondering if this term actually should not exist in these formulas because the model does not have a random intercept)
$e_{ti}$ is the unit-level (time series level) residual and the software will estimate a variance for this.
Model with three-way interaction terms:
Here is the model:
lmer(value ~ Negative_Valence*Trait*Lagged_Value + Positive_Valence*Trait*Lagged_Value + Ambiguous_Valence*Trait* Lagged_Value + (-1 + Lagged_Value |ID), data = data).
Level 1:
$$Y_{ti} = beta_{0} + beta_{1i}Value_{(t-10)i} + e_{ti}$$
where $beta_{0}$ is the global intercept and $beta_{1i}$ is the intercept in level-2 unit (participant) i. For this we have the level 2 model:
Level 2:
$$beta_{1i} = gamma_{10} + gamma_{11}Trait_{i} + gamma_{12}NegativeValence_{i} + gamma_{13}PositiveValence_{i} + gamma_{14}AmbiguousValence_{i} + gamma_{15}(NegativeValence_{i}*Trait_{i}) + gamma_{16}(PositiveValence_{i}*Trait_{i}) + gamma_{17}(AmbiguousValence*Trait_{i}) + u_{1i}$$
Where $gamma_{10}$ is the average intercept in level-2 unit (participant) i
Composite:
$$Y_{ti} = beta_{0} + gamma_{10} Value_{(t-10)i} + gamma_{11}(Trait_{i}*Value_{(t-10)i}) + gamma_{12}(NegativeValence_{i}*Value_{(t-10)i}) + gamma_{13}(PositiveValence_{i}*Value_{(t-10)i}) + gamma_{14}(AmbiguousValence_{i}* Value_{(t-10)i}) + gamma_{15}(NegativeValence_{i}*Trait_{i}*Value_{(t-10)i}) + gamma_{16}(PositiveValence_{i}*Trait_{i}*Value_{(t-10)i}) + gamma_{17}(AmbiguousValence*Trait_{i}*Value_{(t-10)i}) + e_{ti} + u_{1i}$$
This results in 11 estimates from the model, 9 fixed effects, $beta_{0}$, $gamma_{10}$, $gamma_{11}$, $gamma_{12}$, $gamma_{13}$, $gamma_{14}$, $gamma_{15}$, $gamma_{16}$, and $gamma_{17}$, and 2 random effects: $e_{ti}$ and $u_{1i}$
$u_{1i}$, $e_{ti}$, $beta_{0}$, $gamma_{10}$, $gamma_{11}$, $gamma_{12}$, $gamma_{13}$ and $gamma_{14}$ are defined as they are in the model above.
$gamma_{15}$ represents the degree to which the relationship between the time series value ($Y_{ti}$) and the lagged value $Value_{(t-10)i}$ depends on the interaction between $NegativeValence_{i}$ and the personality trait of interest ($Trait_{i}$), with all other fixed effects ($PositiveValence_{i}$ and $AmbiguousValence_{i}$) held constant. Similarly for $gamma_{16}$ and $gamma_{17}$ with $PositiveValence_{i}$ and $AmbiguousValence_{i}$ respectively.
Specific questions:
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP