Model fitting using power priors for two groups (treatment and control group, no covariates) with fixed \(a_0\)
two.grp.fixed.a0(
data.type,
y.c,
n.c,
v.c,
historical = matrix(0, 1, 4),
prior.mu.c.shape1 = 1,
prior.mu.c.shape2 = 1,
nMC = 10000,
nBI = 250
)The function returns a S3 object with a summary method. If data.type is "Normal", posterior samples of \(\mu_c\), \(\tau\) and \(\tau_k\)'s (if historical data is given) are returned
in the list item named posterior.params.
For all other data types, two scalars, \(c_1\) and \(c_2\), are returned in the list item named posterior.params, representing the two parameters of the posterior distribution of \(\mu_c\).
For Bernoulli responses, the posterior distribution of \(\mu_c\) is beta(\(c_1\), \(c_2\)).
For Poisson responses, the posterior distribution of \(\mu_c\) is Gamma(\(c_1\), \(c_2\)) where \(c_2\) is the rate parameter.
For exponential responses, the posterior distribution of \(\mu_c\) is Gamma(\(c_1\), \(c_2\)) where \(c_2\) is the rate parameter.
Character string specifying the type of response. The options are "Normal", "Bernoulli", "Poisson" and "Exponential".
Sum of responses for the control group.
Sample size of the control group.
(For normal data only) sample variance of responses for the control group.
(Optional) matrix of historical dataset(s). If data.type is "Normal", historical is a matrix 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).
For all other data types, historical is a matrix with three 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 discounting parameter value \(a_0\) (between 0 and 1).
Each row represents a historical dataset.
First hyperparameter of the initial prior for \(\mu_c\). The default is 1. Does not apply if data.type is "Normal".
Second hyperparameter of the initial prior for \(\mu_c\). The default is 1. Does not apply if data.type is "Normal".
(For normal data only) number of iterations (excluding burn-in samples) for the Gibbs sampler. The default is 10,000.
(For normal data only) number of burn-in samples for the Gibbs sampler. The default is 250.
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.
If data.type is "Bernoulli", "Poisson" or "Exponential", a single response from the treatment group is assumed to follow Bern(\(\mu_t\)), Pois(\(\mu_t\)) or Exp(rate=\(\mu_t\)), respectively,
where \(\mu_t\) is the mean of responses for the treatment group. The distributional assumptions for the control group data are analogous.
If data.type is "Bernoulli", the initial prior for \(\mu_t\) is beta(prior.mu.t.shape1, prior.mu.t.shape2).
If data.type is "Poisson", the initial prior for \(\mu_t\) is Gamma(prior.mu.t.shape1, rate=prior.mu.t.shape2).
If data.type is "Exponential", the initial prior for \(\mu_t\) is Gamma(prior.mu.t.shape1, rate=prior.mu.t.shape2).
The initial priors used for the control group data are analogous.
If data.type is "Normal", the responses are assumed to follow \(N(\mu_c, \tau^{-1})\) where \(\mu_c\) is the mean of responses for the control group
and \(\tau\) is the precision parameter. Each historical dataset \(D_{0k}\) is assumed to have a different precision parameter \(\tau_k\).
The initial prior for \(\tau\) is the Jeffery's prior, \(\tau^{-1}\), and the initial prior for \(\tau_k\) is \(\tau_k^{-1}\). The initial prior for the \(\mu_c\) is the uniform improper prior.
Posterior samples are obtained through Gibbs sampling.
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
data.type <- "Bernoulli"
y.c <- 70
n.c <- 100
# Simulate three historical datasets
historical <- matrix(0, ncol=3, nrow=3)
historical[1,] <- c(70, 100, 0.3)
historical[2,] <- c(60, 100, 0.5)
historical[3,] <- c(50, 100, 0.7)
set.seed(1)
result <- two.grp.fixed.a0(data.type=data.type, y.c=y.c, n.c=n.c, historical=historical)
summary(result)
Run the code above in your browser using DataLab