I would like to apply an offset to allow for the population within segmented regression using GLM on count data in R and need to ensure that the formula I am using is correct. Adding offset in 2 different ways to the formula below seems to operate as expected but I just wanted to check if they are right.

model <- glm(outcome ~  1 + Intv + Time * (1 - Intv) + Time * (Intv) * offset(log(Pop_Total)),
             data = data,
             family = poisson)

model4 <- glm(outcome ~ 1 + Intv + Time * (1 - Intv) + Time *  (Intv),
              data = data,
              family = poisson,
              offset = log(Pop_Total))

closed as off-topic by jbowman, Michael Chernick, kjetil b halvorsen, Peter Flom Feb 3 '18 at 14:26

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This question appears to be off-topic because EITHER it is not about statistics, machine learning, data analysis, data mining, or data visualization, OR it focuses on programming, debugging, or performing routine operations within a statistical computing platform. If the latter, you could try the support links we maintain." – jbowman, Michael Chernick, kjetil b halvorsen, Peter Flom
If this question can be reworded to fit the rules in the help center, please edit the question.


Why do you have Time * (1 - Intv) + Time * (Intv) in formula? It yields the same as outcome ~ Time * (Intv). Also, I guess you intend to have ... + offset(log(Pop_Total)) and not ... * offset(log(Pop_Total)). Otherwise, I am not sure that model and model4 gives the same. See the examples in help("glm").


Not the answer you're looking for? Browse other questions tagged or ask your own question.