plotPlacebo: Draw a (density) plot of placebo tests

Description Usage Arguments Value Author(s) Examples

View source: R/placebo.R

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
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
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)

Example output

Loading required package: AER
Loading required package: car
Loading required package: lmtest
Loading required package: zoo

Attaching package: 'zoo'

The following objects are masked from 'package:base':

    as.Date, as.Date.numeric

Loading required package: sandwich
Loading required package: survival
Loading required package: np
Nonparametric Kernel Methods for Mixed Datatypes (version 0.60-3)
[vignette("np_faq",package="np") provides answers to frequently asked questions]
[vignette("np",package="np") an overview]
[vignette("entropy_np",package="np") an overview of entropy-based methods]
Warning: Ignoring unknown aesthetics: ymin, ymax
Warning: Ignoring unknown aesthetics: ymin, ymax

rddtools documentation built on Jan. 10, 2022, 5:07 p.m.