econtools is a Python package for
econometrics and data manipulation.
Download or clone
here and run the
$ python setup.py install
econtools contains a number of boilerplate methods that make it easier to
create datasets, save them to disk, and prepare them for statistical analysis.
load_or_build(): a decorator that caches a DataFrame to disk.
argparsewrapper that adds a
--savecommand line switch to any script.
confirmer(): a drop-in interactive method that prompts the user for a yes or no response, e.g. “Are you sure you want to delete all your data?”
Full I/O documentation here.
econtools also contains a few helper functions that make data cleaning a
The econometrics submodule
Common regression techniques (OLS, 2SLS, LIML) with results tested against Stata (except where Stata has documented errors).
Option to absorb any variable into fixed effects via within transformation. This is similar to the
areg, absorbcommand in Stata but is included in the main regression functions. This consolidates most Stata regression methods into two
These functions also use the correct degrees of freedom corrections.
Robust standard errors
- robust/HC1, HC2, HC3
- Clustered standard errors
- Spatial HAC (aka Conley standard errors) with uniform or triangle kernel
F-tests by variable name or arbitrary
Kernel density estimation
Local linear regression
WARNING [31 Oct 2019]: Predicted values (yhat and residuals) may not be as expected in transformed regressions (when using fixed effects or using weights). That is, the current behavior is different from Stata. I am looking into this and will post a either a fix or a justification of current behavior in the near future.
Full econometrics documentation here.
outreg()creates LaTeX table fragments from regression results.
table_statrow()creates bottom rows of regression tables (e.g., R-squared) and summary statistic tables.
Full LaTeX documentation here.