Hi Ben I hope you are well. I have some issues regarding the structure of a GLMM in R using the glmer.nb(). I have posted this question on Cross Validated at this link: http://stats.stackexchange.com/questions/237216/how-do-you-structure-a-glmm-using-a-glmer-nb-in-r Here is the question and attached is a csv. file with a sample dataset. I want to find out what variable affects the number of fish counts. FishCounts is my response variable and it needs to be offset by the InitialNumberPerQuadrat. I have three fixed effects that I want to test: DaysSinceRelease, SizeRanking and SeededDensity or the interactions between them. There are 18 sites and each Site was sampled up to 3 times ( SampleRound 1, 2 or 3) in the period of 600 days, therefore my random variables need to take into account the repeated measures. The most appropriate distribution for my response variable was the Negative Binomial distribution as it had the lowest AIC value. Firstly, should i use glmer() and then stipulate family=negative.binomial? Or should I use glmer.nb()? I have tried both ways but the glmer.nb() allows me to offset my variable which is what I need to do. So have I structured the code correctly? Are the random variables correct and do they account for the repeated measures? model1 <- glmer.nb(FishCounts ~ DaysSinceRelease * SizeRanking * SeededDensity + (1|Site)+(1|SampleRound), offset(InitialNumberPerQuadrat),data = x)) When I run this code, I keep getting the following error: 'control' is not a list; use glmerControl()? Please help me as i'm getting desperate to figure this out. Thanks Dominique
Attention Ben Bolker: Issues with glmer.nb() in R
2 messages · Dominique Prinsloo, Mollie Brooks
Hi Dominique, It looks like you specified the offset in model1 in the wrong way and that is causing the error. Try model1 <- glmer.nb(FishCounts ~ DaysSinceRelease * SizeRanking * SeededDensity + (1|Site)+(1|SampleRound) + offset(InitialNumberPerQuadrat),data = x)) Because of the log-link, you probably actually want offset(log(InitialNumberPerQuadrat)) Your csv file was removed by the mail server. So I haven?t looked at your data. You can?t use AIC to choose the best distribution until you?ve fitted models with the various distributions. Use AIC on the fitted models. Mollie
On 27Sep 2016, at 21:27, Dominique Prinsloo <domprinsloo at gmail.com> wrote: Hi Ben I hope you are well. I have some issues regarding the structure of a GLMM in R using the glmer.nb().
I have posted this question on Cross Validated at this link: http://stats.stackexchange.com/questions/237216/how-do-you-structure-a-glmm-using-a-glmer-nb-in-r Here is the question and attached is a csv. file with a sample dataset. I want to find out what variable affects the number of fish counts. FishCounts is my response variable and it needs to be offset by the InitialNumberPerQuadrat. I have three fixed effects that I want to test: DaysSinceRelease, SizeRanking and SeededDensity or the interactions between them. There are 18 sites and each Site was sampled up to 3 times ( SampleRound 1, 2 or 3) in the period of 600 days, therefore my random variables need to take into account the repeated measures. The most appropriate distribution for my response variable was the Negative Binomial distribution as it had the lowest AIC value. Firstly, should i use glmer() and then stipulate family=negative.binomial? Or should I use glmer.nb()? I have tried both ways but the glmer.nb() allows me to offset my variable which is what I need to do. So have I structured the code correctly? Are the random variables correct and do they account for the repeated measures? model1 <- glmer.nb(FishCounts ~ DaysSinceRelease * SizeRanking * SeededDensity + (1|Site)+(1|SampleRound), offset(InitialNumberPerQuadrat),data = x)) When I run this code, I keep getting the following error: 'control' is not a list; use glmerControl()? Please help me as i'm getting desperate to figure this out. Thanks Dominique
_______________________________________________ R-sig-mixed-models at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models