All Projects → evanjflack → bacondecomp

evanjflack / bacondecomp

Licence: Unknown, MIT licenses found Licenses found Unknown LICENSE MIT LICENSE.md
Bacon-Goodman decomposition for differences-in-differences with variation in treatment timing.

Programming Languages

Jupyter Notebook
11667 projects
r
7636 projects
Dockerfile
14818 projects

Projects that are alternatives of or similar to bacondecomp

econ5170
Econ5170@CUHK: Computational Methods in Economics (2020 Spring).
Stars: ✭ 127 (+252.78%)
Mutual labels:  economics, econometrics
grmpy
Python package for the simulation and estimation of generalized Roy model
Stars: ✭ 14 (-61.11%)
Mutual labels:  economics, econometrics
Econ-Data-Science
Articles/ Journals and Videos related to Economics📈 and Data Science 📊
Stars: ✭ 102 (+183.33%)
Mutual labels:  economics, econometrics
SMC.jl
Sequential Monte Carlo algorithm for approximation of posterior distributions.
Stars: ✭ 53 (+47.22%)
Mutual labels:  economics, econometrics
priceR
Economics and Pricing in R
Stars: ✭ 32 (-11.11%)
Mutual labels:  economics, econometrics
BeaData.jl
A Julia interface for retrieving data from the Bureau of Economic Analysis (BEA).
Stars: ✭ 17 (-52.78%)
Mutual labels:  economics, econometrics
Microeconometrics.jl
Microeconometric estimation in Julia
Stars: ✭ 30 (-16.67%)
Mutual labels:  economics, econometrics
ose-course-data-science
course on data science for economists
Stars: ✭ 81 (+125%)
Mutual labels:  economics, econometrics
lecture-julia.myst
Lecture source for "Quantitative Economics with Julia"
Stars: ✭ 24 (-33.33%)
Mutual labels:  economics
old nesta daps
[archived]
Stars: ✭ 16 (-55.56%)
Mutual labels:  economics
VFIToolkit-matlab
A Matlab Toolkit for Macroeconomic Models using Value Function Iteration
Stars: ✭ 59 (+63.89%)
Mutual labels:  economics
value-investing-studies
Data Analysis Studies on Value Investing
Stars: ✭ 66 (+83.33%)
Mutual labels:  economics
Dev-II
For 'Economics Development II' PhD seminar at CUNY Graduate Center. (older site) Generates docs at:
Stars: ✭ 36 (+0%)
Mutual labels:  economics
EconData
R package containing a host of datasets useful for economic research. Complete with raw data and cleaning functions.
Stars: ✭ 28 (-22.22%)
Mutual labels:  economics
Nowcasting
Nowcasting
Stars: ✭ 162 (+350%)
Mutual labels:  economics
causeinfer
Machine learning based causal inference/uplift in Python
Stars: ✭ 45 (+25%)
Mutual labels:  econometrics
cpi
Quickly adjust U.S. dollars for inflation using the Consumer Price Index (CPI)
Stars: ✭ 99 (+175%)
Mutual labels:  economics
FixedEffectModel
Fixedeffectmodel: panel data modeling in Python
Stars: ✭ 47 (+30.56%)
Mutual labels:  econometrics
dsge
Course on Dynamic Stochastic General Equilibrium (DSGE): Models, Solution, Estimation (graduate level)
Stars: ✭ 41 (+13.89%)
Mutual labels:  economics
fortune500
Fortune 500 company lists since 1955 in CSV format, mostly parsed using Beautiful Soup
Stars: ✭ 78 (+116.67%)
Mutual labels:  economics

Build Status Coverage status Example Jupyter Notebook

bacondecomp

bacondecomp is a package with tools to perform the Goodman-Bacon decomposition for differences-in-differences with variation in treatment timing. The decomposition can be done with and without time-varying covariates.

Installation

You can install bacondecomp 0.1.1 from CRAN:

install.packages("bacondecomp")

You can install the development version of bacondecomp from GitHub:

library(devtools)
install_github("evanjflack/bacondecomp")

Functions

  • bacon(): calculates all 2x2 differences-in-differences estimates and weights for the Bacon-Goodman decomposition.

Data

  • math_refom: Aggregated data from Goodman (2019, JOLE)
  • castle: Data from Cheng and Hoekstra (2013, JHR)
  • divorce: Data from Stevenson and Wolfers (2006, QJE)

Example

This is a basic example which shows you how to use the bacon() function to decompose the two-way fixed effects estimate of the effect of an education reform on future earnings following Goodman (2019, JOLE).

library(bacondecomp)
#> Loading required package: fixest
#> fixest 0.9.0, BREAKING changes! (Permanently remove this message with fixest_startup_msg(FALSE).) 
#> - In i():
#>     + the first two arguments have been swapped! Now it's i(factor_var, continuous_var) for interactions. 
#>     + argument 'drop' has been removed (put everything in 'ref' now).
#> - In feglm(): 
#>     + the default family becomes 'gaussian' to be in line with glm(). Hence, for Poisson estimations, please use fepois() instead.
df_bacon <- bacon(incearn_ln ~ reform_math,
                  data = bacondecomp::math_reform,
                  id_var = "state",
                  time_var = "class")
                  
# All 2x2 Comparisons
head(df_bacon)
#>    treated untreated    estimate      weight                     type
#> 2     1987      1985  0.04575585 0.031655309 Later vs Earlier Treated
#> 4     1986      1985  0.11390411 0.001978457 Later vs Earlier Treated
#> 5     1984      1985  0.12012908 0.001978457 Earlier vs Later Treated
#> 6     1985      1987  0.01021379 0.039569136 Earlier vs Later Treated
#> 9     1986      1987 -0.09374495 0.005440756 Earlier vs Later Treated
#> 10    1984      1987  0.09784857 0.013354583 Earlier vs Later Treated
# Summary of Early vs. Later, Later vs. Earlier, and Treated vs. Untreated
bacon_summary(df_bacon)
#>                       type  weight  avg_est
#> 1 Earlier vs Later Treated 0.06353  0.02868
#> 2 Later vs Earlier Treated 0.05265  0.03375
#> 3     Treated vs Untreated 0.88382 -0.00129
library(ggplot2)

ggplot(df_bacon) +
  aes(x = weight, y = estimate, shape = factor(type)) +
  geom_point() +
  geom_hline(yintercept = 0) + 
  theme_minimal() +
  labs(x = "Weight", y = "Estimate", shape = "Type")

References

Goodman-Bacon, Andrew. 2018. “Difference-in-Differences with Variation in Treatment Timing.” National Bureau of Economic Research Working Paper Series No. 25018. doi: 10.3386/w25018.

Paper Link

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].