Nonparametric bounds for the average causal effect: bpbounds examples

Tom Palmer

Lancaster University

Roland Ramsahai

Vanessa Didelez

Leibniz BIPS and University of Bremen

Nuala Sheehan

University of Leicester



This short vignette demonstrates the use of the bpbounds package. This is a R implementation of the of the nonparametric bounds for the average causal effect of Balke and Pearl (1997) and some extensions. Currently this R package is a port of our bpbounds Stata package (Palmer et al. (2011)). The code implements the approach of calculating the bounds outlined by Ramsahai (2007), Ramsahai (2008), and Ramsahai (2012).

We start by loading our package and the others needed for the code in this vignette.

Features of the bpbounds package

Currently the package has one function, bpbounds(), which can accommodate the four scenarios implemented in our Stata command. These are to calculate the bounds for a binary outcome, a binary treatment/phenotype, and:

  • a binary instrumental variable;
  • a 3 category instrumental variable, e.g. a genotype in Mendelian randomization;

Bounds for these scenarios can be calculated with either

  • trivariate data (in which all three variables are measured in one dataset);
  • or bivariate data (in which the treatment/phenotype and instrument are measured in one dataset and the outcome and instrument are measured in another sample).

Vitamin A supplementation example

This example is taken from Table 1 of Balke and Pearl (1997). It is from a study of Vitamin A supplementation consisting of children in 450 villages. Of these, 221 villages were assigned to control and 229 to the treatment. The outcome was mortality.

First we setup a data.frame of cell counts and convert this into a table. Here we follow the notation that x is the received treatment, y is the outcome, and z is the randomized treatment (the instrumental variable).

Next we use prop.table() to calculate the conditional probabilities, \(P(Y,X|Z)\), and then run bpbounds() assuming the data is trivariate. Although we could call bpbounds() using the table of cell counts xt directly, i.e. bpbounds(xt).

Therefore, the average causal effect is bounded between -0.1946 and 0.0054. The estimate of the ACE is found as \[\text{ACE} = \frac{\text{cov}(Y,Z)}{\text{cov}(X,Z)}\] as follows.

Mendelian randomization example

Mendelian randomization is an approach in epidemiology due to Davey Smith and Ebrahim (2003) in which genotypes established to be robustly associated with phenotypes are used as instrumental variables in order to better estimate the causal effect of the phenotype on a disease outcome.

This example uses data from Meleady et al. (2003). It is trivariate data with 3 category instrument and binary phenotype and outcomes. The instrument is the 677CT polymorphism (rs1801133) in the Methylenetetrahydrofolate Reductase gene, involved in folate metabolism, as an instrumental variable to investigate the effect of homocysteine on cardiovascular disease.

The data are presented to us as conditional probabilities, so we take care to enter them in the correct position in the vectors.

We see that in this example the monotonicity inequality is not satisfied.

Simulated example that does not satisy the IV conditions

This example recreates that found in section 8.3 of our Stata Journal paper which uses simulated data to show that the IV inequality does not always detect violations to the underlying model assumptions. We simulate two outcomes, y1 and y2, for which the assumptions are violated because there is a direct effect of the instrument, z, on the outcome. However, the direct effect on y2 is much smaller in magnitude than the direct effect on y1.

Due to the strong direct effect of the instrument on the outcome, both the instrumental variable and monotonicity inequalities are not satisifed.

However, with the weaker direct effect we see that both are satisfied when the true underlying data generating model does not satisfy the instrumental variable assumptions.


In conclusion, we have demonstrated the use of our bpbounds package implementing nonparametric bounds for the average causal effect for a range of data scenarios.


Balke, A., and J. Pearl. 1997. “Bounds on treatment effects from studies with imperfect compliance.” Journal of the American Statistical Association 92 (439): 1172–6.

Davey Smith, G., and S. Ebrahim. 2003. “‘Mendelian randomization’: can genetic epidemiology contribute to understanding environmental determinants of disease.” International Journal of Epidemiology 32 (1): 1–22.

Meleady, Raymond, Per M Ueland, Henk Blom, Alexander S Whitehead, Helga Refsum, Leslie E Daly, Stein Emil Vollset, et al. 2003. “Thermolabile Methylenetetrahydrofolate Reductase, Homocysteine, and Cardiovascular Disease Risk: The European Concerted Action Project.” The American Journal of Clinical Nutrition 77 (1): 63–70.

Palmer, T. M., R. R. Ramsahai, V. Didelez, and N. A Sheehan. 2011. “Nonparametric Bounds for the Causal Effect in a Binary Instrumental-Variable Model.” Stata Journal 11 (3): 345–67.

Ramsahai, R. R. 2007. “Causal Bounds and Instruments.” In Proceedings of the Twenty-Third Annual Conference on Uncertainty in Artificial Intelligence (Uai-07), 310–17. Corvallis, Oregon: AUAI Press.

———. 2008. “Causal Inference with Instruments and Other Supplementary Variables.” PhD thesis, Oxford, UK: Department of Statistics, University of Oxford.

———. 2012. “Causal Bounds and Observable Constraints for Non-Deterministic Models.” Journal of Machine Learning Research 13: 829–48.