bpbounds {bpbounds} R Documentation

Nonparametric Bounds for the Average Causal Effect due to Balke and Pearl.

Description

Nonparametric Bounds for the Average Causal Effect due to Balke and Pearl.

Usage

bpbounds(p, t = NULL, fmt = "trivariate")


Arguments

 p Object of class "table" containing either cell counts or conditional probabilities. For trivariate data these are for the phenotype/treatment-outcome association given Z, i.e. P(X, Y | Z). Cell counts could be generated from xtabs(~ x + y + z, data = data). And then conditional probabilities obatained by calling prop.table(..., margins = 3) on your object from xtabs(). If you only know the conditional probabilities you can enter these, e.g. for the Balke and Pearl Vitamin A example: cp = c(.0064, 0, .9936, 0, .0028, .001, .1972, .799) tabp = as.table(array( cp, dim = c(2, 2, 2), dimnames = list( x = c(0, 1), y = c(0, 1), z = c(0, 1) ) ))  And then call bpbounds() using this object. For bivariate data this object contains cell conditional probabilities for the outcome-instrument (Y|Z) association. t Specified for bivariate data. Object with treatment/phenotype-instrument cell counts or conditional probabilities, i.e. (X|Z). fmt A character string which sould be either "bivariate" (i.e. X, Z in one dataset and Y, Z in another dataset) or "trivariate" (X, Y, Z in the same dataset).

Value

List with the following elements:

fmt

whether the data is bivariate or trivariate

nzcats

2 or 3, the no. instrument categories

inequality

Logical, indicating whether the IV inquality is satisfied

bplb

Lower bound of ACE

bpub

Upper bound of ACE

bplower

Vector of lower bound probabilities

bpupper

Vector of upper bound probabilities

p11low

Lower bound of P(Y=1|do(X=1))

p11upp

Upper bound of P(Y=1|do(X=1))

p10low

Lower bound of P(Y=1|do(X=0))

p10upp

Upper bound of P(Y=1|do(X=0))

p11lower

Vector of probabilities for lower bound of P(Y=1|do(X=1))

p11upper

Vector of probabilities for upper bound of P(Y=1|do(X=1))

p10lower

Vector of probabilities for lower bound of P(Y=1|do(X=0))

p10upper

Vector of probabilities for upper bound of P(Y=1|do(X=0))

crrlb

Lower bound of CRR

crrub

Upper bound of CRR

monoinequality

Logical, indicating whether the monoticity inequality is satisfied

monobplb

Lower bound of ACE assuming monotonicity

monobpub

Upper bound of ACE assuming monotonicity

monobplower

Vector of probabilities for lower bound of ACE assuming monotonicity

monobpupper

Vector of probabilities for upper bound of ACE assuming monotonicity

monop11low

Lower bound of P(Y=1|do(X=1)) assuming monotonicity

monop11upp

Upper bound of P(Y=1|do(X=1)) assuming monotonicity

monop10low

Lower bound of P(Y=1|do(X=0)) assuming monotonicity

monop10upp

Upper bound of P(Y=1|do(X=0)) assuming monotonicity

monop11lower

Vector for corresponding bound above

monop11upper

Vector for corresponding bound above

monop10lower

Vector for corresponding bound above

monop10upper

Vector for corresponding bound above

monocrrlb

Lower bound of CRR assuming monotonicity

monocrrub

Upper bound of CRR assuming monotonicity

Examples


# Vitamin A example, using cell counts

require(tidyr)
require(bpbounds)

tab1dat <- data.frame(
z = c(0, 0, 1, 1, 1, 1, 0, 0),
x = c(0, 0, 0, 0, 1, 1, 1, 1),
y = c(0, 1, 0, 1, 0, 1, 0, 1),
freq = c(74, 11514, 34, 2385, 12, 9663, 0, 0)
)

tab1inddat = uncount(tab1dat, freq)
xt = xtabs(~ x + y + z, data = tab1inddat)
p = prop.table(xt, margin = 3)
bpres = bpbounds(p)
sbpres = summary(bpres)
print(sbpres)

# Vitamin A example, using conditional probabilities

require(bpbounds)
cp = c(.0064, 0, .9936, 0, .0028, .001, .1972, .799)
tabp = as.table(array(
cp,
dim = c(2, 2, 2),
dimnames = list(
x = c(0, 1),
y = c(0, 1),
z = c(0, 1)
)
))
bpbounds(tabp)



[Package bpbounds version 0.1.5 Index]