[R] Logistic regression with repeated measures

Steven Vamosi smvamosi at gmail.com
Mon Feb 11 19:03:16 CET 2008


Hello R list,

I am hoping to conduct a logistic regression with repeated measures,
and would love an actual "code run through" for such an analysis. I
found only one related post on this list, but a full answer was never
provided. I understand that the routine lmer (or lmer2) in the lme4
package is often recommended in such a case, but actually implementing
it is where I've hit a wall.

In a nutshell, the experiment involved presenting females from two
groups (treatment, control) with an opportunity to mate with a virgin
male every 6 hours for 48 hours. Every female was presented this
opportunity at every time step (i.e., whether or not she mated at 6
hr, she was again presented with a male at 12 hr, and so on). In
addition to which group a female belongs to, we have an a priori
reason to want to test the effect of her initial body mass as a
covariate. A subset of the data looks like this:

female	group	mass	time	mate
1	control	5.7	0	1
1	control	5.7	6	1
1	control	5.7	12	0
1	control	5.7	18	0
1	control	5.7	24	0
1	control	5.7	30	1
1	control	5.7	36	0
1	control	5.7	42	1
1	control	5.7	48	0
2	treatm	5.3	0	1
2	treatm	5.3	6	0
2	treatm	5.3	12	0
2	treatm	5.3	18	0
2	treatm	5.3	24	0
2	treatm	5.3	30	1
2	treatm	5.3	36	0
2	treatm	5.3	42	0
2	treatm	5.3	48	0
3	control	6.1	0	1
3	control	6.1	6	0
3	control	6.1	12	0
3	control	6.1	18	0
3	control	6.1	24	1
3	control	6.1	30	1
3	control	6.1	36	0
3	control	6.1	42	1
3	control	6.1	48	0
...

How, then, to determine whether treatment females display different
mating patterns over time than control females? Here's my crack at it:

foo1 <- lmer2(mate ~ group * mass * time + (time | female), family=binomial)

Thanks in advance,
Steve



More information about the R-help mailing list