Data modeling
For our model, we’ll assume our outcome has a Poisson distribution. While our dataset doesn’t have a lot of zero values, it may be worth considering a zero-inflated Poisson or negative binomial distribution rather than a Poisson distribution. However, for simplicity of modeling, we will set our family to a Poisson distribution.
We’ll use a data-derived autocorrelation structure, as a best guess for correlations over time within towns isn’t readily apparent. In practice, it’s usually better to derive this structure from data than make a guess when the structure isn’t known well beforehand.
Let’s get started modeling this GEE in Python.
Running the GEE in Python
Let’s first import our GEE model and define the distribution family and covariance structure with Script 13.2
:
#load packages import statsmodels.api as sm import statsmodels.formula.api as smf #define GEE parameters family=sm.families.Poisson...