Re: [R] nested ANCOVA: still confused

From: Doran, Harold <>
Date: Wed 25 Jan 2006 - 07:04:21 EST

Dear Jeff:

I see the issues in your code and have provided what I think will solve your problem. It is often much easier to get help on this list when you provide a small bit of data that can be replicated and you state what the error messages are that you are receiving. OK, with that said, here is what I see. First, you do not need to use the syntax bb$sex in your model, this can be significantly simplified. Second, you do not have a random statement in your model.

Here is your original model:
lme(bb$rtot~bb$sex, bb$purban|bb$chick/bb$box, na.action=na.omit)

Here is what it should be:

lme(fixed = rtot~sex, random=~purban|chick/box, na.action=na.omit, data=bb)

Notice there is a fixed and random call. You can simplify this as

lme(rtot~sex, random=~purban|chick/box, na.action=na.omit, bb)

Note, you can eliminate the "fixed=" portion but not the random statement.

Last, if you want to do this in lmer, the newer function for mixed models in the Matrix package, you would do

lmer(rtot~sex + (purban|box:chick) + (purban|box), na.action=na.omit, data=bb)

Hope this helps.

-----Original Message-----
[] On Behalf Of Jeffrey Stratford Sent: Tuesday, January 24, 2006 11:34 AM To:
Subject: [R] nested ANCOVA: still confused

Dear R-users,

I did some more research and I'm still not sure how to set up an ANCOVA with nestedness. Specifically I'm not sure how to express chicks nested within boxes. I will be getting Pinheiro & Bates (Mixed Effects Models in S and S-Plus) but it will not arrive for another two weeks from our interlibrary loan.

The goal is to determine if there are urbanization (purban) effects on chick health (rtot) and if there are differences between sexes (sex) and the effect of being in the same clutch (box).

The model is rtot = sex + purban + (chick)box.

I've loaded the package lme4. And the code I have so far is

bb <- read.csv("C:\\eabl\\eabl_feather04.csv", header=TRUE) bb$sex <- factor(bb$sex) rtot.lme <- lme(bb$rtot~bb$sex, bb$purban|bb$chick/bb$box,

but this is not working.

Any suggestions would be greatly appreciated.



Jeffrey A. Stratford, Ph.D.
Postdoctoral Associate
331 Funchess Hall
Department of Biological Sciences
Auburn University
Auburn, AL 36849
FAX 334-844-9234 mailing list PLEASE do read the posting guide! mailing list PLEASE do read the posting guide! Received on Wed Jan 25 07:40:39 2006

This archive was generated by hypermail 2.1.8 : Wed 25 Jan 2006 - 14:07:58 EST