Colleagues: I am running two regressions with lme4 and using lsmeans to digest the results, and lsmeans works fine with one regression but hangs with the other one--I'm not sure why, and I am hoping someone can help me debug. I am running R version 3.1.1 in the IPython notebook, and I've got lsmeans version 2.11. My data are from a behavioral experiment in which two groups of subjects complete 200+ trials of a task with two conditions. Each subject is tested in one of four separate locations. I record accuracy (0 or 1) and response time (RT) on each trial--these are the DVs for the two regressions. Thus, my dataframe has columns "location", "group", "subject", "trial", "condition", "accuracy", and "RT". The regression model for accuracy looks like this: acc.fm = glmer(accuracy ~ location + group*condition + (1|subject), family=binomial, data=my_data) The results look as expected and I'm using lsmeans to do some follow-up analyses. For example, to compare accuracy by group and condition, I'm doing this: acc.lsm <- lsmeans(acc.fm, ~group|condition) pairs(acc.lsm) All this works fine. But when I try the same approach with the RT data, my machine hangs and I do not get any output. Here is my model for the RT data (RT is a continuous variable so no logistic regression here): rt.fm = lmer(rt ~ location + group*condition*accuracy + (1|subject), data=my_data) The results from this regression look fine, but if I try this . . . rt.lsm <- lsmeans(rt.fm ~ group|condition) . . . or if I try to specify a reference grid like this . . . rt.rg <- ref.grid(rt.fm) . . . my machine hangs. Can anyone advise me? I'm not sure why lsmeans is working with the accuracy data but not the RT data, and I'm not sure what I can do to debug. I have much more experience with ANOVA than regression so I am thinking I may be missing something obvious here. Dan
Help with lsmeans
2 messages · Dan Dillon, Ben Bolker
1 day later
Dan Dillon <dgdillon <at> gmail.com> writes:
Colleagues:
[snip]
My data are from a behavioral experiment in which two groups of subjects complete 200+ trials of a task with two conditions. Each subject is tested in one of four separate locations. I record accuracy (0 or 1) and response time (RT) on each trial--these are the DVs for the two regressions. Thus, my dataframe has columns "location", "group", "subject", "trial", "condition", "accuracy", and "RT". The regression model for accuracy looks like this: acc.fm = glmer(accuracy ~ location + group*condition + (1|subject), family=binomial, data=my_data) The results look as expected and I'm using lsmeans to do some follow-up analyses. For example, to compare accuracy by group and condition, I'm doing this: acc.lsm <- lsmeans(acc.fm, ~group|condition) pairs(acc.lsm)
[snip]
Here is my model for the RT data (RT is a continuous variable so no logistic regression here): rt.fm = lmer(rt ~ location + group*condition*accuracy + (1|subject), data=my_data) The results from this regression look fine, but if I try this . . . rt.lsm <- lsmeans(rt.fm ~ group|condition) . . . or if I try to specify a reference grid like this . . . rt.rg <- ref.grid(rt.fm) . . . my machine hangs.
[snip] It's a little hard to say without a reproducible example, and this question would probably be slightly more appropriate for r-sig-mixed-models at r-project.org (although I can't actually tell for sure whether it is an lme4-specific problem or a more general ls.means::ref.grid question), but: how big a reference is ref.grid() trying to construct? Is it fairly high-resolution/high-dimensional? I would probably try some experiments with small subsets of your data to see how the results scale.