Description Usage Arguments Details Value Author(s) References Examples
ivbounds
computes nonparametric bounds for counterfactual outcome probabilities
in instrumental variables scenarios. Let Y, X, and Z
be the outcome, exposure, and instrument, respectively. Y and X must be binary,
whereas Z can be either binary or ternary.
Ternary instruments are common in, for instance, Mendelian randomization.
Let p(Y_x=1) be the counterfactual probability of the outcome, had all
subjects been exposed to level x. ivbounds
computes bounds for the
counterfactuals probabilities p(Y_1=1) and p(Y_0=1). Below, we define
p_{yx.z}=p(Y=y,X=xZ=x).
1 
data 
either a data frame containing the variables in the model, or a named vector

Z 
a string containing the name of the instrument Z in 
X 
a string containing the name of the exposure X in 
Y 
a string containing the name of the outcome Y in 
monotonicity 
logical. It is sometimes realistic to make the monotonicity assumption z ≥q z' \Rightarrow X_z ≥q 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 
ivbounds
uses linear programming techniques to bound the counterfactual probabilities
p(Y_1=1) and p(Y_0=1). Bounds for a causal effect, defined as a contrast between these,
are obtained by plugging in the bounds for p(Y_1=1) and p(Y_0=1) into the
contrast. For instance, bounds for the causal risk difference p(Y_1=1)p(Y_0=1)
are obtained as [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
\max\limits_{x}∑_{y}\max\limits_{z}p_{yx.z}≤q 1.
An object of class "ivbounds"
is a list containing
call 
the matched call. 
p0 
a named vector with elements 
p1 
a named vector with elements 
p0.symbolic 
a named vector with elements 
p1.symbolic 
a named vector with elements 
IVinequality 
logical. Does the IV inequality hold? 
conditions 
a character vector containing the violated condiations, if 
Arvid Sjolander.
Balke, A. and Pearl, J. (1997). Bounds on treatment effects from studies with imperfect compliance. Journal of the American Statistical Association 92(439), 11711176.
Sjolander A., Martinussen T. (2019). Instrumental variable estimation with the R package ivtools. Epidemiologic Methods 8(1), 120.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25  ##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)

Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.