[R] lmer refuses nested random factors

ONKELINX, Thierry Thierry.ONKELINX at inbo.be
Thu Nov 27 14:44:08 CET 2008


Dear Martin,

How many levels has PLANT? Does it is an ID for the individual plants? In that case it is pointless to add it to a random effect. Because then each group at the higest level would contain only one observation.

There is a mailing list dedicated to mixed effects models: R-Sig-mixed-models.

HTH,

Thierry

----------------------------------------------------------------------------
ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek / Research Institute for Nature and Forest
Cel biometrie, methodologie en kwaliteitszorg / Section biometrics, methodology and quality assurance
Gaverstraat 4
9500 Geraardsbergen
Belgium 
tel. + 32 54/436 185
Thierry.Onkelinx op inbo.be 
www.inbo.be 

To call in the statistician after the experiment is done may be no more than asking him to perform a post-mortem examination: he may be able to say what the experiment died of.
~ Sir Ronald Aylmer Fisher

The plural of anecdote is not data.
~ Roger Brinner

The combination of some data and an aching desire for an answer does not ensure that a reasonable answer can be extracted from a given body of data.
~ John Tukey

-----Oorspronkelijk bericht-----
Van: r-help-bounces op r-project.org [mailto:r-help-bounces op r-project.org] Namens HENERY Martin
Verzonden: donderdag 27 november 2008 13:29
Aan: r-help op r-project.org
Onderwerp: [R] lmer refuses nested random factors

I am trying to run the following model in R

 > lmer(leaves.eaten~Geocytotype+(1|TEST/ 
PLANT),data=cyphoplantfeeding,family=poisson)

My experimental setup is 41 replicates (TEST) of an experiment in  
which there are three Geocytotypes of a plant species in each TEST,  
and two plant pseudoreplicates per Geocytotype in each test (i.e.  
3*2=6 plants per test). So my random factors are trying to examine/ 
account for variation between replicates and between pairs of plants  
in each test. The response variable is counts of damaged leaves on  
each plant hence the poisson distribution.

When I try and run the model I get this error message (sorry but it  
is in French):


 >Erreur : length(f1) == length(f2) is not TRUE
 >De plus : Warning messages:
 >1: In PLANT:TEST :
 > l'expression numérique a 246 éléments : seul le premier est utilisé
 >2: In PLANT:TEST :
 > l'expression numérique a 246 éléments : seul le premier est utilisé

This however is not connected as far as I can tell to the structure  
of the data because I checked the lengths of all the variables and   
if I run the same model design using lme function (without the  
family=poisson of course) and the model computes perfectly fine with  
the correct group sizes:

 >Number of Observations: 246
 >Number of Groups:
 >           TEST PLANT %in% TEST
 >             41             123

I couldn't find this error mentioned in any other posts on the list.  
Can someone enlighten me as to how to get around this intractable  
problem? My crude solution is to go around the obstacle by computing  
the mean of each plant pair and using a GLM with poisson distribution  
and ignore random effects.

Martin


************************************************************************
Martin Henery

Post doctoral researcher
Département de Biologie/Ecologie & Evolution
Université de Fribourg

************************************************************************



	[[alternative HTML version deleted]]


Dit bericht en eventuele bijlagen geven enkel de visie van de schrijver weer 
en binden het INBO onder geen enkel beding, zolang dit bericht niet bevestigd is
door een geldig ondertekend document. The views expressed in  this message 
and any annex are purely those of the writer and may not be regarded as stating 
an official position of INBO, as long as the message is not confirmed by a duly 
signed document.



More information about the R-help mailing list