knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  fig.path = "README-"
)
library(pbph)

pbph: Peters-Belson with Prognostic Heterogeneity implementation for R

R-build-check Coverage Status Coverage Status

The pbph package implements a two-stage variation of the Peters-Belson approach to treatment effect detection in a causal inference framework. Traditional Peters-Belson methods generate a model to predict the outcome in the absense of treatment, then estimate the treatment effect by the difference in that predicted outcome and the observed outcome in the treatment group.

The Peters-Belson with Prognostic Heterogeneity (PBPH) method implemented in this package uses the predicted response in the absense of treatment in a second stage regression model, to allow us to examine whether an individual's predicted risk (their predicted response in the absense of treatment) affects the treatment effect.

Consider a classroom of students. We are testing whether students enrolled in an after-school program show a performance increase on an end-of-term standardized exam. It is relatively straightforward to test whether students enrolled in that program show an improvement on their exam scores. However, we may hypothesize that we would see little-to-no improvement amongst those students who would perform well on the test regardless of intervention, but will be a large benefit on those students who would perform poorly. The PBPH method addresses this.

Installation

pbph is not yet available on CRAN. To use, please install devtools and use install_github to obtain a working version.

install.packages("devtools")
devtools::install_github("josherrickson/pbph")
library(pbph)

Usage

A short example. Lets predict the effect of an afterschool program on an end-of-term exam on the eottest (fake) data.

data(eottest)
mod1 <- lm(test ~ gpa + male, data = eottest, subset = (afterschool == 0))
mod2 <- pbph(mod1, treatment = afterschool, data = eottest)
summary(mod2)
confint(mod2)

The negative coefficient (-.799) on pred shows evidence that students with lower predicted test score in the absense of treatment are showing a larger treatment effect than those with higher predicted test scores.

Development

Included are both a Makefile and an RStudio project file. Either can be used.

After cloning the repo, the first thing to do is ensure all dependencies are installed.

If using RStudio, after loading the project file, run

devtools::install_deps(dependencies = TRUE)

If using the Makefile, you can run

make dependencies

Additional useful Makefile commands include



josherrickson/epb documentation built on July 6, 2023, 9:12 p.m.