title: "Peters-Belson with Prognostic Heterogeneity"
author: "Josh Errickson"
date: "r Sys.Date()
"
output: rmarkdown::pdf_document
vignette: >
%\VignetteIndexEntry{Peters-Belson with Prognostic Heterogeneity}
%\VignetteEngine{knitr::rmarkdown}
%\VignetteEncoding{UTF-8}
knitr::opts_chunk$set(collapse = TRUE, prompt = TRUE) library(pbph)
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 (-.4885) on pred
shows evidence that students with lower predicted test score in the absence of treatment are showing a larger treatment effect than those with higher predicted test scores.
data(salesdata) mod1 <- glm(sale ~ experience + previoussales, data = salesdata, subset = (newtechnique == 0), family = binomial) mod2 <- pbph(mod1, treatment = newtechnique, data = salesdata) summary(mod2) confint(mod2)
We implement support for clusters by overloading meat
(and sandwich
) from the sandwich
package and adding a cluster
argument.
mod1 <- lm(test ~ gpa + male, data = eottest, subset = (afterschool == 0)) mod2 <- pbph(mod1, treatment = afterschool, data = eottest, cluster = class) summary(mod2) confint(mod2)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.