3  Visualization Options

In this chapter, we explore various visualization options available in the fdid package.

3.1 Raw means

  • ci = FALSE removes the 95% confidence intervals.
plot(fdid_results_ols1, type = "raw", ci = FALSE)

  • connected = TRUE connects points with lines (default: FALSE).
plot(fdid_results_ols1, type = "raw", connected = TRUE)

  • group_labels renames the two groups.
plot(fdid_results_ols1, type = "raw", connected = TRUE, 
     group_labels = c("Low Social Capital", "High Social Capital"))

  • palette chooses an RColorBrewer palette (default: “Set2”).
plot(fdid_results_ols1, type = "raw", connected = TRUE, 
     group_labels = c("Low Social Capital", "High Social Capital"), palette = "Set1")

  • shade_periods controls the position of shaded region. Default is x$tr_period, i.e. the event window.
    • By setting shade_periods = c(1954, 1957), the pre-event periods can be set shaded.
    • By setting shade_periods = NULL, the user can also remove the shaded region.
plot(fdid_results_ols1, type = "raw", connected = TRUE, 
     group_labels = c("Low Social Capital", "High Social Capital"),
     shade_periods = c(1954, 1957))

plot(fdid_results_ols1, type = "raw", connected = TRUE, 
     group_labels = c("Low Social Capital", "High Social Capital"),
     shade_periods = NULL)

  • alpha_shade controls the transparency of the shaded region.
plot(fdid_results_ols1, type = "raw", connected = TRUE, 
     group_labels = c("Low Social Capital", "High Social Capital"),
     alpha_shade = 0.6)

  • The user can also set ylim, xlab, ylab, and main (currently, xlim is not supported).
plot(fdid_results_ols1, type = "raw", connected = TRUE, 
     group_labels = c("Low Social Capital", "High Social Capital"), 
     ylim = c(0, 80), xlab = "Year", ylab = "Mortality", main = "Raw Mortality")

3.2 Dynamic estimates

  • ci = FALSE removes the 95% confidence intervals.
plot(fdid_results_ols1, type = "dynamic", ci = FALSE)

  • connected = TRUE connects points with lines (default: FALSE).
plot(fdid_results_ols1, type = "dynamic", connected = TRUE)

  • shade_periods, alpha_shade, ylim, xlab, ylab, and main customize the plot as above.
plot(fdid_results_ols1, type = "dynamic", connected = TRUE,
     shade_periods = c(1954, 1957),
     alpha_shade = 0.8, ylim = c(-10, 4),
     ylab = "Estimates", xlab = "Year", 
     main = "Effect Modification of High Social Capital"
     )

  • xlim zooms into a subset of years.
plot(fdid_results_ols1, type = "dynamic",
     alpha_shade = 0.8, ylim = c(-10, 4), xlim = c(1954, 1961),
     ylab = "Estimates", xlab = "Year", 
     main = "Hiding Post-Event Periods"
     )

3.3 Overlap test

The user can adjust palette, ylim, xlab, and main:

plot(fdid_results_aipw, type = "overlap",
     palette = "Set1", ylim = c(-0.1, 0.1),
     xlab = 'Score', main = 'Diagnostic Test for Overlap Assumption'
     )

3.4 Comparison of methods

By default, the comparison plot uses a vertical layout (estimates stacked top to bottom). Set vertical = FALSE for a horizontal layout.

plot(fdid_list(fdid_results_did, fdid_results_ols1, fdid_results_ols2, 
               fdid_results_ebal, fdid_results_aipw), vertical = FALSE
     )

Common options:

  • xlab and main change labels/titles.

  • ylim sets the range of the estimates axis.

plot(fdid_list(fdid_results_did, fdid_results_ols1, fdid_results_ols2, 
               fdid_results_ebal, fdid_results_aipw),
     ylim = c(-5,5)
     )

plot(fdid_list(fdid_results_did, fdid_results_ols1, 
               fdid_results_ols2, fdid_results_ebal, fdid_results_aipw),
     xlab = 'Static Estimates',
     main = 'Comparing Different Methods', vertical = FALSE,
     ylim = c(-10,10)
     )

The labels reflect method, and add vartype when it is not the default "robust". Other settings (e.g., target.pop) are not currently shown in the labels.

plot(fdid_list(fdid_results_ols1, fdid_results_ols1_boot,
               fdid_results_ols1_jack, fdid_results_ols2, fdid_results_ols2_target_1,
               fdid_results_aipw),
     ylim = c(-5,1), vertical = TRUE
     )