I have a Poisson model (displayed below), where my $\epsilon_e$ term is designed to handle over-dispersion. I was curious if statsmodels has an easy way of returning a coefficient $\epsilon$ that fits my expression as listed.
$$y_e \sim Poisson(\frac{60}{12}n_ee^{\mu+\alpha_e + \epsilon_e})$$ $$\sum_{n=1}^N\alpha_{e_n}=0$$ $$\epsilon_e \sim N(0, \sigma_\epsilon^2)$$
I have provided the sample code below that I have currently implemented:
mdl = smf.glm(formula = 'Y_e ~ CATEGORY_1 + CATEGORY_2 + CATEGORY_3',
data = df,
offset = np.log(5) + np.log(df['N_e']),
family = sm.families.Poisson(link = sm.families.links.log()))
poisson_results = mdl.fit_constrained('CATEGORY_1 + CATEGORY_2 + CATEGORY_3 = 0')
discrete_model.NegativeBinomial
? $\endgroup$CATEGORY_1
,CATEGORY_2
, andCATEGORY_3
- I would have four, adding an alpha coef that highlights the overdispersion $\endgroup$fit_constrained
yet, so the model would need to be reparameterized, for example by dropping the constant. $\endgroup$scale
). That's separately estimated and not part of the summary parameter table. $\endgroup$