# Bayesian Augmented Control for Binary Responses

### Description

Calling JAGS to implement BAC for binary responses

### Usage

1 2 3 4 |

### Arguments

`yh, nh` |
Vector of the numbers of events (subjects) in the historical trial(s). Must be of equal length. |

`n1, n2` |
Number of subjects in the control or treatment arm of the current trial. |

`y1.range, y2.range` |
Number of events in control or treatment arm of the current trial. See "Details". |

`n.chain` |
Controls the number of posterior samples. Each chain contains 20,000 samples. |

`tau.alpha, tau.beta` |
Hyperparameters of the inverse gamma distribution controling the extent of borrowing. |

`prior.type` |
Type of prior on control groups. Currenly, only the inverse-gamma prior is implemented. |

`criterion.type` |
Type of posterior quantities to be monitored. See "Details." |

`prob.threshold` |
For |

`sim.mode` |
Simulation duration reduces greatly in |

### Details

There are two types of posterior quantities for
`criterion.type`

argument. With `"diff"`

option, the quantity
computed is *p_{T} - p_{C}*; with `"prob,"`

such quantity is
*pr(p_{T} - p_{C}>Δ)*, where *Δ* is specified by
`prob.threshold`

argument.

By default, `y1.range`

and `y2.range`

cover all possible outcomes
and should be left unspecified in most cases. However, when `n1`

and/or `n2`

is fairly large, it is acceptable to use a reduced range
that covers the outcomes that are most likely (e.g., within 95% CI) to be
observed. This may help shorten the time to run MCMC.

Another way that can greatly shorten the MCMC running time is to specify
`"express"`

mode in `sim.mode`

argument. Express mode reduces the
number of simulations from `length(y1.range)*length(y2.range)`

to
`length(y1.range)+length(y2.range)`

. Express mode is proper when the
treatment arm rate is independent of control arm rate.

### Value

An object of class "BAC".

### Author(s)

Hongtao Zhang

### Examples

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | ```
## Not run:
library(BACCT)
#borrow from 3 historical trials#
yh = c(11,300,52);nh = c(45,877,128)
#specify current trial sample sizes#
n1 = 20;n2 = 30
#Difference criterion type in full simulation mode#
obj1 = BAC_binom(yh=yh,nh=nh,n1=n1,n2=n2,n.chain=5,
criterion.type="diff",sim.mode="full")
#Probability criterion type in express simulation mode#
obj2 = BAC_binom(yh=yh,nh=nh,n1=n1,n2=n2,n.chain=5,
criterion.type="prob",prob.threshold=0.1,sim.mode="express")
#S3 method for class "BAC"
summary(obj1)
## End(Not run)
``` |