Home > Blockchain >  Cannot introduce offset into negative binomial regression
Cannot introduce offset into negative binomial regression

Time:10-18

I'm performing a count data analysis in R, dealing with a data called 'doctor' which is:

   V2  V3        L4 V5
1   1  32 10.866795  1
2   2 104 10.674706  1
3   3 206 10.261581  1
4   4 186  9.446440  1
5   5 102  8.578665  1
6   1   2  9.841080  2
7   2  12  9.275472  2
8   3  28  8.649974  2
9   4  28  7.857481  2
10  5  31  7.287561  2

The best model was V3~V2 L4 V5 V2:L4:V5 using stepwise AIC. Now I want to set L4 as the offset and perform negative binomial regression including the interaction, so I used the code nbinom=glm.nb(V3~V2 V5 V2:V5,offset=L4) but get this error message that says Error in glm.control(...) : unused argument (offset = L4). What have I done wrong here?

CodePudding user response:

Offsets are entered using an offset term in the model formula:

nbinom=glm.nb(V3~V2 V5 V2:V5 offset(L4))

Also you can use V2*V5 instead of V2 V5 V2:V5

  •  Tags:  
  • r
  • Related