Learn R Programming

did (version 1.2.3)

mp.spatt.test: mp.spatt.test

Description

integrated moments test for conditional common trends holding in all pre-treatment time periods across all groups

Usage

mp.spatt.test(
  formla,
  xformlalist = NULL,
  data,
  tname,
  weightfun = NULL,
  w = NULL,
  panel = FALSE,
  idname = NULL,
  first.treat.name,
  alp = 0.05,
  method = "logit",
  biters = 100,
  clustervarlist = NULL,
  pl = FALSE,
  cores = 2
)

Arguments

formla

The formula y ~ d where y is the outcome and d is the treatment indicator (d should be binary)

xformlalist

A list of formulas for the X variables. This allows to test using different specifications for X, if desired

data

The name of the data.frame that contains the data

tname

The name of the column containing the time periods

weightfun

A function that takes in two arguments, X and u, to compute the weighting function for the test. The default is 1*(X <= u)

w

A vector of weights for each observation (not implemented)

panel

Boolean indicating whether the data is panel or repeated cross sections

idname

The individual (cross-sectional unit) id name

first.treat.name

The name of the variable in data that contains the first period when a particular observation is treated. This should be a positive number for all observations in treated groups. It should be 0 for observations in the untreated group.

alp

the significance level, default is 0.05

method

The method for estimating the propensity score when covariates are included

biters

The number of boostrap iterations to use. The default is 100, and this is only applicable if bstrap=TRUE.

clustervarlist

A list of cluster variables. This allows to conduct the test using different levels of clustering, if desired.

pl

Boolean for whether or not to use parallel processing

cores

The number of cores to use for parallel processing

Value

list containing test results

References

Callaway, Brantly and Sant'Anna, Pedro. "Difference-in-Differences with Multiple Time Periods and an Application on the Minimum Wage and Employment." Working Paper <https://ssrn.com/abstract=3148250> (2018).

Examples

Run this code
# NOT RUN {
data(mpdta)
mptest <- mp.spatt.test(lemp ~ treat, xformlalist=list(~lpop), data=mpdta,
                panel=TRUE, first.treat.name="first.treat",
                idname="countyreal", tname="year", clustervarlist=list(NULL))
summary(mptest[[1]])
# }
# NOT RUN {
data(mpdta)
mptest <- mp.spatt.test(lemp ~ treat, xformlalist=list(NULL), data=mpdta,
                panel=TRUE, first.treat.name="first.treat",
                idname="countyreal", tname="year", clustervarlist=list(NULL))
summary(mptest[[1]])

# }

Run the code above in your browser using DataLab