Learn R Programming

blockTools (version 0.6-3)

invertRIconfInt: Calculate treatment effect confidence intervals by inverting the randomization test

Description

Using an output object from seqblock or any other matrix or dataframe that includes a treatment and an outcome variable for multiple units, as well as blocking and non-blocking variables for the respective unit(s), invertRIconfInt calculates treatment effect confidence intervals by inverting the randomization inference test.

Usage

invertRIconfInt(dat, outcome.var, tr.var, tau.abs.min = -1, tau.abs.max = 1, tau.length = 10, n.sb.p = 100, id.vars, id.vals, exact.vars = NULL, exact.vals = NULL, exact.restr = NULL, exact.alg = "single", covar.vars = NULL, covar.vals = NULL, covar.restr = NULL, covars.ord = NULL, n.tr = 2, tr.names = NULL, assg.prob = NULL, seed = NULL, seed.dist, assg.prob.stat = NULL, trim = NULL, assg.prob.method = NULL, assg.prob.kfac = NULL, distance = "mahalanobis", file.name = "sbout.RData", query = FALSE, verbose = TRUE)

Arguments

dat
a matrix or dataframe containing the names and values of the different blocking and non-blocking variables, as well as each unit's treatment assignment and outcome
outcome.var
a string specifying the name of the outcome variable
tr.var
a string specifying the name of the treatment variable
tau.abs.min
lower bound of the range across which the confidence intervals will be computed
tau.abs.max
upper bound of the range across which the confidence intervals will be computed
tau.length
the number of (evenly spaced) possible treatment effects across the range specified by tau.abs.min and tau.abs.max for which location inside or outside the confidence intervals will be computed
n.sb.p
the number of times that sequential blocking will be performed on the dataset
id.vars
see the seqblock documentation
id.vals
see the seqblock documentation
exact.vars
see the seqblock documentation
exact.vals
see the seqblock documentation
exact.restr
see the seqblock documentation
exact.alg
see the seqblock documentation
covar.vars
see the seqblock documentation
covar.vals
see the seqblock documentation
covar.restr
see the seqblock documentation
covars.ord
see the seqblock documentation
n.tr
see the seqblock documentation
tr.names
see the seqblock documentation
assg.prob
see the seqblock documentation
seed
see the seqblock documentation
seed.dist
see the seqblock documentation
assg.prob.stat
see the seqblock documentation
trim
see the seqblock documentation
assg.prob.method
see the seqblock documentation
assg.prob.kfac
see the seqblock documentation
distance
see the seqblock documentation
file.name
see the seqblock documentation
query
see the seqblock documentation
verbose
see the seqblock documentation

Value

A list with elements

Details

invertRIconfInt takes a data matrix (or data frame) containing names and values of different blocking and non-blocking variables, as well as each unit's treatment assignment and outcome as input and returns a list of treatment effect confidence intervals.

Apart from specifying the treatment and outcome variable, the user can set all other arguments to seqblock when running invertRIconfInt. The function will then calculate the confidence intervals by employing a method described in Ho and Imai (2006), which inverts Fisher's exact test. The resulting confidence intervals are distribution-free, nonparametric and have accurate coverage probabilities.

References

Moore, Ryan T. and Sally A. Moore. 2013. "Blocking for Sequential Political Experiments." Political Analysis 21(4): 507-523.

Ho, Daniel E., and Kosuke Imai. 2006. "Randomization inference with natural experiments: An analysis of ballot effects in the 2003 California recall election." Journal of the American Statistical Association 101(475): 888-900.

See Also

seqblock

Examples

Run this code
## Create an example data matrix with 50 observations that contains an ID variable, 
##   a dummy variable indicating gender, an age variable (between 18 and 55), a 
##   treatment variable and an outcome variable (between 15 and 20). 
## id <- seq(1,50,1)
## gender <- sample(c(1,2),50,replace=T)
## age <- sample(seq(18,55,1),50,replace=T)
## treat <- sample(c(1,2),50,replace=T)
## out <- treat + sample(seq(15,20,1),50,replace=T)
## data <- cbind(id, gender, age, out, treat)

## Check summary statistics for the created data
## aggregate(out~treat, data, mean)

## Run invertRIconfInt()
## invertRIconfInt(data, outcome.var="out", tr.var="treat", tau.abs.min = -3, 
##  tau.abs.max = 3, id.vars = "id", id.vals = "id", exact.vars = c("gender", "age"), 
##  exact.vals = c("gender", "age"))

Run the code above in your browser using DataLab