# two.grp.fixed.a0: Model fitting for two groups (treatment and control group, no... In BayesPPD: Bayesian Power Prior Design

## Description

Model fitting using power priors for two groups (treatment and control group, no covariates) with fixed a_0 when outcome follows Normal distribution

## Usage

 ```1 2 3 4 5 6 7 8``` ```two.grp.fixed.a0( y.c, n.c, v.c, historical = matrix(0, 1, 4), nMC = 10000, nBI = 250 ) ```

## Arguments

 `y.c` Sum of responses (assumed to follow Normal distribution) for the control group. `n.c` Sample size of the control group. `v.c` Sample variance of responses for the control group. `historical` (Optional) matrix of historical dataset(s) with four columns: The first column contains the sum of responses for the control group. The second column contains the sample size of the control group. The third column contains the sample variance of responses for the control group. The fourth column contains the discounting parameter value a_0 (between 0 and 1). Each row represents a historical dataset. `nMC` Number of iterations (excluding burn-in samples) for the Gibbs sampler. The default is 10,000. `nBI` Number of burn-in samples for the Gibbs sampler. The default is 250.

## Details

The power prior is applied on the data of the control group only. Therefore, only summaries of the responses of the control group need to be entered.

The responses are assumed to follow N(μ_c, τ^{-1}) where μ_c is the mean of responses for the control group and τ is the precision parameter. Each historical dataset D_{0k} is assumed to have a different precision parameter τ_k. The initial prior for τ is the Jeffery's prior, τ^{-1}, and the initial prior for τ_k is τ_k^{-1}. The initial prior for the μ_c is the uniform improper prior. Posterior samples are obtained through Gibbs sampling.

## Value

Posterior samples of μ_c, τ and τ_k's (if historical data is given) are returned.

## References

Chen, Ming-Hui, et al. "Bayesian design of noninferiority trials for medical devices using historical data." Biometrics 67.3 (2011): 1163-1170.

`power.two.grp.fixed.a0`
 ``` 1 2 3 4 5 6 7 8 9 10 11 12``` ```y.c <- 200 # The responses are assumed to follow normal distribution n.c <- 100 v.c <- 2 # Simulate three historical datasets historical <- matrix(0, ncol=4, nrow=3) historical[1,] <- c(200, 100, 2, 0.3) historical[2,] <- c(300, 100, 2, 0.5) historical[3,] <- c(400, 100, 2, 0.7) set.seed(1) result <- two.grp.fixed.a0(y.c, n.c, v.c, historical, nMC=10000, nBI=250) ```