Giter VIP home page Giter VIP logo

bcf-iv's Introduction

Code for Bayesian Causal Forest with Instrumental Variable

In this repository we provide the code for the BCF-IV function and for the application part of the paper "Heterogeneous causal effects with imperfect compliance: a novel Bayesian machine learning approach" by F.J. Bargagli-Stoffi, K. De Witte and G. Gnecco. This function discovers the effect heterogeneity and provides two ways to estimate the heterogeneous causal effect (two-stage least squares and method-of-moments) in scenarios where the assignment mechanism is irregular. The BCF-IV function directly builds on the Bayesian Causal Forest algorithm by Hahn, Murray and Carvalho.

BCF-IV function

The function takes as inputs:

  • y: the outcome variable;
  • w: the reception of the treatment variable (binary);
  • z: the assignment to the treatment variable (binary);
  • max_depth: the maximal depth of the tree generated by the function;
  • n_burn: the number of iterations discarded by the BCF-IV algorithm for the burn-in;
  • n_sim: the number of iterations used by the BCF-IV algorithm to get the posterior distribution of the estimands;
  • binary: this option should be set to TRUE when the outcome variable is binary and to FALSE if the outcome variable is either discrete or continuous.

The mm_bcf_iv function returns the discovered sub-population, the conditional complier average treatment effect (CCACE), the p-value for this effect, the p-value for a weak-instrument test, the proportion of compliers, the conditional intention-to-treat effect (CITT) and the proportion of compliers in the node.

More details on the R code for the BCF-IV function can be found here.

Example usage

source("bcf-iv.R")

bcf_iv(y, w, z, x, max_depth = 2, n_burn= 2000, n_sim= 2000, binary = TRUE)

mm_bcf_iv(y, w, z, x, max_depth = 2, n_burn= 2000, n_sim= 2000, binary = TRUE)

References

  • Falco J. Bargagli-Stoffi, Kristof De Witte, Giorgio Gnecco. Heterogeneous causal effects with imperfect compliance: a novel Bayesian machine learning approach. [link]
  • P. Richard Hahn, Jared S. Murray, Carlos Carvalho. Bayesian regression tree models for causal inference: regularization, confounding, and heterogeneous effects. [link]

bcf-iv's People

Contributors

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