# analyze2x2: Analyze 2 x 2 Table in the Presence of Unmeasured Confounding In SimpleTable: Bayesian Inference and Sensitivity Analysis for Causal Effects from 2 x 2 and 2 x 2 x K Tables in the Presence of Unmeasured Confounding

## Description

`analyze2x2` performs a causal Bayesian analysis of a 2 x 2 table in which it is assumed that unmeasured confounding is present. The binary treatment variable is denoted X = 0 (control), 1 (treatment); and the binary outcome variable is denoted Y = 0 (failure), 1 (success). The notation and terminology are from Quinn (2008).

## Usage

 ```1 2``` ```analyze2x2(C00, C01, C10, C11, a00, a01, a10, a11, b00, b01, b10, b11, c00, c01, c10, c11, nsamp = 50000) ```

## Arguments

 `C00` The number of observations in (X=0, Y=0) cell of the table. In other words, the number of observations that received control and failed. `C01` The number of observations in (X=0, Y=1) cell of the table. In other words, the number of observations that received control and succeeded. `C10` The number of observations in (X=1, Y=0) cell of the table. In other words, the number of observations that received treatment and failed. `C11` The number of observations in (X=1, Y=1) cell of the table. In other words, the number of observations that received treatment and succeeded. `a00` One of four parameters (with `a01`, `a10`, and `a11` governing the Dirichlet prior for theta (the joint probabilities of X and Y). This prior has the effect of adding `a00` - 1 observations to the (X=0, Y=0) cell of the table. `a01` One of four parameters (with `a00`, `a10`, and `a11` governing the Dirichlet prior for theta (the joint probabilities of X and Y). This prior has the effect of adding `a01` - 1 observations to the (X=0, Y=1) cell of the table. `a10` One of four parameters (with `a00`, `a01`, and `a11` governing the Dirichlet prior for theta (the joint probabilities of X and Y). This prior has the effect of adding `a10` - 1 observations to the (X=1, Y=0) cell of the table. `a11` One of four parameters (with `a00`, `a01`, and `a10` governing the Dirichlet prior for theta (the joint probabilities of X and Y). This prior has the effect of adding `a11` - 1 observations to the (X=1, Y=1) cell of the table. `b00` One of two parameters (with `c00`) governing the beta prior for the distribution of potential outcome types within the (X=0, Y=0) cell of the table. This prior adds the same information as would be gained from observing `b00` - 1 Helped units in the (X=0, Y=0) cell of the table. `b01` One of two parameters (with `c01`) governing the beta prior for the distribution of potential outcome types within the (X=0, Y=1) cell of the table. This prior adds the same information as would be gained from observing `b01` - 1 Always Succeed units in the (X=0, Y=1) cell of the table. `b10` One of two parameters (with `c10`) governing the beta prior for the distribution of potential outcome types within the (X=1, Y=0) cell of the table. This prior adds the same information as would be gained from observing `b10` - 1 Hurt units in the (X=1, Y=0) cell of the table. `b11` One of two parameters (with `c11`) governing the beta prior for the distribution of potential outcome types within the (X=1, Y=1) cell of the table. This prior adds the same information as would be gained from observing `b11` - 1 Always Succeed units in the (X=1, Y=1) cell of the table. `c00` One of two parameters (with `b00`) governing the beta prior for the distribution of potential outcome types within the (X=0, Y=0) cell of the table. This prior adds the same information as would be gained from observing `b00` - 1 Never Succeed units in the (X=0, Y=0) cell of the table. `c01` One of two parameters (with `b01`) governing the beta prior for the distribution of potential outcome types within the (X=0, Y=1) cell of the table. This prior adds the same information as would be gained from observing `c01` - 1 Hurt units in the (X=0, Y=1) cell of the table. `c10` One of two parameters (with `b10`) governing the beta prior for the distribution of potential outcome types within the (X=1, Y=0) cell of the table. This prior adds the same information as would be gained from observing `c10` - 1 Never Succeed units in the (X=1, Y=0) cell of the table. `c11` One of two parameters (with `b11`) governing the beta prior for the distribution of potential outcome types within the (X=1, Y=1) cell of the table. This prior adds the same information as would be gained from observing `b11` - 1 Helped units in the (X=1, Y=1) cell of the table. `nsamp` Size of the Monte Carlo sample used to summarize the posterior.

## Details

`analyze2x2` performs the Bayesian analysis of a 2 x 2 table described in Quinn (2008). `summary` and `plot` methods can be used to examine the output.

## Value

An object of class `SimpleTable`.

Kevin M. Quinn

## References

Quinn, Kevin M. 2008. “What Can Be Learned from a Simple Table: Bayesian Inference and Sensitivity Analysis for Causal Effects from 2 x 2 and 2 x 2 x K Tables in the Presence of Unmeasured Confounding.” Working Paper.

`ConfoundingPlot`, `analyze2x2xK`, `ElicitPsi`, `summary.SimpleTable`, `plot.SimpleTable`
 ``` 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 26 27 28 29 30 31``` ```## Not run: ## Example from Quinn (2008) ## (original data from Oliver and Wolfinger. 1999. ## ``Jury Aversion and Voter Registration.'' ## American Political Science Review. 93: 147-152.) ## ## Y=0 Y=1 ## X=0 19 143 ## X=1 114 473 ## ## uniform prior on the potential outcome distributions S.unif <- analyze2x2(C00=19, C01=143, C10=114, C11=473, a00=.25, a01=.25, a10=.25, a11=.25, b00=1, c00=1, b01=1, c01=1, b10=1, c10=1, b11=1, c11=1) summary(S.unif) plot(S.unif) ## a prior belief in an essentially negative monotonic treatment effect S.mono <- analyze2x2(C00=19, C01=143, C10=114, C11=473, a00=.25, a01=.25, a10=.25, a11=.25, b00=0.02, c00=10, b01=25, c01=3, b10=3, c10=25, b11=10, c11=0.02) summary(S.mono) plot(S.mono) ## End(Not run) ```