I've read a ton of posts and am trying to teach myself linear mixed effects model analysis in R, so I appreciate any help I can get. I really just need to brainstorm with someone who knows what's going on, and I don't have access to that easily.
My models are of the structure:
Dependent Variable ~ Predictor Variable + Task + Task*Predictor Variable + Group + Predictor Variable*Group + (1|Subject)
example model here:
RR_MoSml_hs <- lmer_alt(av_MoSml_hs ~ av_RR + TrialType + TrialType*av_RR + group + av_RR*group + (1|Subject), data=df)
Task has 2 levels (FW and SS), while Group has 4 levels (YA, HFOA, LFOA1, LFOA2), while both dependent and predictor variables are continuous. Task is a within-subject repeated measure while group is between subjects.
I essentially want to know how task and group impact the relationship between the dependent and predictor variables.
I have a number of models that lmer_alt indicates have significant interaction effects.
I have a few questions:
I think I need to add the interaction between task and group into my models? I'm not sure why I didn't do this before, but if someone is able to chime in about whether I should that would be great. There are group effects on task, from just prior ANOVA models, so I think I should add them into these?
I've been trying to use emmeans() to run post-hoc tests on the significant interaction effects indicated by the model. This makes sense if I do the interaction between the two categorical variables like this:
emmeans(RR_MoSml_hs,pairwise ~ TrialType*group, adjust="tukey")
Which gives an output of:
$emmeans
TrialType group emmean SE df lower.CL upper.CL
'FW' hfoa 0.1000 0.00261 158 0.0948 0.105
'SS' hfoa 0.1000 0.00292 157 0.0942 0.106
'FW' lfoa_flg 0.1205 0.00149 122 0.1175 0.123
'SS' lfoa_flg 0.1205 0.00155 124 0.1174 0.124
'FW' lfoa_va 0.0982 0.00226 165 0.0938 0.103
'SS' lfoa_va 0.0982 0.00217 165 0.0940 0.103
'FW' ya 0.1038 0.00293 160 0.0980 0.110
'SS' ya 0.1038 0.00323 162 0.0974 0.110
Degrees-of-freedom method: kenward-roger
Confidence level used: 0.95
$contrasts
contrast estimate SE df t.ratio p.value
'FW' hfoa - 'SS' hfoa -1.91e-05 0.000615 133 -0.031 1.0000
'FW' hfoa - 'FW' lfoa_flg -2.05e-02 0.003163 145 -6.479 <.0001
'FW' hfoa - 'SS' lfoa_flg -2.05e-02 0.002981 148 -6.881 <.0001
'FW' hfoa - 'FW' lfoa_va 1.74e-03 0.003700 155 0.469 0.9998
'FW' hfoa - 'SS' lfoa_va 1.72e-03 0.003462 157 0.496 0.9997
'FW' hfoa - 'FW' ya -3.82e-03 0.003406 155 -1.123 0.9509
'FW' hfoa - 'SS' ya -3.84e-03 0.003476 149 -1.106 0.9547
'SS' hfoa - 'FW' lfoa_flg -2.05e-02 0.003447 150 -5.940 <.0001
'SS' hfoa - 'SS' lfoa_flg -2.05e-02 0.003163 145 -6.479 <.0001
'SS' hfoa - 'FW' lfoa_va 1.76e-03 0.004019 157 0.437 0.9999
'SS' hfoa - 'SS' lfoa_va 1.74e-03 0.003700 155 0.469 0.9998
'SS' hfoa - 'FW' ya -3.81e-03 0.003445 160 -1.105 0.9550
'SS' hfoa - 'SS' ya -3.82e-03 0.003406 155 -1.123 0.9509
'FW' lfoa_flg - 'SS' lfoa_flg -1.91e-05 0.000615 133 -0.031 1.0000
'FW' lfoa_flg - 'FW' lfoa_va 2.22e-02 0.002602 154 8.543 <.0001
'FW' lfoa_flg - 'SS' lfoa_va 2.22e-02 0.002561 158 8.671 <.0001
'FW' lfoa_flg - 'FW' ya 1.67e-02 0.003519 171 4.737 0.0001
'FW' lfoa_flg - 'SS' ya 1.66e-02 0.003790 171 4.393 0.0005
'SS' lfoa_flg - 'FW' lfoa_va 2.22e-02 0.002781 159 8.000 <.0001
'SS' lfoa_flg - 'SS' lfoa_va 2.22e-02 0.002602 154 8.543 <.0001
'SS' lfoa_flg - 'FW' ya 1.67e-02 0.003340 171 4.996 <.0001
'SS' lfoa_flg - 'SS' ya 1.67e-02 0.003519 171 4.737 0.0001
'FW' lfoa_va - 'SS' lfoa_va -1.91e-05 0.000615 133 -0.031 1.0000
'FW' lfoa_va - 'FW' ya -5.56e-03 0.003999 171 -1.391 0.8605
'FW' lfoa_va - 'SS' ya -5.58e-03 0.004308 170 -1.295 0.8996
'SS' lfoa_va - 'FW' ya -5.54e-03 0.003765 170 -1.472 0.8214
'SS' lfoa_va - 'SS' ya -5.56e-03 0.003999 171 -1.391 0.8605
'FW' ya - 'SS' ya -1.91e-05 0.000615 133 -0.031 1.0000
Degrees-of-freedom method: kenward-roger
P value adjustment: tukey method for comparing a family of 8 estimates
My question is what is this estimate value? Can I think of it as the R value of the regression fit? Or is it dependent on what my dependent and predictor variable units are? I'm also assuming I need to change the emmeans code for each significant interaction effect but how do I do this for the interactions between the continuous and categorical variables? Is it just:
emmeans(RR_MoSml_hs,pairwise ~ group, adjust="tukey")
which gives
NOTE: Results may be misleading due to involvement in interactions
$emmeans
group emmean SE df lower.CL upper.CL
hfoa 0.1000 0.00275 157 0.0945 0.105
lfoa_flg 0.1205 0.00149 118 0.1175 0.123
lfoa_va 0.0982 0.00219 164 0.0939 0.103
ya 0.1038 0.00307 161 0.0977 0.110
Results are averaged over the levels of: TrialType
Degrees-of-freedom method: kenward-roger
Confidence level used: 0.95
$contrasts
contrast estimate SE df t.ratio p.value
hfoa - lfoa_flg -0.02049 0.00316 145 -6.479 <.0001
hfoa - lfoa_va 0.00174 0.00370 155 0.469 0.9657
hfoa - ya -0.00382 0.00341 155 -1.123 0.6759
lfoa_flg - lfoa_va 0.02223 0.00260 154 8.543 <.0001
lfoa_flg - ya 0.01667 0.00352 171 4.737 <.0001
lfoa_va - ya -0.00556 0.00400 171 -1.391 0.5070
Results are averaged over the levels of: TrialType
Degrees-of-freedom method: kenward-roger
P value adjustment: tukey method for comparing a family of 4 estimates
or do I need to add in the continuous variable here too?
emmeans(RR_MoSml_hs,pairwise ~ av_RR*group, adjust="tukey")
because this output just genuinely confuses me!
$emmeans
av_RR group emmean SE df lower.CL upper.CL
1.14 hfoa 0.1000 0.00275 157 0.0945 0.105
1.14 lfoa_flg 0.1205 0.00149 118 0.1175 0.123
1.14 lfoa_va 0.0982 0.00219 164 0.0939 0.103
1.14 ya 0.1038 0.00307 161 0.0977 0.110
Results are averaged over the levels of: TrialType
Degrees-of-freedom method: kenward-roger
Confidence level used: 0.95
$contrasts
contrast estimate SE df t.ratio p.value
av_RR1.14153257835045 hfoa - av_RR1.14153257835045 lfoa_flg -0.02049 0.00316 145 -6.479 <.0001
av_RR1.14153257835045 hfoa - av_RR1.14153257835045 lfoa_va 0.00174 0.00370 155 0.469 0.9657
av_RR1.14153257835045 hfoa - av_RR1.14153257835045 ya -0.00382 0.00341 155 -1.123 0.6759
av_RR1.14153257835045 lfoa_flg - av_RR1.14153257835045 lfoa_va 0.02223 0.00260 154 8.543 <.0001
av_RR1.14153257835045 lfoa_flg - av_RR1.14153257835045 ya 0.01667 0.00352 171 4.737 <.0001
av_RR1.14153257835045 lfoa_va - av_RR1.14153257835045 ya -0.00556 0.00400 171 -1.391 0.5070
Results are averaged over the levels of: TrialType
Degrees-of-freedom method: kenward-roger
P value adjustment: tukey method for comparing a family of 4 estimates
As I'm sure you can tell, I am very new to this but I appreciate any and all help I can get! Thanks in advance.