Search code examples
pythonstatsmodelsglm

How do you get standard errors from GLM results in Python?


I ran a regression something like,

import statsmodels.api as sm
import statsmodels.formula.api as smf
from statsmodels.genmod.generalized_linear_model import GLMResults

result = smf.glm(formula = 'y ~ x1 + x2', data = data).fit()

I could get estimates, p-values and number of observations by

result.params, result.pvalues, result.nobs

But how do you get standard errors? I tried result.stand_errors and it didn't work.

Also, please let me know what the other options I can use such as params, pvalues.. are.

Thank you.


Solution

  • Statsmodels documentation says that the attribute name is bse: https://www.statsmodels.org/stable/generated/statsmodels.genmod.generalized_linear_model.GLMResults.html

    So you can get result.bse.