Learn R Programming

did (version 1.2.3)

ggdid: ggdid

Description

Function to plot MP objects

Usage

ggdid(
  mpobj,
  type = c("attgt", "dynamic", "selective", "calendar", "dynsel"),
  ylim = NULL,
  xlab = NULL,
  ylab = NULL,
  title = "Group",
  xgap = 1,
  ncol = 1,
  e1 = 1
)

Arguments

mpobj

an MP object

type

the type of plot, should be one of "attgt", "dynamic", "selective", "calendar", "dynsel". "attgt" is the default and plots all group-time average treatment effects separately by group (including pre-treatment time periods); "dynamic" plots dynamic treatment effects -- these are the same as event studies; "selective" plots average effects of the treatment separately by group (which allows for selective treatment timing); "calendar" plots average treatment effects by time period; and "dynsel" plots dynamic effects allowing for selective treatment timing (this also requires setting the additional paramater e1)

ylim

optional y limits for the plot; settng here makes the y limits the same across different plots

xlab

optional x-axis label

ylab

optional y-axis label

title

optional plot title

xgap

optional gap between the labels on the x-axis. For example, xgap=3 indicates that the labels should show up for every third value on the x-axis. The default is 1.

ncol

The number of columns to include in the resulting plot. The default is 1.

e1

only used when plot type is "dynsel", this specifies the number of post-treatment periods that need to be available for particular groups to be included in the resulting plot when there are dynamic treatment effects and selective treatment timing

Examples

Run this code
# NOT RUN {
data(mpdta)
out <- mp.spatt(lemp ~ treat, xformla=~lpop, data=mpdta,
                panel=TRUE, first.treat.name="first.treat",
                idname="countyreal", tname="year",
                bstrap=FALSE, se=TRUE, cband=FALSE)
ggdid(out)
# }
# NOT RUN {
# }

Run the code above in your browser using DataLab