knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  fig.path = "man/figures/README-",
  out.width = "100%"
)
#library(pte)
devtools::load_all("~/Dropbox/pte")
devtools::load_all("~/Dropbox/ife")
load("~/Dropbox/ife/data/job_displacement_data.rda")
library(ggplot2)
library(dplyr)

Interactive Fixed Effects (ife) Package

The ife package contains code to estimate treatment effects in a setup where a researcher has access to panel data (or, hopefully in the near future, repeated cross sections data) and where untreated potential outcomes are generated by an interactive fixed effects model.

The package is not currently available on CRAN, but the development version of the package can be installed from github by

# install.packages("devtools")
devtools::install_github("bcallaway11/ife")

Example

Next, we provide a brief example using the application from Callaway and Karami (2021).

res <- ife(yname="earn",
           gname="first.displaced",
           tname="year",
           idname="id",
           data=job_displacement_data,
           nife=1,
           xformla=~EDUC + race + gender,
           zformla=~EDUC + race + gender + afqt,
           ret_ife_regs=TRUE,
           anticipation=1,
           cband=FALSE,
           alp=0.10,
           boot_type="multiplier",
           biters=1000,
           cl=10)

summary(res)
ggpte(res) + ylim(c(-7000,7000))

We also have some code for running individual-specific linear trends models. These are a special case of the interactive fixed effects models that we consider in the paper, but where the factors $F_t$ are restricted to be equal to $t$. We mostly argue against these sorts of models in the paper, but one advantage is that they do not require any restrictions/assumptions about finding a covariate whose effects do not change over time.

This code also implements a version of linear trends that is specific to untreated potential outcomes. Presumably, many of the same criticisms (and perhaps more actually) in recent papers about implementing DID with a two-way fixed effects regression likely apply when one includes individual-specific linear trends in the same sort of specification. The code we provide here circumvents those issues.

lt_res <- linear_trends(yname="earn",
                        gname="first.displaced",
                        tname="year",
                        idname="id",
                        data=job_displacement_data,
                        xformla=~EDUC + race + gender,
                        anticipation=1,
                        cband=FALSE,
                        alp=0.10,
                        boot_type="multiplier",
                        biters=1000,
                        cl=10)

summary(lt_res)
ggpte(lt_res) + ylim(c(-7000,7000))


bcallaway11/ife documentation built on Sept. 15, 2023, 12:33 a.m.