Learn R Programming

LoTTA (version 0.1.0)

Bayesian Inference in Regression Discontinuity Designs

Description

Implementation of the LoTTA (Local Trimmed Taylor Approximation) model described in "Bayesian Regression Discontinuity Design with Unknown Cutoff" by Kowalska, van de Wiel, van der Pas (2024) .

Copy Link

Version

Install

install.packages('LoTTA')

Version

0.1.0

License

GPL (>= 2)

Maintainer

Julia Kowalska

Last Published

July 11th, 2025

Functions in LoTTA (0.1.0)

LoTTA_plot_effect_CONT

Function that visualizes the impact of the cutoff location on the treatment effect estimate. It plots too figures. The bottom figure depicts the posterior density of the cutoff location. The top figure depicts the box plot of the treatment effect given the cutoff point. If the prior on the cutoff location was discrete each box corresponds to a distinct cutoff point. If the prior was continuous each box correspond to an interval of cutoff values (the number of intervals can be changed through nbins).
LoTTA_fuzzy_CONT

LoTTA_fuzzy_CONT
Initial_SHARP_CONT

function that samples initial values for sharp LoTTA model with continuous outcomes
Initial_treatment_DIS

function that samples initial values for the treatment model with a discrete prior
LoTTA_fuzzy_BIN

LoTTA_fuzzy_BIN
Initial_treatment_CONT

function that samples initial values for the treatment model with a continuous prior
logit

logit function
LoTTA_treatment

LoTTA_treatment
LoTTA_sharp_CONT

LoTTA_sharp_CONT
normalize_cont_x

normalize continuous score function
plot_outcome_BIN

Function that plots the median (or another quantile) of the posterior function with binary outcome along with the quanatile-based credible interval. The function is plotted on top of the binned input data. To bin the data, the score data is divided into bins of fixed length, then the average outcome in each bin is calculated. The average outcomes are plotted against the average values of the score in the corresponding bins.
plot_outcome_CONT

Function that plots the median (or another quantile) of the posterior function of a continous outcome along with the quanatile-based credible interval. The function is plotted on top of the binned input data. To bin the data, the score data is divided into bins of fixed length, then the average outcome in each bin is calculated. The average outcomes are plotted against the average values of the score in the corresponding bins.
normalize_cont_y

normalize continuous outcome function
normalize_dis_x

normalize discrete score function
optimal_k_bin

function that searches for initial parameters of binary outcome function to initiate the sampler
LoTTA_sharp_BIN

LoTTA_sharp_BIN
optimal_k

function that searches for initial parameters of outcome function to initiate the sampler
LoTTA_plot_treatment

Function that plots the median (or another quantile) of the LoTTA posterior treatment probability function along with the quanatile-based credible interval. The function is plotted on top of the binned input data. To bin the data, the score data is divided into bins of fixed length, then the proportion of treated is calculated in each bin. The proportions are plotted against the average values of the score in the corresponding bins. The data is binned separately on each side of the cutoff, the cutoff is marked on the plot with a dotted line. In case of an unknown cutoff, the MAP estimate is used.
bounds

function that finds maximum widow size to searxh for a cutoff
treatment_function_sample

Function that evaluates the treatment probability function in a domain x, given the coefficients
invlogit

inverse logit function
read_prior

function that checks the type of a prior and whether it is correct
trim_dis_y

Binary outcomes for trimmed score
BIN_outcome_function_sample

Function that evaluates the binary outcome function in a domain x, given the coefficients
Initial_FUZZy_CONT

function that samples initial values for fuzzy LoTTA model with a known cutoff and continuous outcomes
Initial_DIS_CONT

function that samples initial values for fuzzy LoTTA model with a discrete prior and binary outcomes
CONT_outcome_function_sample

Function that evaluates the continuous outcome function in a domain x, given the coefficients
Initial_SHARP_BIN

function that samples initial values for sharp LoTTA model with binary outcomes
Initial_FUZZy_BIN

function that samples initial values for fuzzy LoTTA model with a known cutoff and binary outcomes
Initial_CONT_BIN

function that samples initial values for fuzzy LoTTA model with a continuous prior and binary outcomes
Initial_CONT_CONT

function that samples initial values for fuzzy LoTTA model with a ontinuous prior and continuous outcomes
Initial_DIS_BIN

function that samples initial values for LoTTA with a discerete prior and binary ourcomes
Bin_data

Function that splits the data into bins and computes the average in each bin
LoTTA_plot_effect_DIS

Function that visualizes the impact of the cutoff location on the treatment effect estimate. It plots too figures. The bottom figure depicts the posterior density of the cutoff location. The top figure depicts the box plot of the treatment effect given the cutoff point. If the prior on the cutoff location was discrete each box corresponds to a distinct cutoff point. If the prior was continuous each box correspond to an interval of cutoff values (the number of intervals can be changed through nbins).
LoTTA_plot_effect

LoTTA_plot_effect
Initial_treatment_c

function that samples initial values for the treatment model with a known cutoff
LoTTA_plot_outcome

LoTTA_plot_outcome