[R] Contrasts for 2x4 interaction in mixed effects model

David Winsemius dwinsemius at comcast.net
Tue Sep 11 02:45:33 CEST 2012


On Sep 10, 2012, at 5:14 PM, semperparatus wrote:

> Your problem seems to be exactly the problem I've been having for the past
> week.  So glad to find this thread.
> However, when I follow the syntax you used to get around the issue, I still
> didn't get the output to work in the way yours did.  I don't believe my
> factors are truly nested however (nor your factors: if A, B, C, and D occur
> in both levels 1 and 2, the effects would be crossed).
> 
> I have a model with the variable condition, and the variable patient
> (indicating whether the subject is a patient or control) with repeated
> measures per subject, and the following is the model I had: 
> MLsd = lmer(H.y.~patient*stance*cond + (1|subj), data=H)
> 
> I want to be able to look at the same contrast set up you were interested
> in, and compare patient to control at every level of the variable condition
> (cond).
> 
> *When I tried using the syntax you used with my model:
> lmer(H.y.~patient*stance*cond+(cond/patient) + (1|subj), data=H), I got this
> result, which seems to be using condition 1 as a part of the baseline. Any
> idea how to change that?*

Why would you want to change it? `(Intercept)` is really control:cond1:stance1 and then all the other estimates are for differences from that baseline.

-- 
David.

> 
> Fixed effects:
>                  Estimate Std. Error t value
> (Intercept)       0.552594   0.012774   43.26
> patient1         -0.005951   0.016989   -0.35
> stance2          -0.009010   0.014577   -0.62
> cond2            -0.023666   0.007028   -3.37
> cond3            -0.015469   0.006948   -2.23
> patient1:stance2  0.027988   0.019472    1.44
> patient1:cond2    0.015981   0.009977    1.60
> patient1:cond3    0.014622   0.009905    1.48
> 
> Best,
> Rachel
> (M.S. candidate frantically working to finish her master's project in the
> coming week or so)
> 
> 
> 
> --
> View this message in context: http://r.789695.n4.nabble.com/Contrasts-for-2x4-interaction-in-mixed-effects-model-tp4642536p4642710.html
> Sent from the R help mailing list archive at Nabble.com.
> 
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

David Winsemius, MD
Alameda, CA, USA




More information about the R-help mailing list