Learn R Programming

fixest (version 0.5.1)

did_plot_yearly_effects: Plots the results of yearly treatment effects estimation

Description

This function plots the results of a did_estimate_yearly_effects estimation.

Usage

did_plot_yearly_effects(
  object,
  x.shift = 0,
  w = 0.1,
  ci_level = 0.95,
  style = c("bar", "interval", "tube"),
  add = FALSE,
  col = 1,
  bar.col = col,
  bar.lwd = par("lwd"),
  bar.lty,
  grid = TRUE,
  grid.par = list(lty = 1),
  bar.join = TRUE,
  ...
)

Arguments

object

An object returned by the function did_estimate_yearly_effects.

x.shift

Shifts the confidence intervals bars to the left or right, depending on the value of x.shift. Default is 0.

w

The width of the confidence intervals.

ci_level

Scalar between 0 and 1: the level of the CI. By default it is equal to 0.95.

style

One of "bar" (default), "interval" or "tube". The style of the plot.

add

Default is FALSE, if the intervals are to be added to an existing graph. Note that if it is the case, then the argument x MUST be numeric.

col

Color of the point estimate and of the line joining them (if style = "interval").

bar.col

Color of the bars of the confidence interval. Defaults to col.

bar.lwd

Line width of the confidence intervals, defaults to 1.

bar.lty

Line type of the confidence intervals, defaults to 1 for style = "bar" and to 2 for style = "interval".

grid

Whether to add an horizontal grid. Default is TRUE.

grid.par

Graphical parameters used when plotting the grid in the background. Default is list(lty=1).

bar.join

Logical, default is FALSE. Whether to join the dots when style = "bar".

...

Any other argument to be passed to summary or to plot.

See Also

fixest-deprecated

Examples

Run this code
# NOT RUN {
# Sample data illustrating the DiD
data(base_did)

# Estimation of yearly effect (they are automatically added)
est = did_estimate_yearly_effects(y ~ x1 + treat + post, base_did,
                                  treat_time = ~treat+period, reference = 5)

# Now we plot the results
did_plot_yearly_effects(est)

# Now with fixed-effects:
est_fe = did_estimate_yearly_effects(y ~ x1 | id + period, base_did,
                                     treat_time = ~treat+period, reference = 5)
did_plot_yearly_effects(est_fe)

# you can change the type of SE to be plotted:
did_plot_yearly_effects(est_fe, se = "cluster") # default
did_plot_yearly_effects(est_fe, se = "standard")


# }

Run the code above in your browser using DataLab