didWD: DID Regression

View source: R/didWD.R

didWDR Documentation

DID Regression

Description

Make a DID regression conditional on staggered treatment based on Wooldridge (2021).

Usage

didWD(dt, id, year, y, w, wcontinuous = NULL, pretime = FALSE)

Arguments

dt

A data.frame including id, year, y and w.

id

A coloumn name denotes individuals.

year

A coloumn name denotes times. dt$year is numeric.

y

A coloumn name denotes the dependent variable.

w

A dummy variable which equals D_i\cdot T_i where D_i=1 indicates treated group, and T-i=1 indicates in the treated periods.

wcontinuous

A character, the continuous treatment variable's name. Default is NULL.

pretime

Wheather add dq\cdot ft, t < q as independent variables. Default is FALSE.

Value

A list including 3 elements, the first is results of regression with Two ways fixed effect, the second is the data frame ft, and the third is the data frame dq.

Examples

library(plm)
data(stg6, package = 'didWD')
fit <- didWD(stg6, id = 'id', year = 'year', y = 'logy', w = 'w')
lmtest::coeftest(fit$fit, vcov. = vcovHC, method = 'white2')
# aggregate treat effect
xname <- names(coef(fit$fit))
aggeff(fit$fit, xname)


common2016/didWD documentation built on April 24, 2022, 12:12 a.m.