plotSensi: Plot the sensitivity to the bandwidth

Description Usage Arguments Value Author(s) Examples

View source: R/plotSensi.R

Description

Draw a plot showing the LATE estimates depending on multiple bandwidths

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
plotSensi(
  rdd_regobject,
  from,
  to,
  by = 0.01,
  level = 0.95,
  output = c("data", "ggplot"),
  plot = TRUE,
  ...
)

## S3 method for class 'rdd_reg_np'
plotSensi(
  rdd_regobject,
  from,
  to,
  by = 0.05,
  level = 0.95,
  output = c("data", "ggplot"),
  plot = TRUE,
  device = c("ggplot", "base"),
  vcov. = NULL,
  ...
)

## S3 method for class 'rdd_reg_lm'
plotSensi(
  rdd_regobject,
  from,
  to,
  by = 0.05,
  level = 0.95,
  output = c("data", "ggplot"),
  plot = TRUE,
  order,
  type = c("colour", "facet"),
  ...
)

Arguments

rdd_regobject

object of a RDD regression, from either rdd_reg_lm or rdd_reg_np

from

First bandwidth point. Default value is max(1e-3, bw-0.1)

to

Last bandwidth point. Default value is bw+0.1

by

Increments in the from to sequence

level

Level of the confidence interval

output

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

plot

Whether to actually plot the data.

device

Whether to draw a base or a ggplot graph.

vcov.

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

order

For parametric models (from rdd_reg_lm), the order of the polynomial.

type

For parametric models (from rdd_reg_lm) whether different orders are represented as different colour or as different facets.

...

Further arguments passed to specific methods

Value

A data frame containing the bandwidths and corresponding estimates and confidence intervals.

Author(s)

Matthieu Stigler <Matthieu.Stigler@gmail.com>

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
data(house)
house_rdd <- rdd_data(y=house$y, x=house$x, cutpoint=0)

#Non-parametric estimate 
bw_ik <- rdd_bw_ik(house_rdd)
reg_nonpara <- rdd_reg_np(rdd_object=house_rdd, bw=bw_ik)
plotSensi(reg_nonpara)
plotSensi(reg_nonpara, device='base')

#Parametric estimate:
reg_para_ik <- rdd_reg_lm(rdd_object=house_rdd, order=4, bw=bw_ik)
plotSensi(reg_para_ik)
plotSensi(reg_para_ik, type='facet')

Example output

Loading required package: AER
Loading required package: car
Loading required package: carData
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-9)
[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]

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