Conduct posterior sampling for Bernoulli population with normalized power prior. For the power parameter \(\delta\), a Metropolis-Hastings algorithm with either independence proposal, or a random walk proposal on its logit scale is used. For the model parameter \(p\), Gibbs sampling is used.
BerNPP_MCMC(Data.Cur = c(100, 50), Data.Hist = c(100, 50),
CompStat = list(n0 = NULL, y0 = NULL, n1 = NULL, y1 = NULL),
prior = list(p.alpha = 1, p.beta = 1, delta.alpha = 1, delta.beta = 1),
MCMCmethod = 'IND', rw.logit.delta = 0.1,
ind.delta.alpha = 1, ind.delta.beta = 1, nsample = 5000,
control.mcmc = list(delta.ini = NULL, burnin = 0, thin = 1))
a non-negative integer vector of two elements: c(number of success, number of failure) in the current data.
a non-negative integer vector of two elements: c(number of success, number of failure) in the historical data.
a list of four elements that represents the
"compatibility(sufficient) statistics" for \(p\).
Default is NULL
so the fitting will be based on
the data. If the CompStat
is provided then the inputs in
Data.Cur
and Data.Hist
will be ignored.
Note: in Bernoulli population providing CompStat
is equivalent to provide the data summary as in
Data.Cur
and Data.Cur
.
n0
is the number of trials in the historical data.
y0
is the number of successes in the historical data.
n1
is the number of trials in the current data.
y1
is the number of successes in the current data.
a list of the hyperparameters in the prior for both \(p\) and \(\delta\).
p.alpha
is the hyperparameter \(\alpha\) in the prior distribution \(Beta(\alpha, \beta)\) for \(p\).
p.beta
is the hyperparameter \(\beta\) in the prior distribution \(Beta(\alpha, \beta)\) for \(p\).
delta.alpha
is the hyperparameter \(\alpha\) in the prior distribution \(Beta(\alpha, \beta)\) for \(\delta\).
delta.beta
is the hyperparameter \(\beta\) in the prior distribution \(Beta(\alpha, \beta)\) for \(\delta\).
sampling method for \(\delta\) in MCMC. It can be either 'IND' for independence proposal; or 'RW' for random walk proposal on logit scale.
the stepsize(variance of the normal distribution) for the random walk proposal of logit \(\delta\).
Only applicable if MCMCmethod = 'RW'.
specifies the first parameter \(\alpha\) when
independent proposal \(Beta(\alpha, \beta)\) for \(\delta\) is used. Only applicable if MCMCmethod = 'IND'
specifies the first parameter \(\beta\) when
independent proposal \(Beta(\alpha, \beta)\) for \(\delta\) is used. Only applicable if MCMCmethod = 'IND'
specifies the number of posterior samples in the output.
a list of three elements used in posterior sampling.
delta.ini
is the initial value of \(\delta\) in MCMC sampling.
burnin
is the number of burn-ins. The output will only show MCMC samples after bunrin.
thin
is the thinning parameter in MCMC sampling.
A list of class "NPP" with four elements:
posterior of the model parameter \(p\).
posterior of the power parameter \(\delta\).
the acceptance rate in MCMC sampling for \(\delta\) using Metropolis-Hastings algorithm.
the deviance information criteria for model diagnostics.
The outputs include posteriors of the model parameter(s) and power parameter, acceptance rate in sampling \(\delta\), and the deviance information criteria.
Ibrahim, J.G., Chen, M.-H., Gwon, Y. and Chen, F. (2015). The Power Prior: Theory and Applications. Statistics in Medicine 34:3724-3749.
Duan, Y., Ye, K. and Smith, E.P. (2006). Evaluating Water Quality: Using Power Priors to Incorporate Historical Information. Environmetrics 17:95-106.
# NOT RUN {
BerNPP_MCMC(Data.Cur = c(493, 473), Data.Hist = c(680, 669),
prior = list(p.alpha = 0.5, p.beta = 0.5, delta.alpha = 1, delta.beta = 1),
MCMCmethod = 'RW', rw.logit.delta = 1, nsample = 5000,
control.mcmc = list(delta.ini = NULL, burnin = 2000, thin = 5))
# }
Run the code above in your browser using DataCamp Workspace