pythonstatsmodels

Get odds ratio for GEE model in statsmodels


I'm using statsmodels to construct a Generalized Estimating Equation (GEE) model to compute odds ratios like so:

va = sm.cov_struct.Autoregressive()
model = sm.GEE(x, y, group)
result = model.fit()
print(result.summary())

>>>  GEE Regression Results
===========================================================================================
Dep. Variable:        x   No. Observations:                 10000
Model:                                         GEE   No. clusters:                     7000
Method:                                Generalized   Min. cluster size:                   1
                              Estimating Equations   Max. cluster size:                  10
Family:                                   Gaussian   Mean cluster size:                 1.4
Dependence structure:                 Independence   Num. iterations:                     2
Date:                             Fri, 30 May 2025   Scale:                           0.112
Covariance type:                            robust   Time:                         01:46:29
================================================================================
                   coef    std err          z      P>|z|      [0.025      0.975]
--------------------------------------------------------------------------------
y     0.0772      0.002     31.899      0.000       0.072       0.082
==============================================================================
Skew:                          2.2170   Kurtosis:                       3.0326
Centered skew:                 0.9448   Centered kurtosis:             10.6225
==============================================================================        

                      

I wish to get the odds ratio for x. How can I do this?

I think I should be able to use the GlobalOddsRatio but don't actually understand how to use it from the reference.


Solution

  • You can use result.params to find the coefficients of the fitted model.

    np.exp(result.params.predictor) will give you the odds ratio.