[R] Help with lsmeans

Dan Dillon dgdillon at gmail.com
Mon Aug 25 16:31:57 CEST 2014


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

	[[alternative HTML version deleted]]



More information about the R-help mailing list