parallel.trends.data: Creates a data frame used for generating plots to diagnose...

Description Usage Arguments Value

View source: R/ptp.R

Description

The resulting data frame can be directly passed to parallel.trends.plot or be used to generate a more customized manual plot.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
parallel.trends.data(
  df,
  timevar = "t",
  yvar = "y",
  treatdummy = "treat",
  expdummy = "exp",
  treat_exp_dummy = NULL,
  cvars = NULL,
  extravars = NULL,
  add.no.control = TRUE,
  constant.type = c("means", "zero")[1]
)

Arguments

df

The data frame used for the DID regression

timevar

Name of the time variable, e.g. "year"

yvar

Name of the dependent variable

treatdummy

Name of the 0-1 dummy variable indicating whether the observation belongs to the treatment group

expdummy

Name of the 0-1 dummy variable indicating whether the observation is in an experimental period, i.e. a period in which the treatment group gets treatment.

treat_exp_dummy

Optional name of the interaction variable treatdummy * expdummy. If not given a column with name "treat_exp_dummy" is added to the data frame.

cvars

Names of the additional control variables used in the DID regression.

extravars

Names of variables that are not used in the regression but shall be included in the returned data frame.

add.no.control

If TRUE (default) add rows that are used for a parallel trends diagnostic plot that assumes that no control variables are added.

Value

A data frame that can be passed to parallel.trends.plot. Essential columns are .t, .y, .group, .exp, .mode. Note that the data frame only contains rows that have no NA for the specified columns.


skranz/ParallelTrendsPlot documentation built on Dec. 23, 2021, 3:23 a.m.