2
$\begingroup$

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')  
$\endgroup$
6
  • $\begingroup$ 0. Welcome to CV.SE. 1.Why not use a negative binomial model through discrete_model.NegativeBinomial? $\endgroup$
    – usεr11852
    Commented May 23, 2021 at 2:08
  • $\begingroup$ there is currently no model that uses mixing of Poisson with normal heterogeneity, unless it's clustered data. Beside NegativeBinomial, statsmodels.org/dev/generated/… also allows for overdispersion. $\endgroup$
    – Josef
    Commented May 23, 2021 at 2:25
  • $\begingroup$ I want to preserve the Poisson distribution for the $y_e$ term but add another coefficient in my summary table, so instead of reporting back three coefs for CATEGORY_1, CATEGORY_2, and CATEGORY_3 - I would have four, adding an alpha coef that highlights the overdispersion $\endgroup$
    – Will_E
    Commented May 23, 2021 at 2:28
  • $\begingroup$ discrete models NegativeBinomial and GeneralizedPoisson do not have fit_constrained yet, so the model would need to be reparameterized, for example by dropping the constant. $\endgroup$
    – Josef
    Commented May 23, 2021 at 2:29
  • $\begingroup$ The Poisson model can still consistently estimate the mean parameters even with excess dispersion. However, the standard errors for the parameters need to be adjusted. One standard way is to use pearson chisquare as estimate for the dispersion (scale). That's separately estimated and not part of the summary parameter table. $\endgroup$
    – Josef
    Commented May 23, 2021 at 2:33

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.