0

all. I am doing negative binomial linear mixed model using lme4 package in R. My question is whether or not there is a way to put two offsets in glmer.nb or control one predictor variable of a model to see another predictor's effects. Using a model, I would like to test whether or not the number of aggression between males increases with the number of male and also with the number of females around them. My code is like this.

t<- glmer.nb(no.aggression ~ no.males + no.females
           +(1|id_target) + offset(log(hours)), data=x)

The response variable is the number of aggression between males which I observed during a day. Since the daily observation time varied over days, it was put in offset.

The number of males predicted the number of aggression but the number of females did not predict the number of aggression. However, the number of males was positively related with the number of females on the day. So I guess that males might be attracted by the females or something so when there are more females, there are more males. This might result in increase in the number of aggression of a given day. I thought that it will be possible to control the effect of number of males using two offsets or something, though I don't know the way to do that.

Let me know, if you have any tips or if it is not a proper approach. Best.

H. Ryu
  • 1
  • 1
  • This seems like a question of statistical modeling and not really programming. You should ask such questions over at [stats.se]. Otherwise at least give some sort of [reproducible example](http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) with sample input data. – MrFlick Dec 08 '16 at 16:10
  • @MrFlick Oh, thanks. – H. Ryu Dec 09 '16 at 00:38

0 Answers0