ri (version 0.9)

genprobexact: Production of exact probabilities of treatment assignment for blocked, clustered designs

Description

Function takes a blocking variable and a clustering variable and yields exact probabilities of treatment under complete randomization of clusters within blocks

Usage

genprobexact(Z, blockvar = NULL, clustvar = NULL)

Arguments

Z
binary vector (0 or 1) of length N, treatment indicator
blockvar
positive integer vector of length N, with unique values indicating different blocks

clustvar
positive integer vector of length N, with unique values indicating different clusters

Value

numeric vector with values within the (0,1) interval of length N, probability of treatment assignment

References

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

See Also

genprob

Examples

Run this code
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)
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
ate <- estate(y,Z,prob=probs) # estimate the ATE; estimated ATE=2

Run the code above in your browser using DataLab