resresplot: Produces residual-residual (added-variable) plot

Description Usage Arguments Value Author(s) References See Also Examples

View source: R/resresplot.R

Description

Residualizes the outcome variable and the treatment variable with covariates (via inverse probability weighted least squares regression) and plots the relationship. When weights are applied, the graph shows the relative weighting of each observation

Usage

1
resresplot(Y, Z, X, prob = NULL, scale = 1)

Arguments

Y

numeric vector of length N, outcome variable

Z

binary vector (0 or 1) of length N, treatment indicator

X

N-by-k numeric matrix of covariates for regression adjustment

prob

numeric vector within the (0,1) interval of length N, probability of treatment assignment, as outputted by genprob() or genprobexact(). When prob=NULL (the default), assumes uniform probability of assignment to treatment equal to the mean of Z

scale

a scalar parameter controlling the size of the plotted points

Value

produces a plot of residualized and weighted values

Author(s)

Peter M. Aronow <peter.aronow@yale.edu>; Cyrus Samii <cds2083@nyu.edu>

References

Gerber, Alan S. and Donald P. Green. 2012. Field Experiments: Design, Analysis, and Interpretation. New York: W.W. Norton.

See Also

estate

Examples

1
2
3
4
5
6
7
8
9
y <- c(8,6,2,0,3,1,1,1,2,2,0,1,0,2,2,4,1,1) 
Z <- c(1,1,0,0,1,1,0,0,1,1,1,1,0,0,1,1,0,0)
X <- c(1:18)
cluster <- c(1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9)
block <- c(rep(1,4),rep(2,6),rep(3,8))

probs <- genprobexact(Z,block,cluster) # generate probability of assignment

resresplot(y,Z,X,prob=probs,scale=3) # produce res-res plot

Example output



ri documentation built on May 2, 2019, 6:51 a.m.