plotPlacebo: Draw a (density) plot of placebo tests

View source: R/placebo.R

plotPlaceboR Documentation

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 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

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)

bquast/RDDtools documentation built on Nov. 16, 2023, 3:28 a.m.