[R] GLMM and crossed effects

Lorenz.Gygax@fat.admin.ch Lorenz.Gygax at fat.admin.ch
Fri Jan 7 15:05:58 CET 2005


> I am analysing data with a dependent variable of insect 
> counts, a fixed effect of site and two random effects, day,
> which is the same set of 10 days for each site, and then
> transect, which is nested within site (5 each).

And what exactly are you interested in? Just the differences between the two
sites? Then you would have sampled on several days just to better estimate
what is going on at those sites? Or are you also interested in a time
course?

> I am trying to fit the cross classified model using GLMM in lme4.

I have yet to get around to working with lme4 (by the way is there some
documentation that describes the changes and advantages of lme4 in
comparison to nlme?), but assuming that the syntax is the same as in lme ()
or glmmPQL ():

Why don't you use:

GLMM (count ~ site, data= dat3,
      random= ~ 1 | site/trans, family= poisson)

This compares your counts between sites considering that transects are
nested in sites and that there are several measurements on each transect
(the days). They are the repeated measurements on the lowest level (within
trans), so you do not need to specify them explicitly.

Acutally, you might not even need the site/ in your random term as this
variable ist constant for each transect and thus the degrees of freedom are
adjusted for the fixed effect of site (but then each of the transect need
its own code).

Well on further thought, you might necessarily need to leave this part of
the random term away if you want to conduct any statistical test, because
otherwise you only have an N= 1 for each site ...

thus, I guess you need to assume that your transects are independent
measures of your two sites (which means that you can conduct some
statistical analysis, but you results hold only for these two specific sites
and can not necessarily be generalised to other sites). Thus the model would
be:

GLMM (count ~ site, data= dat3,
      random= ~ 1 | trans2, family= poisson)

or if you are interested in a time course you might try (and this
explicitely models that these are the same days):

GLMM (count ~ site*day, data= dat3,
      random= ~ 1 | trans2, family= poisson)

I would argue, that you are either not interested in the days, then these
are just your repeated measurements and it does not matter that they were
exactly on the same days for the different transects (and then they are just
implicitly nested in trans2) OR you are interested in them and then I would
include them as a fixed effect, which is crossed with transect, i.e. all
transects were sampled on all days.

By the way, it is not clear to me from your description how trans2, ts and
ts2 differ logically.

> there are als ts1 and ts2 dummy variables, as was necessary
> in the old lme.....

what are these necessary for? (But I have to admit that I usually feed a
standard data.frame to lme and glmmPQL)

> GLMM(count~site,data=dat3,random=list(day=~1,trans=~1|site,
> family=poisson)

I do not know whether you can write such a thing at all. If this has not
changed a lot from nlme to lme4 you would need to write:

random= list (~1 | day, ~ 1 | site/trans)

but that you would implicitly define that site is nested in day, i.e. it
would be the same as writing

random= ~ 1 | day/site/trans

which is not what you want.

> #This does... but also note the differences in the summary 
> and VarCorr variance components...

Here, you loose me completely. It is not clear to me what you compare and
where you perceive a problem.

Cheers, Lorenz
- 
Lorenz Gygax, Dr. sc. nat.
Centre for proper housing of ruminants and pigs
Swiss Federal Veterinary Office
agroscope FAT Tänikon, CH-8356 Ettenhausen / Switzerland




More information about the R-help mailing list