0

I had this this problem with an error message that I don't understand whilst trying to create a binomial mixed effects model, but I didn't have any N/As in my data which I thought this error message meant... can you help? thanks

formula:

bgmodel<-glmer(c(bare,NotBare)~year*treatment*mix+(1|block),data=bareground,family=binomial)
Error in model.frame.default(data = bareground, drop.unused.levels =
TRUE,  :    variable lengths differ (found for 'year')
Paul Lemmens
  • 595
  • 5
  • 14
  • Welcome to StackOverflow! Please read the info about [how to ask a good question](http://stackoverflow.com/help/how-to-ask) and how to give a [reproducible example](http://stackoverflow.com/questions/5963269). This will make it much easier for others to help you. – Cath Sep 25 '17 at 09:33
  • I think you should represent your dependent variable as a single (categorical/ordinal) variable where you have two categorised "bare" and "not bare". Also I am not sure you are specifying properly the explanatory variables. Have you tried to incorporate them as a sum? – Edu Sep 25 '17 at 09:40
  • Also, have a look at here: https://stats.idre.ucla.edu/r/dae/mixed-effects-logistic-regression/ . It may be helpful for you. – Edu Sep 25 '17 at 09:43
  • Thank you for your comment Edu. At the moment bare and not bare represent 2 proportions that make up 100% of a quadrat (eg. 0.22 and 0.78). Is this wrong then? I am reading through the mixed effects page now – Geeorgiebee Sep 25 '17 at 13:10
  • As Cath suggested, it would be helpful if you could provide a (minimal) reproducible example of your dataset and what actually you want to respond with `bgmodel` – Edu Sep 26 '17 at 10:39

1 Answers1

0

The error is in the Model formula, you have to use the function cbind and not c

have fun
  • 381
  • 5
  • 17