Conduct posterior sampling for normal population with normalized power prior. The initial prior \(\pi(\mu|\sigma^2)\) is a flat 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 \(\mu\) and \(\sigma^2\), Gibbs sampling is used.
NormalNPP_MCMC(Data.Cur, Data.Hist,
CompStat = list(n0 = NULL, mean0 = NULL, var0 = NULL,
n1 = NULL, mean1 = NULL, var1 = NULL),
prior = list(a = 1.5, 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 list of class "NPP" with five elements:
posterior of the model parameter \(\mu\).
posterior of the model parameter \(\sigma^2\).
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.
a vector of individual level current data.
a vector of individual level historical data.
a list of six elements(scalar) that represents the
"compatibility(sufficient) statistics" for model parameters.
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.
n0
is the sample size of historical data.
mean0
is the sample mean of the historical data.
var0
is the sample variance of the historical data.
n1
is the sample size of current data.
mean1
is the sample mean of the current data.
var1
is the sample variance of the current data.
a list of the hyperparameters in the prior for both \((\mu, \sigma^2)\) and \(\delta\). The form of the prior for model parameter \((\mu, \sigma^2)\) is \((1/\sigma^2)^a\). When \(a = 1\) it corresponds to the reference prior, and when \(a = 1.5\) it corresponds to the Jeffrey's prior.
a
is the power \(a\) in formula \((1/\sigma^2)^a\), the prior for \((\mu, \sigma^2)\) jointly.
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.
Zifei Han hanzifei1@gmail.com
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.
Berger, J.O. and Bernardo, J.M. (1992). On the development of reference priors. Bayesian Statistics 4: Proceedings of the Fourth Valencia International Meeting, Bernardo, J.M, Berger, J.O., Dawid, A.P. and Smith, A.F.M. eds., 35-60, Clarendon Press:Oxford.
Jeffreys, H. (1946). An Invariant Form for the Prior Probability in Estimation Problems. Proceedings of the Royal Statistical Society of London, Series A 186:453-461.
BerNPP_MCMC
;
MultinomialNPP_MCMC
;
PoissonNPP_MCMC
;
set.seed(1234)
NormalData0 <- rnorm(n = 100, mean= 20, sd = 1)
set.seed(12345)
NormalData1 <- rnorm(n = 50, mean= 30, sd = 1)
NormalNPP_MCMC(Data.Cur = NormalData1, Data.Hist = NormalData0,
CompStat = list(n0 = 100, mean0 = 10, var0 = 1,
n1 = 100, mean1 = 10, var1 = 1),
prior = list(a = 1.5, delta.alpha = 1, delta.beta = 1),
MCMCmethod = 'RW', rw.logit.delta = 1,
ind.delta.alpha= 1, ind.delta.beta= 1, nsample = 10000,
control.mcmc = list(delta.ini = NULL, burnin = 0, thin = 1))
Run the code above in your browser using DataLab