bashtage / linearmodels

Additional linear models including instrumental variable and panel data models that are missing from statsmodels.
https://bashtage.github.io/linearmodels/
University of Illinois/NCSA Open Source License
929 stars 184 forks source link

ENH: Add clustered Standard Errors for system models. #373

Open lrsppp opened 2 years ago

lrsppp commented 2 years ago

Can you estimate clustered standard errors using linearmodels.system.model.IVSystemGMM?

bashtage commented 2 years ago

Yes. See https://bashtage.github.io/linearmodels/iv/examples/advanced-examples.html#Multiple-Instruments

lrsppp commented 2 years ago

Thank you for your quick answer. Unfortunately, it seems not to work with IVSystemGMM:

system_gmm = IVSystemGMM.from_formula(equations, data, weight_type="unadjusted")
system_gmm.fit(cov_type = 'clustered')

It throws a key error: KeyError: 'clustered'. See example: https://bashtage.github.io/linearmodels/system/examples/three-stage-ls.html#System-GMM-Estimation

bashtage commented 2 years ago

Oh, sorry.

bashtage commented 2 years ago

I just saw the IV and didn't pay attention to the System.

bashtage commented 2 years ago

The covariance estimators are listed here: https://bashtage.github.io/linearmodels/system/mathematical-formula.html#covariance-estimation

No clustered.

lrsppp commented 2 years ago

Ah, okay. Was hoping for a work around or something! Thank you!