Package 'rnr'

Title: Rosenbaum and Rubin Sensitivity
Description: Apply sensitivity analysis for offline policy evaluation, as implemented in Jung et al. (2017) <arXiv:1702.04690> based on Rosenbaum and Rubin (1983) <http://www.jstor.org/stable/2345524>.
Authors: Jongbin Jung
Maintainer: Jongbin Jung <[email protected]>
License: GPL-3 | file LICENSE
Version: 0.2.1.9000
Built: 2026-05-17 05:24:07 UTC
Source: https://github.com/jongbinjung/rnr

Help Index


rnr: A package for computing Rosenbaum and Rubin sensitivity

Description

The rnr package provides functions for computing sensitivity of counterfactual estimates under assumptions of unobserved confounding.


Generic sensitizing for Rosenbaum & Rubin sensitivity analysis

Description

Generic sensitizing for Rosenbaum & Rubin sensitivity analysis

Usage

sensitize(obj, q, dp, d0, d1, ...)

Arguments

obj

data to sensitize

q

p(u = 1 | x)

dp

change in log-odds of treat = 1 if u = 1

d0

change in log-odds of response = 1 if treat = 0 and u = 1

d1

change in log-odds of response = 1 if treat = 1 and u = 1

...

additional arguments required to sensitize object

Value

a sensitized object, identical to, or inheriting the class of original obj


Compute the sensitivity-adjusted estimates of predicted outcome given treatment/control

Description

Compute the sensitivity-adjusted estimates of predicted outcome given treatment/control

Usage

## S3 method for class 'data.frame'
sensitize(obj, q, dp, d0, d1, debug = FALSE, ...)

Arguments

obj

data frame to analyze; must include columns $treat: Observed (binary) treatment, e.g., bail_set $resp_ctl: Predicted probability of positive resp given control, $resp_trt: Predicted probability of positive resp given treatment, $p_trt: predicted probability of treatment

q

p(u = 1 | x)

dp

change in log-odds of treat = 1 if u = 1

d0

change in log-odds of response = 1 if treat = 0 and u = 1

d1

change in log-odds of response = 1 if treat = 1 and u = 1

debug

logical, whether or not to return columns of intermediate variables for debugging purposes

...

additional arguments are ignored

Value

A data frame with the columns resp_ctl and resp_trt updated according to the sensitivity parameters. If debug = TRUE, returned data frame will also contain columns of intermediate variables computed for sensitivity, appended with "__" (e.g., gamma__), with the original response estimates renamed as resp_trt_trt__ = resp_trt resp_ctl_ctl__ = resp_ctl

Examples

obj <- data.frame(treat = 0, resp_ctl = .2, resp_trt = .3, p_trt = .5)
sensitize(obj, q = .5, dp = log(2), d0 = log(2), d1 = log(2))