Code Monkey home page Code Monkey logo

appelpy's Introduction

image

image

image

image

image

image

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.

Documentation

See the functionality of the library at https://appelpy.readthedocs.io/

Get started with the 10 Minutes to Appelpy tutorial:

  • binder10_: interactive experience of the 10 Minutes to Appelpy tutorial via Binder.
  • nbviewer10_: static render of the 10 Minutes to Appelpy notebook.

🥧 Why it's as easy as pie

Here is a flavour of a basic OLS regression done through appelpy, supposing you have data sitting in a Pandas dataframe df and want to model the dependent variable api00 on three other variables:

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:

    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)

appelpy's People

Contributors

mfarragher avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.