Coder Social home page Coder Social logo

causalkit's Introduction

CausalKit

A Package for Causal Inference inspired by econometrics and modern ML API design

CausalKit is a Python package designed for students and researchers alike. It offers a simple approach to economic and statistical analysis, emphasizing ease of use, interpretability and causation.

Build Status Test Coverage License Python Version

Features

  1. Simple API with r like syntax for linear regression
  2. Model display functions for easy comparison of models or interpretation of results
  3. Intuitive interfaces for common causal inference methods such as IV, panel methods and logit models.
  4. Simple library architecture allowing custom models to be added easily which will leverage existing functionality such as model display functions and r like syntax.

Installation

pip install causalkit

Get Started

import pandas as pd
from src.models.linreg import LinReg

data = pd.read_csv("data.csv")
model = LinReg(df=data,
               outcome="outcome_col", 
               independent=["independant_col1",
                            "independant_col2"],
               standard_error_type='hc0')
model.summary(content_type='static')

Regression

  1. rgonomic API commands for linear regression, with support for fixed effects, IV, and more.
  • To use all columns in a dataset simply call:
import pandas as pd
from src.models.linreg import LinReg

data = pd.read_csv("data.csv")
model = LinReg(df=data,
               outcome="outcome",
               independent=["."])
  • Please see the 2__regression_commands_walkthrough.ipynb in /notebooks for more details & functionality.
  1. Stargazer based regression outputs for easy comparison of models.
import pandas as pd
from src.models.linreg import LinReg
from src.displays.display_linear import display_models

data = pd.read_csv("data.csv")
model = LinReg(df=data,
               outcome="outcome_col", 
               independent=["independant_col1",
                            "independant_col2"],
               standard_error_type='hc0')

model_2 = LinReg(df=data,
               outcome="outcome_col",
               independent=["independant_col1",
                            "independant_col2",
                            "independant_col3"],
               standard_error_type='hc0')

display_models([model, model_2])

Example Image

  1. Interactive regression outputs to remind you what a stats term means. Just call the .summary() method on your model object and hover over the terms to see their definitions.

Example Image

Upcoming Features:

  1. Dropping of na values automatically upon model instantiation
  2. IV Regression with angrist data as example
  3. T test for difference in means
  4. Random effect and mixed effects models
  5. Common model diagnostics + assumption checks (linearity, normality of residuals, homoscedasticity, and absence of multicollinearity. This could include plots (like QQ plots, residual vs. fitted value plots) and statistical tests.)
  6. Regularization (Lasso, Ridge, Elastic Net)
  7. GLM's (poisson, negative binomial, multinomial)
  8. Bootstrap + resampling methods (bootstrap se ci, permutation tests)
  9. build more Causal inferenece methods interfaces (matching, regression discontinuity, synthetic control, etc.)
  10. Interactive interaction explorer (interactive visualization with sliders for continuous variables and dropdowns for categorical variables)
  11. Refactor Fixed Effects class to handle high dimensional fixed effects efficiently, add method to support within estimator, integrate tabmat library for efficient matrix operations.

causalkit's People

Contributors

mats-dodd avatar

Stargazers

 avatar  avatar

Watchers

 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.