Description Usage Arguments Details Value Author(s) References See Also Examples
Takes a permutation matrix and estimates the probabilities of treatment assignment for each unit
1 | genprob(perms)
|
perms |
N-by-k permutation matrix as produced by |
genprob
is NOT intended to be used for complete randomization of clusters within blocks – instead, it takes an arbitrary permutation matrix and computes the proportions of random assignments for which each unit is in treatment. For simpler designs, genpermsexact
should be used.
N-length numeric vector of values within the (0,1) interval, probability of treatment assignment
Peter M. Aronow <peter.aronow@yale.edu>; Cyrus Samii <cds2083@nyu.edu>
Gerber, Alan S. and Donald P. Green. 2012. Field Experiments: Design, Analysis, and Interpretation. New York: W.W. Norton.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | ## Rejected randomization scheme: reject if and only if there is significant imbalance
X <- c(1:200)
randfun <- function() {
teststat <- -1
while (teststat < 0.05) {
Zri <- sample(c(rep(0,180),rep(1,20))) # imbalanced design
fstat <- summary(lm(Zri~X))$fstatistic
teststat <- pf(fstat[1],fstat[2],fstat[3],lower.tail=FALSE) # extract F-test p-value
}
return(Zri)
}
perms <- genperms.custom(numiter=10000, randfun=randfun) # generate permutations
probs <- genprob(perms) # generate approximate probabilities from permutation matrix
cor(probs,(X-mean(X))^2) # observations with extreme X are less likely to be treated
|
[1] -0.1480451
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.