Coder Social home page Coder Social logo

thiagoapr / synthdid Goto Github PK

View Code? Open in Web Editor NEW

This project forked from synth-inference/synthdid

0.0 1.0 0.0 6.24 MB

Synthetic difference in differences

Home Page: https://synth-inference.github.io/synthdid

License: BSD 3-Clause "New" or "Revised" License

R 98.31% TeX 1.69%

synthdid's Introduction

synthdid: Synthetic Difference in Differences Estimation

Build Status

This package implements the synthetic difference in difference estimator (SDID) for the average treatment effect in panel data, as proposed in Arkhangelsky et al (2019). We observe matrices of outcomes Y and binary treatment indicators W that we think of as satisfying Yij = Lij + τij Wij + εij. Here τij is the effect of treatment on the unit i at time j, and we estimate the average effect of treatment when and where it happened: the average of τij over the observations with Wij=1. All treated units must begin treatment simultaneously, so W is a block matrix: Wij = 1 for i > N0 and j > T0 and zero otherwise, with N0 denoting the number of control units and T0 the number of observation times before onset of treatment. This applies, in particular, to the case of a single treated unit or treated period.

This package is currently in beta and the functionality and interface is subject to change.

Some helpful links for getting started:

Installation

The current development version can be installed from source using devtools.

devtools::install_github("synth-inference/synthdid")

Example

library(synthdid)

# Estimate the effect of California Proposition 99 on cigarette consumption
data('california_prop99')
setup = panel.matrices(california_prop99)
tau.hat = synthdid_estimate(setup$Y, setup$N0, setup$T0)
se = sqrt(vcov(tau.hat, method='placebo'))
sprintf('point estimate: %1.2f', tau.hat)
sprintf('95%% CI (%1.2f, %1.2f)', tau.hat - 1.96 * se, tau.hat + 1.96 * se)
plot(tau.hat)

References

Dmitry Arkhangelsky, Susan Athey, David A. Hirshberg, Guido W. Imbens, and Stefan Wager. Synthetic Difference in Differences, 2019. [arxiv]

synthdid's People

Contributors

davidahirshberg avatar erikcs avatar swager avatar

Watchers

James Cloos 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.