rddapp (version 1.1.0)

sens_plot: Plot the Simulated Estimates for Sensitivity Analyses

Description

sens_plot plots the sensitivity analysis for cutpoint or bandwidth.

Usage

sens_plot(sim_results, level = 0.95, x = c("A1", "A2", "bw"),
  plot_models = unique(sim_results$model), yrange = NULL)

Arguments

sim_results

A data.frame returned by rd_sens_cutoff, rd_sens_bw, mrd_sens_cutoff, or mrd_sens_bw.

level

The confidence level for CIs (assuming a normal sampling distribution).

x

A string of the column name of the varying parameter in sim_results. This will be used as the x-axis in the plot. Possible values are c("A1", "A2", "bw"), which are column names in sim_results. A1 means the varying cutoffs are for assignment 1, and A2 assignment 2.

plot_models

A character vector specifying the models (i.e., models estimated with different approaches) to be plotted. Possible values are unique(sim_results$model)).

yrange

A numeric vector of the range of y-axis

Examples

Run this code
# NOT RUN {
x <- runif(1000, -1, 1)
cov <- rnorm(1000)
y <- 3 + 2 * x + 3 * cov + 10 * (x >= 0) + rnorm(1000)
m <- rd_est(y ~ x | cov, t.design = "geq")
sim_cutoff <- rd_sens_cutoff(m, seq(-.5, .5, length.out = 10))
sens_plot(sim_cutoff, x = "A1", plot_models = c("linear", "optimal"))
sim_bw <- rd_sens_bw(m, seq(.1, 1, length.out = 10))
sens_plot(sim_bw, x = "bw")
# }

Run the code above in your browser using DataCamp Workspace