Package overview

econtools is a Python package for econometrics and data manipulation.

Installation

Download or clone econtools here and run the setup.py script:

$ python setup.py install

Requirements

  • Python 2.7 or 3 (tested with 2.7 and 3.6)
  • Pandas and its dependencies (Numpy, etc.)
  • Scipy and its dependencies
  • Pytables (optional, if you use HDF5 files)
  • PyTest (optional, if you want to run the tests)

Data (I/O) Tools

econtools contains a number of boilerplate methods that make it easier to create datasets, save them to disk, and prepare them for statistical analysis.

Highlights include

  • load_or_build(): a decorator that caches a DataFrame to disk.
  • save_cli(): an argparse wrapper that adds a --save command 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.

Econometric Tools

The econometrics submodule econtools.metrics includes

  • 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, absorb command in Stata but is included in the main regression functions. This consolidates most Stata regression methods into two econtools.metrics functions:

    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 R matrix.

  • Kernel density estimation

  • Local linear regression

Full econometrics documentation here.

LaTeX Tools

  • 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.

Plotting Tools

Full plotting tools documentation here.

Reference Tools

Crosswalks between U.S. state names, abbreviations, and FIPS codes.

Full reference tools documentation here.