Skip to content

Help with lmer

5 messages · Sophie Higgins, Hugo Mildenberger, Iker Vaquero Alba

#
Sophie,

I'm myself quite new to linear mixed effect models, but "PresenceAbsence" sounds like
a binary response variable. So  wouldn't be

     m1<-lmer(Presencebsence~Habitatype*Width+(1|Sitename),familiy=binomial)

the first thing to try?  There is also a special mailing list for linear - mixed -effect 
models:

      r-sig-mixed-models at r-project.org

But with numeric problems like this one you really should provide a self contained 
example (i.e. with data),  at least the output of str(yourdata), if ever possible. 

Kind regards

Hugo
On Friday 24 June 2011 13:11:23 Sophie Higgins wrote:
1 day later
#
Sophie,

sorry for any possibly duplicate email, my email client currently does not 
work correctly. I understand this snapshot as being a subset of your data only. 
But I do miss the factor "Sitename", which appears in your lmer model as a 
random factor. Also, by looking at the subset, "Presencebsence"  appears be a 
binary response variable. Does your response imply that you tried to call

  (m1<-lmer(Presencebsence~Habitatype*Width+(1|Sitename),family=binomial))

and got the same error? (Note: I previously mispelled "family")

I also observe that many factors in your data appear to be closely correlated, 
e.g. "Habitatype" and "Width", at least in the subset you passed along. I suspect 
this correlation to be the reason for the lmer error. Hence either use "Width"  
or "Habitatype".

Finally I'd propose you to put all your data into a dataframe, e.g.
 
   mydata<-NULL
   mydata$PresenceAbsence <- as.factor(Presencebsence)
   mydata$Habitattype         <- as.factor(Habitatype)
   mydata$Substratetype     <- as.factor(Substratetype)
   mydata$Width                 <- Width      
   mydata$Banktype            <- as.factor(Banktype)    
   mydata$BankIncline         <- BankIncline 
   mydata$Bankheight         <- as.factor(Bankheight)    
   mydata$Waterdepth        <- as.factor(Waterdepth)  
   mydata$Sitename            <- as.factor(Sitename)

and then pass the dataframe to lmer by using data=mydata;  mainly 
because passing a bunch of variables directly from the environment 
hightens the risk of inadvertently using stale copies, but also because 
str(mydata) would then produce a well arranged summary of all your
variables. 


Kind regards

Hugo
On Sunday 26 June 2011 11:26:45 Sophie Higgins wrote:
question.  But as stated below I keep getting an error message up and I have no idea how to fix it in order for me to fun the lmer.