invertRIconfInt: Calculate treatment effect confidence intervals by inverting...

View source: R/invertRIconfInt.R

invertRIconfIntR Documentation

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

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.

Value

A list with elements

  • ci95: vector of treatment effects within the 95% confidence interval

  • ci90: vector of treatment effects within the 90% confidence interval

  • ci80: vector of treatment effects within the 80% confidence interval

Author(s)

Ryan T. Moore rtm@american.edu and Jonathan Homola homola@wustl.edu

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

# 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 = TRUE)
# age <- sample(seq(18, 55, 1), 50, replace = TRUE)
# treat <- sample(c(1, 2), 50, replace = TRUE)
# out <- treat + sample(seq(15, 20, 1), 50, replace = TRUE)
# df <- cbind(id, gender, age, out, treat)

# Check summary statistics for the created data
# aggregate(out ~ treat, df, 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"))


blockTools documentation built on Oct. 20, 2024, 1:08 a.m.