<s> from __future__ import print_function <EOL> import numpy as np <EOL> from statsmodels . regression . linear_model import OLS , GLSAR <EOL> from statsmodels . tools . tools import add_constant <EOL> from statsmodels . datasets import macrodata <EOL> import statsmodels . regression . tests . results . results_macro_ols_robust as res <EOL> d2 = macrodata . load ( ) . data <EOL> g_gdp = <NUM_LIT> * np . diff ( np . log ( d2 [ '<STR_LIT>' ] ) ) <EOL> g_inv = <NUM_LIT> * np . diff ( np . log ( d2 [ '<STR_LIT>' ] ) ) <EOL> exogg = add_constant ( np . c_ [ g_gdp , d2 [ '<STR_LIT>' ] [ : - <NUM_LIT:1> ] ] , prepend = False ) <EOL> res_olsg = OLS ( g_inv , exogg ) . fit ( ) <EOL> print ( res_olsg . summary ( ) ) <EOL> res_hc0 = res_olsg . get_robustcov_results ( '<STR_LIT>' ) <EOL> print ( '<STR_LIT>' ) <EOL> print ( res_hc0 . summary ( ) ) <EOL> print ( '<STR_LIT>' ) <EOL> res_hac4 = res_olsg . get_robustcov_results ( '<STR_LIT>' , maxlags = <NUM_LIT:4> , use_correction = True ) <EOL> print ( res_hac4 . summary ( ) ) <EOL> print ( '<STR_LIT>' ) <EOL> tt = res_hac4 . t_test ( np . eye ( len ( res_hac4 . params ) ) ) <EOL> print ( tt . summary ( ) ) <EOL> print ( '<STR_LIT>' ) <EOL> print ( tt . summary_frame ( ) ) <EOL> res_hac4 . use_t = False <EOL> print ( '<STR_LIT>' ) <EOL> tt = res_hac4 . t_test ( np . eye ( len ( res_hac4 . params ) ) ) <EOL> print ( tt . summary ( ) ) <EOL> print ( '<STR_LIT>' ) <EOL> print ( tt . summary_frame ( ) ) <EOL> print ( vars ( res_hac4 . f_test ( np . eye ( len ( res_hac4 . params ) ) [ : - <NUM_LIT:1> ] ) ) ) <EOL> print ( vars ( res_hac4 . wald_test ( np . eye ( len ( res_hac4 . params ) ) [ : - <NUM_LIT:1> ] , use_f = True ) ) ) <EOL> print ( vars ( res_hac4 . wald_test ( np . eye ( len ( res_hac4 . params ) ) [ : - <NUM_LIT:1> ] , use_f = False ) ) ) <EOL> mod_olsg = OLS ( g_inv , exogg ) <EOL> res_hac4b = mod_olsg . fit ( cov_type = '<STR_LIT>' , <EOL> cov_kwds = dict ( maxlags = <NUM_LIT:4> , use_correction = True ) ) <EOL> print ( res_hac4b . summary ( ) ) <EOL> res_hc1b = mod_olsg . fit ( cov_type = '<STR_LIT>' ) <EOL> print ( res_hc1b . summary ( ) ) <EOL> res_hc1c = mod_olsg . fit ( cov_type = '<STR_LIT>' , cov_kwds = { '<STR_LIT>' : True } ) <EOL> print ( res_hc1c . summary ( ) ) <EOL> decade = ( d2 [ '<STR_LIT>' ] [ <NUM_LIT:1> : ] // <NUM_LIT:10> ) . astype ( int ) <EOL> res_clu = mod_olsg . fit ( cov_type = '<STR_LIT>' , <EOL> cov_kwds = { '<STR_LIT>' : decade , '<STR_LIT>' : True } ) <EOL> print ( res_clu . summary ( ) ) </s>
