Instrumental Variable and Linear Panel models for Python
Project description
One
Linear Models
Linear (regression) models for Python. Extends statsmodels to include instrumental variable estimators:
Two-stage Least Squares
Limited Information Maximum Likelihood
k-class Estimators
Generalized Method of Moments, also with continuously updating
Designed to work equally well with NumPy, Pandas or xarray data.
Like statsmodels to include, supports patsy formulas for specifying models. For example,
import numpy as np
from linearmodels.iv import IV2SLS
from linearmodels.datasets import mroz
data = mroz.load()
mod = IV2SLS.from_formula('np.log(wage) ~ 1 + exper + exper ** 2 + [educ ~ motheduc + fatheduc]', data)
The expressions in the [ ] indicate endogenous regressors (before ~) and the instruments.
Installing
The latest release can be installed using pip
pip install linearmodels
The master branch can be installed by cloning the repo and running setup
git clone https://github.com/bashtage/linearmodels
cd linearmodels
python setup.py install
Documentation
Documentation is automatically built using doctr on every successful build of master. The documentation is still rough but should improve quickly.
Plan and status
Should eventually add some useful linear model estimators such as panel regression. Currently only the single variable IV estimators are polished.
Linear Instrumental variable estimation - complete
Linear Panel model estimation - incomplete
Linear IV Panel model estimation - not started
System regression - not started
Requirements
Running
With the exception of Python 3.5+, which is a hard requirement, the others are the version that are being used in the test environment. It is possible that older versions work.
Python 3.5+: extensive use of @ operator
NumPy (1.11+)
SciPy (0.17+)
Pandas (0.19+)
xarray (0.9+)
Statsmodels (0.8+)
Testing
py.test
Documentation
sphinx
sphinx_rtd_theme
nbsphinx
nbconvert
nbformat
ipython
jupyter
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
Hashes for linearmodels-1.0-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c455bdf5a48985805d2ace5f4bd781893f307bc23099daaee7926382d670a7a1 |
|
MD5 | 5cd05c0f057c9ae074bd684c47b25b83 |
|
BLAKE2b-256 | 3f3052206c00536d9a7e117f3c76e7a1362c0ee0bb3a205a66ac12f141610f43 |