Stephen Politzer-Ahles
2012-Sep-12 14:35 UTC
[R] Contrasts in mixed effects model: difference between differences
Hello everyone, I am testing a model in which I have a two-level factor (let's call it First [1, 2]) nested under a four-level factor (let's call it Second [A, B, C, D]). I have used the following model to get coefficients representing whether, for each level of Second, there is a significant difference (in the outcome variable, Latency) between the levels of First: test <- lmer( Latency ~ Second / First + (1|Subject) + (1|Item), data ) This gives me nice output like: SecondA:First2 -0.009879 0.008283 -1.19 SecondB:First2 -0.032136 0.008293 -3.88 SecondC:First2 0.006748 0.008131 0.83 SecondD:First2 0.006153 0.008206 0.75 Now, though, I am also interested in directly testing whether those differences differ between levels of Second. So, for example, whether the -0.009879 coefficient for SecondA:First2 is significantly different from the 0.006748 coefficient for SecondC:First2. Is there a way to specify contrasts for the model that will make it spit out those comparisons? Or should I do it by hand? I assume I can subtract one of those coefficients from another and divide by a standard error to get a new *t*-score, but I'm not sure where I could get the standard error of the differences between coefficients (my understanding is that the standard error of the coefficients I would get from ranef(test)$Subject is not going to be exactly the same as the standard error reported for the fixed effect [Baayen, 2008:247]). Thank you very much for your feedback, Steve Politzer-Ahles -- Stephen Politzer-Ahles University of Kansas Linguistics Department http://www.linguistics.ku.edu/ [[alternative HTML version deleted]]
Stephen Politzer-Ahles
2012-Sep-12 17:19 UTC
[R] Contrasts in mixed effects model: difference between differences
(Sorry about the double post; it seems the last time I posted this it didn't show up correctly because of some character encoding issue.) Hello everyone, I am testing a model in which I have a two-level factor (let's call it First [1, 2]) nested under a four-level factor (let's call it Second [A, B, C, D]). I have used the following model to get coefficients representing whether, for each level of Second, there is a significant difference (in the outcome variable, Latency) between the levels of First: test <- lmer( Latency ~ Second / First + (1|Subject) + (1|Item), data ) This gives me nice output like: SecondA:First2 -0.009879 0.008283 -1.19 SecondB:First2 -0.032136 0.008293 -3.88 SecondC:First2 0.006748 0.008131 0.83 SecondD:First2 0.006153 0.008206 0.75 Now, though, I am also interested in directly testing whether those differences differ between levels of Second. So, for example, whether the -0.009879 coefficient for SecondA:First2 is significantly different from the 0.006748 coefficient for SecondC:First2. Is there a way to specify contrasts for the model that will make it spit out those comparisons? Or should I do it by hand? I assume I can subtract one of those coefficients from another and divide by a standard error to get a new *t*-score, but I'm not sure where I could get the standard error of the differences between coefficients (my understanding is that the standard error of the coefficients I would get from ranef(test)$Subject is not going to be exactly the same as the standard error reported for the fixed effect [Baayen, 2008:247]). Thank you very much for your feedback, Steve Politzer-Ahles -- Stephen Politzer-Ahles University of Kansas Linguistics Department http://www.linguistics.ku.edu/ [[alternative HTML version deleted]]