python - Getting statsmodels to use heteroskedasticity corrected standard errors in coefficient t-tests -


i've been digging api of statsmodels.regression.linear_model.regressionresults , have found how retrieve different flavors of heteroskedasticity corrected standard errors (via properties hc0_se, etc.) however, can't quite figure out how t-tests on coefficients use these corrected standard errors. there way in api, or have manually? if latter, can suggest guidance on how statsmodels results?

the fit method of linear models, discrete models , glm, take cov_type , cov_kwds argument specifying robust covariance matrices. attached results instance , used inference , statistics reported in summary table.

unfortunately, documentation doesn't show yet in appropriate way. auxiliary method selects sandwiches based on options shows options , required arguments: http://statsmodels.sourceforge.net/devel/generated/statsmodels.regression.linear_model.ols.fit.html

for example, estimating ols model , using hc3 covariance matrices can done with

model_ols = ols(...) result = model_ols.fit(cov_type='hc3') result.bse result.t_test(....) 

some sandwiches require additional arguments, example cluster robust standard errors, can selected in following way, assuming mygroups array contains groups labels:

results = ols(...).fit(cov_type='cluster', cov_kwds={'groups': mygroups} results.bse ... 

some robust covariance matrices make additional assumptions data without checking. example heteroscedasticity , autocorrelation robust standard errors or newey-west, hac, standard errors assume sequential time series structure. panel data robust standard errors assume stacking of time series individuals.

a separate option use_t available specify whether t , f or normal , chisquare distributions should used default wald tests , confidence intervals.


Comments

Popular posts from this blog

node.js - Using Node without global install -

How to access a php class file from PHPFox framework into javascript code written in simple HTML file? -

java - Null response to php query in android, even though php works properly -