Skip to main content

Applied Econometrics Library for Python

Project description

.. image:: https://badge.fury.io/py/appelpy.svg :target: https://badge.fury.io/py/appelpy/

.. image:: https://img.shields.io/pypi/pyversions/appelpy.svg :target: https://pypi.org/project/appelpy/

.. image:: https://img.shields.io/badge/License-BSD%203--Clause-blue.svg :target: https://github.com/mfarragher/appelpy/blob/master/LICENSE.txt

.. image:: https://pepy.tech/badge/appelpy :target: https://pepy.tech/project/appelpy/

.. image:: https://codecov.io/gh/mfarragher/appelpy/branch/master/graph/badge.svg :target: https://codecov.io/gh/mfarragher/appelpy

=================================================== appelpy: Applied Econometrics Library for Python


About 👁️


appelpy is the Applied Econometrics Library for Python. It seeks to bridge the gap between the software options that have a simple syntax (such as Stata) and other powerful options that use Python's object-oriented programming as part of data modelling workflows. ⚗️

Econometric modelling and general regression analysis in Python have never been easier!

The library builds upon the functionality of the 'vanilla' Python data stack (e.g. Pandas, Numpy, etc.) and other libraries such as Statsmodels.

See the appelpy-examples <https://github.com/mfarragher/appelpy-examples>_ Github repo for more detailed documentation and notebooks that show the functionality of the library.

In particular see the 10 Minutes to Appelpy <https://github.com/mfarragher/appelpy-examples/blob/master/00_ten-minutes-to-appelpy.ipynb>_ notebook for a whirlwind tour of the library's functionality on the California Test Score (Caschool) dataset.

🥧 Why it's as easy as pie

Here is a flavour of a basic OLS regression done through appelpy, supposing you have data <https://econpapers.repec.org/paper/bocbocins/caschool.htm>_ sitting in a Pandas dataframe df and want to model the dependent variable api00 on three other variables:

.. code-block:: python

    from appelpy.linear_model import OLS
    model1 = OLS(df, ['api00'], ['acs_k3', 'meals', 'full']).fit()
    model1.results_output  # returns summary results

The key information is sitting in the model1 object, but there is much more functionality that can be done with it. These are more things that can be done via one line of code:

  • Diagnostics can be called from the object: e.g. produce a P-P plot via model1.diagnostic_plot('pp_plot')
  • Model selection statistics: e.g. find the root mean square error of the model from model1.model_selection_stats
  • Standardized model estimates: model1.results_output_standardized

🍏 What inspired it?

  1. The simple syntax of software such as Stata. With the data loaded, a regression model summary can be returned by a one-line command:::

     regress api00 acs_k3 meals full
    

However with the simplicity comes a few disadvantages: Stata is not open-source software; the workflows are tricky with modern business problems; lacks the benefits of object-oriented programming.

  1. Statsmodels is a powerful Python library that addresses some of those disadvantages, but with that power comes a considerable learning curve and clunkiness. Here is the code for the same regression:

    .. code-block:: python

     import statsmodels.api as sm
     model1 = sm.OLS(df['api00'], sm.add_constant(df['acs_k3', 'meals', 'full'])).fit()
     results1 = model1.summary()  # returns summary results
    

It can get much more unwieldy than that. The model results object is brilliant as it can be printed in different formats (plaintext, Latex, etc.)... but that is only the starting point. How do I diagnose the regression model itself? How do I get standardized estimates? That's where it becomes more complicated.

appelpy simply aims to achieve a sweet spot between both approaches.


Installation ⏲️


pip install appelpy

Supported for Python 3.6 and higher versions.


Dependencies 🖇️


  • pandas>=0.24
  • jinja2
  • scipy
  • numpy>=1.16
  • statsmodels>=0.9
  • patsy
  • seaborn>=0.9
  • matplotlib>=3

Licence ⚖️


Modified BSD (3-clause)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

appelpy-0.3.1.tar.gz (24.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

appelpy-0.3.1-py3-none-any.whl (28.1 kB view details)

Uploaded Python 3

File details

Details for the file appelpy-0.3.1.tar.gz.

File metadata

  • Download URL: appelpy-0.3.1.tar.gz
  • Upload date:
  • Size: 24.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.4

File hashes

Hashes for appelpy-0.3.1.tar.gz
Algorithm Hash digest
SHA256 7bcf5963d5e8f0ef7e4a069c9fbc03cafaea5362bceb2a035796fed7c587c6cd
MD5 4d87645a6aedfafd94a288aee415889f
BLAKE2b-256 92be7908bea955aa92ef88c0a9d1fc201b17a4311c0bae3c3ecbafc04150711a

See more details on using hashes here.

File details

Details for the file appelpy-0.3.1-py3-none-any.whl.

File metadata

  • Download URL: appelpy-0.3.1-py3-none-any.whl
  • Upload date:
  • Size: 28.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.4

File hashes

Hashes for appelpy-0.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 d0852ba60a71e67021808e0019e548319204f414e1256a48fcecc0b13a056ac9
MD5 7a7fd83aa8dc52d9753a5e9488a4165a
BLAKE2b-256 40aec7ae28232dd09d1307cbf4249e5c6c4e79e7a83c2e6a51a67eeeed651258

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page