Draw a (density) plot of placebo tests

Share:

Description

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

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
plotPlacebo(object, device = c("ggplot", "base"), ...)

## S3 method for class '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 class '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.

Author(s)

Matthieu Stigler <Matthieu.Stigler@gmail.com>

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
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)