ivbounds {ivtools}R Documentation

Bounds for counterfactual outcome probabilities in instrumental variables scenarios

Description

ivbounds computes non-parametric bounds for counterfactual outcome probabilities in instrumental variables scenarios. Let YY, XX, and ZZ be the outcome, exposure, and instrument, respectively. YY and XX must be binary, whereas ZZ can be either binary or ternary. Ternary instruments are common in, for instance, Mendelian randomization. Let p(Yx=1)p(Y_x=1) be the counterfactual probability of the outcome, had all subjects been exposed to level xx. ivbounds computes bounds for the counterfactuals probabilities p(Y1=1)p(Y_1=1) and p(Y0=1)p(Y_0=1). Below, we define pyx.z=p(Y=y,X=xZ=x)p_{yx.z}=p(Y=y,X=x|Z=x).

Usage

ivbounds(data, Z, X, Y, monotonicity=FALSE, weights)

Arguments

data

either a data frame containing the variables in the model, or a named vector (p00.0,...,p11.1) when ZZ is binary, or a named vector (p00.0,...,p11.2) when ZZ is ternary.

Z

a string containing the name of the instrument ZZ in data if data is a data frame. In this case ZZ has to be coded as (0,1) when binary, and coded as (0,1,2) when ternary. Z is not specified if data is a vector of probabilities.

X

a string containing the name of the exposure XX in data if data is a data frame. In this case XX has to be coded as (0,1). X is not specified if data is a vector of probabilities.

Y

a string containing the name of the outcome YY in data if data is a data frame. In this case YY has to be coded as (0,1). Y is not specified if data is a vector of probabilities.

monotonicity

logical. It is sometimes realistic to make the monotonicity assumption zzXzXzz \geq z' \Rightarrow X_z \geq X_{z'}. Should the bounds be computed under this assumption?

weights

an optional vector of ‘prior weights’ to be used in the fitting process. Should be NULL or a numeric vector. Only applicable if data is a data frame.

Details

ivbounds uses linear programming techniques to bound the counterfactual probabilities p(Y1=1)p(Y_1=1) and p(Y0=1)p(Y_0=1). Bounds for a causal effect, defined as a contrast between these, are obtained by plugging in the bounds for p(Y1=1)p(Y_1=1) and p(Y0=1)p(Y_0=1) into the contrast. For instance, bounds for the causal risk difference p(Y1=1)p(Y0=1)p(Y_1=1)-p(Y_0=1) are obtained as [min{p(Y1=1)}max{p(Y0=1)},max{p(Y1=1)}min{p(Y0=1)}][min\{p(Y_1=1)\}-max\{p(Y_0=1)\},max\{p(Y_1=1)\}-min\{p(Y_0=1)\}]. In addition to the bounds, ivbounds evaluates the IV inequality

maxxymaxzpyx.z1.\max\limits_{x}\sum_{y}\max\limits_{z}p_{yx.z}\leq 1.

Value

An object of class "ivbounds" is a list containing

call

the matched call.

p0

a named vector with elements "min" and "max", containing the evaluated lower and upper bounds for p(Y0=1)p(Y_0=1), respectively.

p1

a named vector with elements "min" and "max", containing the evaluated lower and upper bounds for p(Y1=1)p(Y_1=1), respectively.

p0.symbolic

a named vector with elements "min" and "max", containing the lower and upper bounds for p(Y0=1)p(Y_0=1), respectively, on a symbolic form (i.e. as strings).

p1.symbolic

a named vector with elements "min" and "max", containing the lower and upper bounds for p(Y1=1)p(Y_1=1), respectively, on a symbolic form (i.e. as strings).

IVinequality

logical. Does the IV inequality hold?

conditions

a character vector containing the violated condiations, if IVinequality=FALSE.

Author(s)

Arvid Sjolander.

References

Balke, A. and Pearl, J. (1997). Bounds on treatment effects from studies with imperfect compliance. Journal of the American Statistical Association 92(439), 1171-1176.

Sjolander A., Martinussen T. (2019). Instrumental variable estimation with the R package ivtools. Epidemiologic Methods 8(1), 1-20.

Examples


##Vitamin A example from Balke and Pearl (1997).
n000 <- 74
n001 <- 34
n010 <- 0
n011 <- 12
n100 <- 11514
n101 <- 2385
n110 <- 0
n111 <- 9663
n0 <- n000+n010+n100+n110
n1 <- n001+n011+n101+n111

#with data frame...
data <- data.frame(Y=c(0,0,0,0,1,1,1,1), X=c(0,0,1,1,0,0,1,1), 
  Z=c(0,1,0,1,0,1,0,1))
n <- c(n000, n001, n010, n011, n100, n101, n110, n111)
b <- ivbounds(data=data, Z="Z", X="X", Y="Y", weights=n)
summary(b)

#...or with vector of probabilities
p <- n/rep(c(n0, n1), 4)
names(p) <- c("p00.0", "p00.1", "p01.0", "p01.1", 
  "p10.0", "p10.1", "p11.0", "p11.1") 
b <- ivbounds(data=p)
summary(b)




[Package ivtools version 2.3.0 Index]