Learn R Programming

rddtools (version 1.6.0)

plotPlacebo: Draw a (density) plot of placebo tests

Description

Draw a plot of placebo tests, estimating the impact on fake cutpoints

Usage

plotPlacebo(object, device = c("ggplot", "base"), ...)

# S3 method for rdd_reg plotPlacebo( object, device = c("ggplot", "base"), from = 0.25, to = 0.75, by = 0.1, level = 0.95, same_bw = FALSE, vcov. = NULL, plot = TRUE, output = c("data", "ggplot"), ... )

plotPlaceboDens(object, device = c("ggplot", "base"), ...)

# S3 method for rdd_reg plotPlaceboDens( object, device = c("ggplot", "base"), from = 0.25, to = 0.75, by = 0.1, level = 0.95, same_bw = FALSE, vcov. = NULL, ... )

computePlacebo( object, from = 0.25, to = 0.75, by = 0.1, level = 0.95, same_bw = FALSE, vcov. = NULL )

Arguments

object

the output of an RDD regression

device

Whether to draw a base or a ggplot graph.

from

Starting point of the fake cutpoints sequence. Refers ot the quantile of each side of the true cutpoint

to

Ending point of the fake cutpoints sequence. Refers ot the quantile of each side of the true cutpoint

by

Increments of the from-to sequence

level

Level of the confidence interval shown

same_bw

Whether to re-estimate the bandwidth at each point

vcov.

Specific covariance function to pass to coeftest. See help of package sandwich.

plot

Whether to actually plot the data.

output

Whether to return (invisibly) the data frame containing the bandwidths and corresponding estimates, or the ggplot object

Further arguments passed to specific methods.

Value

A data frame containing the cutpoints, their corresponding estimates and confidence intervals.

Examples

Run this code
# NOT RUN {
data(house)
house_rdd <- rdd_data(y=house$y, x=house$x, cutpoint=0)
reg_nonpara <- rdd_reg_np(rdd_object=house_rdd)
plotPlacebo(reg_nonpara)

# Use with another vcov function; cluster case
reg_nonpara_lminf <- rdd_reg_np(rdd_object=house_rdd, inference='lm')
# need to be a function applied to updated object!
vc <- function(x) vcovCluster(x, clusterVar=model.frame(x)$x)
plotPlacebo(reg_nonpara_lminf, vcov. = vc)
# }

Run the code above in your browser using DataLab