kkawato / rdlearn

Safe Policy Learning under Regression Discontinuity Designs with Multiple Cutoffs
Other
0 stars 0 forks source link

rdlearn

Installation Instructions

You can install the development version of rdleran from GitHub with:

# install.packages("devtools")
devtools::install_github("kkawato/rdlearn")

Example: Cutoff change relative to the baseline for each department (y-axis) under different smoothness multiplicative factors (x-axis)

## load pacakge
library(rdleran)
library(tidyverse)
library(nprobust)
library(nnet)
library(ggplot2)

## load example data
data('acces')

## set seed for replication
# set.seed(12345)

result <- rdlearn(y = "elig", x = "saber11", c = "cutoff", group_name = "department", data = acces, fold = 20, M = c(0, 1, 2, 4), cost = 0, trace = FALSE)

# use "plot" to visualize the result
# Figure 2
plot(result)

Example: Cutoff change relative to the baseline for each department (y-axis) with varying cost of treatment (x-axis)

# "sens" is for sensitivity analysis.
# This function inherits the cross-fitting data.
sens_result <- sens(result, M = 1, cost=c(0, 0.2, 0.4, 0.6, 0.8, 1), trace = FALSE)
# Figure 3
plot(sens_result)