Type: | Package |
Title: | Normalized Power Prior Bayesian Analysis |
Version: | 0.6.0 |
Author: | Zifei Han, Qiang Zhang, Tianyu Bai Yuyan Duan and Keying Ye |
Maintainer: | Zifei Han <hanzifei1@gmail.com> |
Description: | Posterior sampling in several commonly used distributions using normalized power prior as described in Duan, Ye and Smith (2006) <doi:10.1002/env.752> and Ibrahim et.al. (2015) <doi:10.1002/sim.6728>. Sampling of the power parameter is achieved via either independence Metropolis-Hastings or random walk Metropolis-Hastings based on transformation. |
License: | GPL-2 | GPL-3 [expanded from: GPL (≥ 2)] |
LazyData: | true |
Depends: | R (≥ 3.5.0) |
Encoding: | UTF-8 |
NeedsCompilation: | no |
Packaged: | 2023-12-12 04:10:43 UTC; zifeihan |
Repository: | CRAN |
Date/Publication: | 2023-12-12 04:20:05 UTC |
MCMC Sampling for Bernoulli Population with Multiple Historical Data using Normalized Power Prior
Description
Incorporate multiple historical data sets for posterior sampling of a Bernoulli population using the normalized power prior. The Metropolis-Hastings algorithm, with either an independence proposal or a random walk proposal on the logit scale, is applied for the power parameter \delta
. Gibbs sampling is utilized for the model parameter p
.
Usage
BerMNPP_MCMC1(n0, y0, n, y, prior_p, prior_delta_alpha,
prior_delta_beta, prop_delta_alpha, prop_delta_beta,
delta_ini, prop_delta, rw_delta, nsample, burnin, thin)
Arguments
n0 |
A non-negative integer vector representing the number of trials in historical data. |
y0 |
A non-negative integer vector denoting the number of successes in historical data. |
n |
A non-negative integer indicating the number of trials in the current data. |
y |
A non-negative integer for the number of successes in the current data. |
prior_p |
a vector of the hyperparameters in the prior distribution |
prior_delta_alpha |
a vector of the hyperparameter |
prior_delta_beta |
a vector of the hyperparameter |
prop_delta_alpha |
a vector of the hyperparameter |
prop_delta_beta |
a vector of the hyperparameter |
delta_ini |
the initial value of |
prop_delta |
the class of proposal distribution for |
rw_delta |
the stepsize(variance of the normal distribution) for the random walk proposal of logit |
nsample |
specifies the number of posterior samples in the output. |
burnin |
the number of burn-ins. The output will only show MCMC samples after bunrin. |
thin |
the thinning parameter in MCMC sampling. |
Details
The outputs include posteriors of the model parameter(s) and power parameter, acceptance rate in sampling \delta
.
The normalized power prior distribution is
\frac{\pi_0(\delta)\pi_0(\theta)\prod_{k=1}^{K}L(\theta|D_{0k})^{\delta_{k}}}{\int \pi_0(\theta)\prod_{k=1}^{K}L(\theta|D_{0k})^{\delta_{k}} d\theta}.
Here \pi_0(\delta)
and \pi_0(\theta)
are the initial prior distributions of \delta
and \theta
, respectively. L(\theta|D_{0k})
is the likelihood function of historical data D_{0k}
, and \delta_k
is the corresponding power parameter.
Value
A list of class "NPP" comprising:
acceptrate |
Acceptance rate in MCMC sampling for |
p |
Posterior distribution of the model parameter |
delta |
Posterior distribution of the power parameter |
Author(s)
Qiang Zhang zqzjf0408@163.com
References
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.
See Also
BerMNPP_MCMC2
;
BerOMNPP_MCMC1
;
BerOMNPP_MCMC2
Examples
BerMNPP_MCMC1(n0 = c(275, 287), y0 = c(92, 125), n = 39, y = 17,
prior_p = c(1/2,1/2), prior_delta_alpha = c(1/2,1/2),
prior_delta_beta = c(1/2,1/2),
prop_delta_alpha = c(1,1)/2, prop_delta_beta = c(1,1)/2,
delta_ini = NULL, prop_delta = "IND",
nsample = 2000, burnin = 500, thin = 2)
MCMC Sampling for Bernoulli Population of multiple historical data using Normalized Power Prior
Description
Multiple historical data are combined individually.
The NPP of multiple historical data is the product of the NPP of each historical data.
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.
Usage
BerMNPP_MCMC2(n0, y0, n, y, prior_p, prior_delta_alpha, prior_delta_beta,
prop_delta_alpha, prop_delta_beta, delta_ini, prop_delta,
rw_delta, nsample, burnin, thin)
Arguments
n0 |
a non-negative integer vector: number of trials in historical data. |
y0 |
a non-negative integer vector: number of successes in historical data. |
n |
a non-negative integer: number of trials in the current data. |
y |
a non-negative integer: number of successes in the current data. |
prior_p |
a vector of the hyperparameters in the prior distribution |
prior_delta_alpha |
a vector of the hyperparameter |
prior_delta_beta |
a vector of the hyperparameter |
prop_delta_alpha |
a vector of the hyperparameter |
prop_delta_beta |
a vector of the hyperparameter |
delta_ini |
the initial value of |
prop_delta |
the class of proposal distribution for |
rw_delta |
the stepsize (variance of the normal distribution) for the random walk proposal of logit |
nsample |
specifies the number of posterior samples in the output. |
burnin |
the number of burn-ins. The output will only show MCMC samples after burnin. |
thin |
the thinning parameter in MCMC sampling. |
Details
The outputs include posteriors of the model parameter(s) and power parameter, acceptance rate in sampling \delta
.
The normalized power prior distribution is
\pi_0(\delta)\prod_{k=1}^{K}\frac{\pi_0(\theta)L(\theta|D_{0k})^{\delta_{k}}}{\int \pi_0(\theta)L(\theta|D_{0k})^{\delta_{k}} d\theta}.
Here \pi_0(\delta)
and \pi_0(\theta)
are the initial prior distributions of \delta
and \theta
, respectively. L(\theta|D_{0k})
is the likelihood function of historical data D_{0k}
, and \delta_k
is the corresponding power parameter.
Value
A list of class "NPP" with three elements:
acceptrate |
the acceptance rate in MCMC sampling for |
p |
posterior of the model parameter |
delta |
posterior of the power parameter |
Author(s)
Qiang Zhang zqzjf0408@163.com
References
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.
See Also
BerMNPP_MCMC1
;
BerOMNPP_MCMC1
;
BerOMNPP_MCMC2
Examples
BerMNPP_MCMC2(n0 = c(275, 287), y0 = c(92, 125), n = 39, y = 17,
prior_p=c(1/2,1/2), prior_delta_alpha=c(1/2,1/2),
prior_delta_beta=c(1/2,1/2), prop_delta_alpha=c(1,1)/2,
prop_delta_beta=c(1,1)/2, delta_ini=NULL, prop_delta="IND",
nsample = 2000, burnin = 500, thin = 2)
MCMC Sampling for Bernoulli Population using Normalized Power Prior
Description
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.
Usage
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))
Arguments
Data.Cur |
a non-negative integer vector of two elements: c(number of trials, number of successes) in the current data. |
Data.Hist |
a non-negative integer vector of two elements: c(number of trials, number of successes) in the historical data. |
CompStat |
a list of four elements that represents the
"compatibility(sufficient) statistics" for
|
prior |
a list of the hyperparameters in the prior for both
|
MCMCmethod |
sampling method for |
rw.logit.delta |
the stepsize(variance of the normal distribution) for the random walk proposal of logit |
ind.delta.alpha |
specifies the first parameter |
ind.delta.beta |
specifies the first parameter |
nsample |
specifies the number of posterior samples in the output. |
control.mcmc |
a list of three elements used in posterior sampling.
|
Details
The outputs include posteriors of the model parameter(s) and power parameter, acceptance rate in sampling \delta
, and
the deviance information criteria.
Value
A list of class "NPP" with four elements:
p |
posterior of the model parameter |
delta |
posterior of the power parameter |
acceptance |
the acceptance rate in MCMC sampling for |
DIC |
the deviance information criteria for model diagnostics. |
Author(s)
Zifei Han hanzifei1@gmail.com
References
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.
See Also
MultinomialNPP_MCMC
;
NormalNPP_MCMC
;
PoissonNPP_MCMC
Examples
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))
MCMC Sampling for Bernoulli Population of multiple ordered historical data using Normalized Power Prior
Description
Multiple ordered historical data are incorporated together.
Conduct posterior sampling for Bernoulli population with normalized power prior.
For the power parameter \gamma
, a Metropolis-Hastings algorithm with independence proposal is used.
For the model parameter p
, Gibbs sampling is used.
Usage
BerOMNPP_MCMC1(n0, y0, n, y, prior_gamma, prior_p, gamma_ind_prop,
gamma_ini, nsample, burnin, thin, adjust = FALSE)
Arguments
n0 |
a non-negative integer vector: number of trials in historical data. |
y0 |
a non-negative integer vector: number of successes in historical data. |
n |
a non-negative integer: number of trials in the current data. |
y |
a non-negative integer: number of successes in the current data. |
prior_gamma |
a vector of the hyperparameters in the prior distribution |
prior_p |
a vector of the hyperparameters in the prior distribution |
gamma_ind_prop |
a vector of the hyperparameters in the proposal distribution |
gamma_ini |
the initial value of |
nsample |
specifies the number of posterior samples in the output. |
burnin |
the number of burn-ins. The output will only show MCMC samples after burnin. |
thin |
the thinning parameter in MCMC sampling. |
adjust |
Logical, indicating whether or not to adjust the parameters of the proposal distribution. |
Details
The outputs include posteriors of the model parameter(s) and power parameter, acceptance rate in sampling \gamma
.
The normalized power prior distribution is given by:
\frac{\pi_0(\gamma)\pi_0(\theta)\prod_{k=1}^{K}L(\theta|D_{0k})^{(\sum_{i=1}^{k}\gamma_i)}}{\int \pi_0(\theta)\prod_{k=1}^{K}L(\theta|D_{0k})^{(\sum_{i=1}^{k}\gamma_i)}d\theta}.
Here, \pi_0(\gamma)
and \pi_0(\theta)
are the initial prior distributions of \gamma
and \theta
, respectively. L(\theta|D_{0k})
is the likelihood function of historical data D_{0k}
, and \sum_{i=1}^{k}\gamma_i
is the corresponding power parameter.
Value
A list of class "NPP" with three elements:
acceptrate |
the acceptance rate in MCMC sampling for |
p |
posterior of the model parameter |
delta |
posterior of the power parameter |
Author(s)
Qiang Zhang zqzjf0408@163.com
References
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.
See Also
BerMNPP_MCMC1
,
BerMNPP_MCMC2
,
BerOMNPP_MCMC2
Examples
BerOMNPP_MCMC1(n0 = c(275, 287), y0 = c(92, 125), n = 39, y = 17, prior_gamma=c(1,1,1)/3,
prior_p=c(1/2,1/2), gamma_ind_prop=rep(1,3)/2, gamma_ini=NULL,
nsample = 2000, burnin = 500, thin = 2, adjust = FALSE)
MCMC Sampling for Bernoulli Population of multiple ordered historical data using Normalized Power Prior
Description
Multiple ordered historical data are combined individually.
Conduct posterior sampling for Bernoulli population with normalized power prior.
For the power parameter \gamma
, a Metropolis-Hastings algorithm with independence proposal is used.
For the model parameter p
, Gibbs sampling is used.
Usage
BerOMNPP_MCMC2(n0, y0, n, y, prior_gamma, prior_p, gamma_ind_prop, gamma_ini,
nsample, burnin, thin, adjust = FALSE)
Arguments
n0 |
a vector of non-negative integers: numbers of trials in historical data. |
y0 |
a vector of non-negative integers: numbers of successes in historical data. |
n |
a non-negative integer: number of trials in the current data. |
y |
a non-negative integer: number of successes in the current data. |
prior_gamma |
a vector of the hyperparameters in the prior distribution |
prior_p |
a vector of the hyperparameters in the prior distribution |
gamma_ind_prop |
a vector of the hyperparameters in the proposal distribution |
gamma_ini |
the initial value of |
nsample |
specifies the number of posterior samples in the output. |
burnin |
the number of burn-ins. The output will only show MCMC samples after burn-in. |
thin |
the thinning parameter in MCMC sampling. |
adjust |
Whether or not to adjust the parameters of the proposal distribution. |
Details
The outputs include posteriors of the model parameter(s) and power parameter, acceptance rate in sampling \gamma
.
The normalized power prior distribution is
\pi_0(\gamma)\prod_{k=1}^{K}\frac{\pi_0(\theta)L(\theta|D_{0k})^{(\sum_{i=1}^{k}\gamma_i)}}{\int \pi_0(\theta)L(\theta|D_{0k})^{(\sum_{i=1}^{k}\gamma_i)} d\theta}.
Here \pi_0(\gamma)
and \pi_0(\theta)
are the initial prior distributions of \gamma
and \theta
, respectively. L(\theta|D_{0k})
is the likelihood function of historical data D_{0k}
, and \sum_{i=1}^{k}\gamma_i
is the corresponding power parameter.
Value
A list of class "NPP" with three elements:
acceptrate |
the acceptance rate in MCMC sampling for |
p |
posterior of the model parameter |
delta |
posterior of the power parameter |
Author(s)
Qiang Zhang zqzjf0408@163.com
References
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.
See Also
BerMNPP_MCMC1
;
BerMNPP_MCMC2
;
BerOMNPP_MCMC1
Examples
BerOMNPP_MCMC2(n0 = c(275, 287), y0 = c(92, 125), n = 39, y = 17, prior_gamma=c(1,1,1)/3,
prior_p=c(1/2,1/2), gamma_ind_prop=rep(1,3)/2, gamma_ini=NULL,
nsample = 2000, burnin = 500, thin = 2, adjust = FALSE)
MCMC Sampling for Linear Regression Model of multiple historical data using Normalized Power Prior
Description
Multiple historical data are incorporated together.
Conduct posterior sampling for Linear Regression Model 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 parameters (\beta, \sigma^2)
, Gibbs sampling is used.
Usage
LMMNPP_MCMC1(D0, X, Y, a0, b, mu0, R, delta_ini, prop_delta,
prior_delta_alpha, prior_delta_beta, prop_delta_alpha,
prop_delta_beta, rw_delta, nsample, burnin, thin)
Arguments
D0 |
a list of |
X |
a vector or matrix or data frame of covariate observed in the current data. If more than 1 covariate available, the number of rows is equal to the number of observations. |
Y |
a vector of individual level of the response y in the current data. |
a0 |
a positive shape parameter for inverse-gamma prior on model parameter |
b |
a positive scale parameter for inverse-gamma prior on model parameter |
mu0 |
a vector of the mean for prior |
R |
a inverse matrix of the covariance matrix for prior |
delta_ini |
the initial value of |
prop_delta |
the class of proposal distribution for |
prior_delta_alpha |
a vector of the hyperparameter |
prior_delta_beta |
a vector of the hyperparameter |
prop_delta_alpha |
a vector of the hyperparameter |
prop_delta_beta |
a vector of the hyperparameter |
rw_delta |
the stepsize(variance of the normal distribution) for the random walk proposal of logit |
nsample |
specifies the number of posterior samples in the output. |
burnin |
the number of burn-ins. The output will only show MCMC samples after bunrin. |
thin |
the thinning parameter in MCMC sampling. |
Details
The outputs include posteriors of the model parameters and power parameter,
acceptance rate in sampling \delta
.
Let \theta
=(\beta, \sigma^2)
, the normalized power prior distribution is
\frac{\pi_0(\delta)\pi_0(\theta)\prod_{k=1}^{K}L(\theta|D_{0k})^{\delta_k}}{\int \pi_0(\theta)\prod_{k=1}^{K}L(\theta|D_{0k})^{\delta_k}\,d\theta}.
Here \pi_0(\delta)
and \pi_0(\theta)
are the initial prior distributions of \delta
and \theta
, respectively. L(\theta|D_{0k})
is the likelihood function of historical data D_{0k}
, and \delta_k
is the corresponding power parameter.
Value
A list of class "NPP" with four elements:
acceptrate |
the acceptance rate in MCMC sampling for |
beta |
posterior of the model parameter |
sigma |
posterior of the model parameter |
delta |
posterior of the power parameter |
Author(s)
Qiang Zhang zqzjf0408@163.com
References
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.
See Also
LMMNPP_MCMC2
;
LMOMNPP_MCMC1
;
LMOMNPP_MCMC2
Examples
## Not run:
set.seed(1234)
sigsq0 = 1
n01 = 100
theta01 = c(0, 1, 1)
X01 = cbind(1, rnorm(n01, mean=0, sd=1), runif(n01, min=-1, max=1))
Y01 = X01%*%as.vector(theta01) + rnorm(n01, mean=0, sd=sqrt(sigsq0))
D01 = cbind(X01, Y01)
n02 = 70
theta02 = c(0, 2, 3)
X02 = cbind(1, rnorm(n02, mean=0, sd=1), runif(n02, min=-1, max=1))
Y02 = X02%*%as.vector(theta02) + rnorm(n02, mean=0, sd=sqrt(sigsq0))
D02 = cbind(X02, Y02)
n03 = 50
theta03 = c(0, 3, 5)
X03 = cbind(1, rnorm(n03, mean=0, sd=1), runif(n03, min=-1, max=1))
Y03 = X03%*%as.vector(theta03) + rnorm(n03, mean=0, sd=sqrt(sigsq0))
D03 = cbind(X03, Y03)
D0 = list(D01, D02, D03)
n0 = c(n01, n02, n03)
n = 100
theta = c(0, 3, 5)
X = cbind(1, rnorm(n, mean=0, sd=1), runif(n, min=-1, max=1))
Y = X%*%as.vector(theta) + rnorm(n, mean=0, sd=sqrt(sigsq0))
LMMNPP_MCMC1(D0=D0, X=X, Y=Y, a0=2, b=2, mu0=c(0,0,0), R=diag(c(1/64,1/64,1/64)),
delta_ini=NULL, prior_delta_alpha=c(1,1,1), prior_delta_beta=c(1,1,1),
prop_delta_alpha=c(1,1,1), prop_delta_beta=c(1,1,1),
prop_delta="RW", rw_delta=0.9, nsample=5000, burnin=1000, thin=3)
## End(Not run)
MCMC Sampling for Linear Regression Model of multiple historical data using Normalized Power Prior
Description
Multiple historical data are combined individually.
The NPP of multiple historical data is the product of the NPP of each historical data.
Conduct posterior sampling for Linear Regression Model 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 parameters (\beta, \sigma^2)
, Gibbs sampling is used.
Usage
LMMNPP_MCMC2(D0, X, Y, a0, b, mu0, R, delta_ini, prop_delta,
prior_delta_alpha, prior_delta_beta, prop_delta_alpha,
prop_delta_beta, rw_delta, nsample, burnin, thin)
Arguments
D0 |
a list of |
X |
a vector or matrix or data frame of covariate observed in the current data. If more than 1 covariate available, the number of rows is equal to the number of observations. |
Y |
a vector of individual level of the response y in the current data. |
a0 |
a positive shape parameter for inverse-gamma prior on model parameter |
b |
a positive scale parameter for inverse-gamma prior on model parameter |
mu0 |
a vector of the mean for prior |
R |
a inverse matrix of the covariance matrix for prior |
delta_ini |
the initial value of |
prop_delta |
the class of proposal distribution for |
prior_delta_alpha |
a vector of the hyperparameter |
prior_delta_beta |
a vector of the hyperparameter |
prop_delta_alpha |
a vector of the hyperparameter |
prop_delta_beta |
a vector of the hyperparameter |
rw_delta |
the stepsize(variance of the normal distribution) for the random walk proposal
of logit |
nsample |
specifies the number of posterior samples in the output. |
burnin |
the number of burn-ins. The output will only show MCMC samples after bunrin. |
thin |
the thinning parameter in MCMC sampling. |
Details
The outputs include posteriors of the model parameters and power parameter,
acceptance rate in sampling \delta
.
Let \theta
=(\beta, \sigma^2)
, the normalized power prior distribution is
\pi_0(\delta)\prod_{k=1}^{K}\frac{\pi_0(\theta)L(\theta|D_{0k})^{\delta_k}}{\int \pi_0(\theta)L(\theta|D_{0k})^{\delta_k} \,d\theta}.
Here \pi_0(\delta)
and \pi_0(\theta)
are the initial prior distributions of \delta
and \theta
, respectively. L(\theta|D_{0k})
is the likelihood function of historical data D_{0k}
, and \delta_k
is the corresponding power parameter.
Value
A list of class "NPP" with four elements:
acceptrate |
the acceptance rate in MCMC sampling for |
beta |
posterior of the model parameter |
sigma |
posterior of the model parameter |
delta |
posterior of the power parameter |
Author(s)
Qiang Zhang zqzjf0408@163.com
References
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.
See Also
LMMNPP_MCMC1
;
LMOMNPP_MCMC1
;
LMOMNPP_MCMC2
Examples
## Not run:
set.seed(1234)
sigsq0 = 1
n01 = 100
theta01 = c(0, 1, 1)
X01 = cbind(1, rnorm(n01, mean=0, sd=1), runif(n01, min=-1, max=1))
Y01 = X01%*%as.vector(theta01) + rnorm(n01, mean=0, sd=sqrt(sigsq0))
D01 = cbind(X01, Y01)
n02 = 70
theta02 = c(0, 2, 3)
X02 = cbind(1, rnorm(n02, mean=0, sd=1), runif(n02, min=-1, max=1))
Y02 = X02%*%as.vector(theta02) + rnorm(n02, mean=0, sd=sqrt(sigsq0))
D02 = cbind(X02, Y02)
n03 = 50
theta03 = c(0, 3, 5)
X03 = cbind(1, rnorm(n03, mean=0, sd=1), runif(n03, min=-1, max=1))
Y03 = X03%*%as.vector(theta03) + rnorm(n03, mean=0, sd=sqrt(sigsq0))
D03 = cbind(X03, Y03)
D0 = list(D01, D02, D03)
n0 = c(n01, n02, n03)
n = 100
theta = c(0, 3, 5)
X = cbind(1, rnorm(n, mean=0, sd=1), runif(n, min=-1, max=1))
Y = X%*%as.vector(theta) + rnorm(n, mean=0, sd=sqrt(sigsq0))
LMMNPP_MCMC2(D0=D0, X=X, Y=Y, a0=2, b=2, mu0=c(0,0,0), R=diag(c(1/64,1/64,1/64)),
delta_ini=NULL, prior_delta_alpha=c(1,1,1), prior_delta_beta=c(1,1,1),
prop_delta_alpha=c(1,1,1), prop_delta_beta=c(1,1,1),
prop_delta="RW", rw_delta=0.9, nsample=5000, burnin=1000, thin=5)
## End(Not run)
MCMC Sampling for Normal Linear Model using Normalized Power Prior
Description
Conduct posterior sampling for normal linear model 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 regression parameter \beta
and \sigma^2
, Gibbs sampling is used.
Usage
LMNPP_MCMC(y.Cur, y.Hist, x.Cur = NULL, x.Hist = NULL,
prior = list(a = 1.5, b = 0, mu0 = 0,
Rinv = matrix(1, nrow = 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))
Arguments
y.Cur |
a vector of individual level of the response y in current data. |
y.Hist |
a vector of individual level of the response y in historical data. |
x.Cur |
a vector or matrix or data frame of covariate observed in the current data. If more than 1 covariate available, the number of rows is equal to the number of observations. |
x.Hist |
a vector or matrix or data frame of covariate observed in the historical data. If more than 1 covariate available, the number of rows is equal to the number of observations. |
prior |
a list of the hyperparameters in the prior for model parameters
|
MCMCmethod |
sampling method for |
rw.logit.delta |
the stepsize(variance of the normal distribution) for the random walk proposal of logit |
ind.delta.alpha |
specifies the first parameter |
ind.delta.beta |
specifies the first parameter |
nsample |
specifies the number of posterior samples in the output. |
control.mcmc |
a list of three elements used in posterior sampling.
|
Details
If b = 1
, prior for (\beta, \sigma)
is (1/\sigma^2)^a * N(mu0, \sigma^2 R^{-1})
, which includes the g-prior.
If b = 0
, prior for (\beta, \sigma)
is (1/\sigma^2)^a
.
The outputs include posteriors of the model parameter(s) and power parameter, acceptance rate when sampling \delta
, and
the deviance information criteria.
Value
A list of class "NPP" with five elements:
beta |
posterior of the model parameter |
sigmasq |
posterior of the model parameter |
delta |
posterior of the power parameter |
acceptance |
the acceptance rate in MCMC sampling for |
DIC |
the deviance information criteria for model diagnostics. |
Author(s)
Zifei Han hanzifei1@gmail.com
References
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.
See Also
BerNPP_MCMC
;
MultinomialNPP_MCMC
;
PoissonNPP_MCMC
;
NormalNPP_MCMC
Examples
set.seed(123)
x1 = runif(100, min = 0, max = 10)
x0 = runif(100, min = 0, max = 1)
y1 = 10+ 2*x1 + rnorm(100, mean = 0, sd = 1)
y0 = 10+ 1.5*x0 + rnorm(100, mean = 0, sd = 1)
RegPost = LMNPP_MCMC(y.Cur = y1, y.Hist = y0, x.Cur = x1, x.Hist = x0,
prior = list(a = 1.5, b = 0, mu0 = c(0, 0),
Rinv = diag(100, nrow = 2),
delta.alpha = 1, delta.beta = 1), MCMCmethod = 'IND',
ind.delta.alpha= 1, ind.delta.beta= 1, nsample = 5000,
control.mcmc = list(delta.ini = NULL,
burnin = 2000, thin = 2))
MCMC Sampling for Linear Regression Model of multiple historical data using Ordered Normalized Power Prior
Description
Multiple historical data are incorporated together.
Conduct posterior sampling for Linear Regression Model with ordered normalized power prior.
For the power parameter \gamma
, a Metropolis-Hastings algorithm with
independence proposal is used.
For the model parameters (\beta, \sigma^2)
, Gibbs sampling is used.
Usage
LMOMNPP_MCMC1(D0, X, Y, a0, b, mu0, R, gamma_ini, prior_gamma,
gamma_ind_prop, nsample, burnin, thin, adjust)
Arguments
D0 |
a list of |
X |
a vector or matrix or data frame of covariate observed in the current data. If more than 1 covariate available, the number of rows is equal to the number of observations. |
Y |
a vector of individual level of the response y in the current data. |
a0 |
a positive shape parameter for inverse-gamma prior on model parameter |
b |
a positive scale parameter for inverse-gamma prior on model parameter |
mu0 |
a vector of the mean for prior |
R |
a inverse matrix of the covariance matrix for prior |
gamma_ini |
the initial value of |
prior_gamma |
a vector of the hyperparameters in the prior distribution
|
gamma_ind_prop |
a vector of the hyperparameters in the proposal distribution |
nsample |
specifies the number of posterior samples in the output. |
burnin |
the number of burn-ins. The output will only show MCMC samples after bunrin. |
thin |
the thinning parameter in MCMC sampling. |
adjust |
Whether or not to adjust the parameters of the proposal distribution. |
Details
The outputs include posteriors of the model parameters and power parameter,
acceptance rate in sampling \gamma
.
Let \theta
=(\beta, \sigma^2)
, the normalized power prior distribution is
\frac{\pi_0(\gamma)\pi_0(\theta)\prod_{k=1}^{K}L(\theta|D_{0k})^(\sum_{i=1}^{k}\gamma_i)}{\int \pi_0(\theta)\prod_{k=1}^{K}L(\theta|D_{0k})^(\sum_{i=1}^{k}\gamma_i)\,d\theta}.
Here \pi_0(\gamma)
and \pi_0(\theta)
are the initial prior distributions of \gamma
and \theta
, respectively. L(\theta|D_{0k})
is the likelihood function of historical data D_{0k}
, and \sum_{i=1}^{k}\gamma_i
is the corresponding power parameter.
Value
A list of class "NPP" with four elements:
acceptrate |
the acceptance rate in MCMC sampling for |
beta |
posterior of the model parameter |
sigma |
posterior of the model parameter |
delta |
posterior of the power parameter |
Author(s)
Qiang Zhang zqzjf0408@163.com
References
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.
See Also
LMMNPP_MCMC1
;
LMMNPP_MCMC2
;
LMOMNPP_MCMC2
Examples
## Not run:
set.seed(1234)
sigsq0 = 1
n01 = 100
theta01 = c(0, 1, 1)
X01 = cbind(1, rnorm(n01, mean=0, sd=1), runif(n01, min=-1, max=1))
Y01 = X01%*%as.vector(theta01) + rnorm(n01, mean=0, sd=sqrt(sigsq0))
D01 = cbind(X01, Y01)
n02 = 70
theta02 = c(0, 2, 3)
X02 = cbind(1, rnorm(n02, mean=0, sd=1), runif(n02, min=-1, max=1))
Y02 = X02%*%as.vector(theta02) + rnorm(n02, mean=0, sd=sqrt(sigsq0))
D02 = cbind(X02, Y02)
n03 = 50
theta03 = c(0, 3, 5)
X03 = cbind(1, rnorm(n03, mean=0, sd=1), runif(n03, min=-1, max=1))
Y03 = X03%*%as.vector(theta03) + rnorm(n03, mean=0, sd=sqrt(sigsq0))
D03 = cbind(X03, Y03)
D0 = list(D01, D02, D03)
n0 = c(n01, n02, n03)
n = 100
theta = c(0, 3, 5)
X = cbind(1, rnorm(n, mean=0, sd=1), runif(n, min=-1, max=1))
Y = X%*%as.vector(theta) + rnorm(n, mean=0, sd=sqrt(sigsq0))
LMOMNPP_MCMC1(D0=D0, X=X, Y=Y, a0=2, b=2, mu0=c(0,0,0), R=diag(c(1/64,1/64,1/64)),
gamma_ini=NULL, prior_gamma=rep(1/4,4), gamma_ind_prop=rep(1/4,4),
nsample=5000, burnin=1000, thin=5, adjust=FALSE)
## End(Not run)
MCMC Sampling for Linear Regression Model of multiple historical data using Ordered Normalized Power Prior
Description
Multiple historical data are combined individually.
The NPP of multiple historical data is the product of the NPP of each historical data.
Conduct posterior sampling for Linear Regression Model with ordered normalized power prior.
For the power parameter \gamma
, a Metropolis-Hastings algorithm with
independence proposal is used.
For the model parameters (\beta, \sigma^2)
, Gibbs sampling is used.
Usage
LMOMNPP_MCMC2(D0, X, Y, a0, b, mu0, R, gamma_ini, prior_gamma,
gamma_ind_prop, nsample, burnin, thin, adjust)
Arguments
D0 |
a list of |
X |
a vector or matrix or data frame of covariate observed in the current data. If more than 1 covariate available, the number of rows is equal to the number of observations. |
Y |
a vector of individual level of the response y in the current data. |
a0 |
a positive shape parameter for inverse-gamma prior on model parameter |
b |
a positive scale parameter for inverse-gamma prior on model parameter |
mu0 |
a vector of the mean for prior |
R |
a inverse matrix of the covariance matrix for prior |
gamma_ini |
the initial value of |
prior_gamma |
a vector of the hyperparameters in the prior distribution
|
gamma_ind_prop |
a vector of the hyperparameters in the proposal distribution |
nsample |
specifies the number of posterior samples in the output. |
burnin |
the number of burn-ins. The output will only show MCMC samples after bunrin. |
thin |
the thinning parameter in MCMC sampling. |
adjust |
Whether or not to adjust the parameters of the proposal distribution. |
Details
The outputs include posteriors of the model parameters and power parameter,
acceptance rate in sampling \gamma
.
Let \theta
=(\beta, \sigma^2)
, the normalized power prior distribution is
\pi_0(\gamma)\prod_{k=1}^{K}\frac{\pi_0(\theta)L(\theta|D_{0k})^(\sum_{i=1}^{k}\gamma_i)}{\int \pi_0(\theta)L(\theta|D_{0k})^(\sum_{i=1}^{k}\gamma_i)\,d\theta}.
Here \pi_0(\gamma)
and \pi_0(\theta)
are the initial prior distributions of \gamma
and \theta
, respectively. L(\theta|D_{0k})
is the likelihood function
of historical data D_{0k}
, and \sum_{i=1}^{k}\gamma_i
is the corresponding power parameter.
Value
A list of class "NPP" with four elements:
acceptrate |
the acceptance rate in MCMC sampling for |
beta |
posterior of the model parameter |
sigma |
posterior of the model parameter |
delta |
posterior of the power parameter |
Author(s)
Qiang Zhang zqzjf0408@163.com
References
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.
See Also
LMMNPP_MCMC1
;
LMMNPP_MCMC2
;
LMOMNPP_MCMC1
Examples
## Not run:
set.seed(1234)
sigsq0 = 1
n01 = 100
theta01 = c(0, 1, 1)
X01 = cbind(1, rnorm(n01, mean=0, sd=1), runif(n01, min=-1, max=1))
Y01 = X01%*%as.vector(theta01) + rnorm(n01, mean=0, sd=sqrt(sigsq0))
D01 = cbind(X01, Y01)
n02 = 70
theta02 = c(0, 2, 3)
X02 = cbind(1, rnorm(n02, mean=0, sd=1), runif(n02, min=-1, max=1))
Y02 = X02%*%as.vector(theta02) + rnorm(n02, mean=0, sd=sqrt(sigsq0))
D02 = cbind(X02, Y02)
n03 = 50
theta03 = c(0, 3, 5)
X03 = cbind(1, rnorm(n03, mean=0, sd=1), runif(n03, min=-1, max=1))
Y03 = X03%*%as.vector(theta03) + rnorm(n03, mean=0, sd=sqrt(sigsq0))
D03 = cbind(X03, Y03)
D0 = list(D01, D02, D03)
n0 = c(n01, n02, n03)
n = 100
theta = c(0, 3, 5)
X = cbind(1, rnorm(n, mean=0, sd=1), runif(n, min=-1, max=1))
Y = X%*%as.vector(theta) + rnorm(n, mean=0, sd=sqrt(sigsq0))
LMOMNPP_MCMC1(D0=D0, X=X, Y=Y, a0=2, b=2, mu0=c(0,0,0), R=diag(c(1/64,1/64,1/64)),
gamma_ini=NULL, prior_gamma=rep(1/4,4), gamma_ind_prop=rep(1/4,4),
nsample=5000, burnin=1000, thin=5, adjust=FALSE)
## End(Not run)
A Function to Calculate logC(\delta)
Based on Laplace Approximation
Description
The function assumes that the prior of the model parameters is very flat that had very minor impact on the shape of the power prior (posterior based on the D0).
Usage
LaplacelogC(delta, loglikmle, detHessian, ntheta)
Arguments
delta |
the power parameter between 0 and 1. The function returns |
loglikmle |
a scalar; the loglikelihood of the historical data evaluated at the maximum likelihood estimates based on the historical data |
detHessian |
determinant of the Hessian matrix evaluated at the loglikelihood function with respect to the maximum likelihood estimates based on the historical data |
ntheta |
an positive integer indicating number of parameters in the model |
Value
logC(\delta)
based on the Laplace approximation. Can be used for the posterior sampling in the normalized power prior.
Author(s)
Zifei Han hanzifei1@gmail.com
References
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.
See Also
Calculate Posterior Mode of the Power Parameter in Normalized Power Prior with Grid Search, Bernoulli Population
Description
The function returns the posterior mode of the power parameter \delta
in Bernoulli population.
It calculates the log of the posterior density (up to a normalizing constant), and conduct a grid search
to find the approximate mode.
Usage
ModeDeltaBerNPP(Data.Cur, Data.Hist,
CompStat = list(n0 = NULL, y0 = NULL, n1 = NULL, y1 = NULL),
npoints = 1000,
prior = list(p.alpha = 1, p.beta = 1,
delta.alpha = 1, delta.beta = 1))
Arguments
Data.Cur |
a non-negative integer vector of two elements: c(number of success, number of failure) in the current data. |
Data.Hist |
a non-negative integer vector of two elements: c(number of success, number of failure) in the historical data. |
CompStat |
a list of four elements that represents the
"compatibility(sufficient) statistics" for
|
npoints |
is a non-negative integer scalar indicating number of points on a regular spaced grid between [0, 1], where we calculate the log of the posterior and search for the mode. |
prior |
a list of the hyperparameters in the prior for both
|
Details
See example.
Value
A numeric value between 0 and 1.
Author(s)
Zifei Han hanzifei1@gmail.com
References
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.
See Also
ModeDeltaNormalNPP
;
ModeDeltaPoisNPP
;
ModeDeltaMultinomialNPP
Examples
ModeDeltaBerNPP(Data.Cur = c(100, 40), Data.Hist = c(100, 40), npoints = 1000,
prior = list(p.alpha = 1, p.beta = 1, delta.alpha = 1, delta.beta = 1))
ModeDeltaBerNPP(Data.Cur = c(100, 40), Data.Hist = c(100, 35), npoints = 1000,
prior = list(p.alpha = 1, p.beta = 1, delta.alpha = 1, delta.beta = 1))
ModeDeltaBerNPP(Data.Cur = c(100, 40), Data.Hist = c(100, 50), npoints = 1000,
prior = list(p.alpha = 1, p.beta = 1, delta.alpha = 1, delta.beta = 1))
Calculate Posterior Mode of the Power Parameter in Normalized Power Prior with Grid Search, Normal Linear Model
Description
The function returns the posterior mode of the power parameter \delta
in normal linear model.
It calculates the log of the posterior density (up to a normalizing constant), and conduct a grid search
to find the approximate mode.
Usage
ModeDeltaLMNPP(y.Cur, y.Hist, x.Cur = NULL, x.Hist = NULL, npoints = 1000,
prior = list(a = 1.5, b = 0, mu0 = 0, Rinv = matrix(1, nrow = 1),
delta.alpha = 1, delta.beta = 1))
Arguments
y.Cur |
a vector of individual level of the response y in current data. |
y.Hist |
a vector of individual level of the response y in historical data. |
x.Cur |
a vector or matrix or data frame of covariate observed in the current data. If more than 1 covariate available, the number of rows is equal to the number of observations. |
x.Hist |
a vector or matrix or data frame of covariate observed in the historical data. If more than 1 covariate available, the number of rows is equal to the number of observations. |
npoints |
is a non-negative integer scalar indicating number of points on a regular spaced grid between [0, 1], where we calculate the log of the posterior and search for the mode. |
prior |
a list of the hyperparameters in the prior for model parameters
|
Details
If b = 1
, prior for (\beta, \sigma)
is (1/\sigma^2)^a * N(mu0, \sigma^2 R^{-1})
, which includes the g-prior.
If b = 0
, prior for (\beta, \sigma)
is (1/\sigma^2)^a
.
The outputs include posteriors of the model parameter(s) and power parameter, acceptance rate when sampling \delta
, and
the deviance information criteria.
Author(s)
Zifei Han hanzifei1@gmail.com
References
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.
See Also
ModeDeltaBerNPP
;
ModeDeltaNormalNPP
;
ModeDeltaMultinomialNPP
;
ModeDeltaNormalNPP
Calculate Posterior Mode of the Power Parameter in Normalized Power Prior with Grid Search, Multinomial Population
Description
The function returns the posterior mode of the power parameter \delta
in multinomial population.
It calculates the log of the posterior density (up to a normalizing constant), and conduct a grid search
to find the approximate mode.
Usage
ModeDeltaMultinomialNPP(Data.Cur, Data.Hist, CompStat = list(n0 = NULL, n1 = NULL),
npoints = 1000, prior = list(theta.dir.alpha = c(0.5, 0.5, 0.5),
delta.alpha = 1, delta.beta = 1))
Arguments
Data.Cur |
a non-negative integer vector of |
Data.Hist |
a non-negative integer vector of |
CompStat |
a list of two elements that represents the
"compatibility(sufficient) statistics" for
|
npoints |
is a non-negative integer scalar indicating number of points on a regular spaced grid between [0, 1], where we calculate the log of the posterior and search for the mode. |
prior |
a list of the hyperparameters in the prior for both
|
Details
See example.
Value
A numeric value between 0 and 1.
Author(s)
Zifei Han hanzifei1@gmail.com
References
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.
See Also
ModeDeltaBerNPP
;
ModeDeltaNormalNPP
;
ModeDeltaPoisNPP
Examples
ModeDeltaMultinomialNPP(CompStat = list(n0 = c(25,25,25,25), n1 = c(25,25,25,25)),
prior = list(theta.dir.alpha = c(0.5, 0.5, 0.5, 0.5),
delta.alpha = 1, delta.beta = 1))
ModeDeltaMultinomialNPP(CompStat = list(n0 = c(22,25,28,25), n1 = c(25,22,25,28)),
prior = list(theta.dir.alpha = c(0.5, 0.5, 0.5, 0.5),
delta.alpha = 1, delta.beta = 1))
ModeDeltaMultinomialNPP(CompStat = list(n0 = c(15,25,30,30), n1 = c(25,25,25,25)),
prior = list(theta.dir.alpha = c(0.5, 0.5, 0.5, 0.5),
delta.alpha = 1, delta.beta = 1))
Calculate Posterior Mode of the Power Parameter in Normalized Power Prior with Grid Search, Normal Population
Description
The function returns the posterior mode of the power parameter \delta
in multinomial population.
It calculates the log of the posterior density (up to a normalizing constant), and conduct a grid search
to find the approximate mode.
Usage
ModeDeltaNormalNPP(Data.Cur, Data.Hist,
CompStat = list(n0 = NULL, mean0 = NULL, var0 = NULL,
n1 = NULL, mean1 = NULL, var1 = NULL),
npoints = 1000,
prior = list(a = 1.5, delta.alpha = 1, delta.beta = 1))
Arguments
Data.Cur |
a vector of individual level current data. |
Data.Hist |
a vector of individual level historical data. |
CompStat |
a list of six elements(scalar) that represents the
"compatibility(sufficient) statistics" for model parameters.
Default is
|
npoints |
is a non-negative integer scalar indicating number of points on a regular spaced grid between [0, 1], where we calculate the log of the posterior and search for the mode. |
prior |
a list of the hyperparameters in the prior for both
|
Details
See example.
Value
A numeric value between 0 and 1.
Author(s)
Zifei Han hanzifei1@gmail.com
References
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.
See Also
ModeDeltaBerNPP
;
ModeDeltaMultinomialNPP
;
ModeDeltaPoisNPP
Examples
ModeDeltaNormalNPP(CompStat = list(n0 = 50, mean0 = 0, var0 = 1,
n1 = 50, mean1 = 0, var1 = 1), npoints = 1000,
prior = list(a = 1.5, delta.alpha = 1, delta.beta = 1))
ModeDeltaNormalNPP(CompStat = list(n0 = 50, mean0 = 0, var0 = 1,
n1 = 40, mean1 = 0.2, var1 = 1), npoints = 1000,
prior = list(a = 1.5, delta.alpha = 1, delta.beta = 1))
ModeDeltaNormalNPP(CompStat = list(n0 = 50, mean0 = 0, var0 = 1,
n1 = 40, mean1 = 0.6, var1 = 1), npoints = 1000,
prior = list(a = 1.5, delta.alpha = 1, delta.beta = 1))
Calculate Posterior Mode of the Power Parameter in Normalized Power Prior with Grid Search, Poisson Population
Description
The function returns the posterior mode of the power parameter \delta
in multinomial population.
It calculates the log of the posterior density (up to a normalizing constant), and conduct a grid search
to find the approximate mode.
Usage
ModeDeltaPoisNPP(Data.Cur, Data.Hist,
CompStat = list(n0 = NULL, mean0 = NULL, n1 = NULL, mean1 = NULL),
npoints = 1000, prior = list(lambda.shape = 1/2,
lambda.scale = 100, delta.alpha = 1, delta.beta = 1))
Arguments
Data.Cur |
a non-negative integer vector of each observed current data. |
Data.Hist |
a non-negative integer vector of each observed historical data. |
CompStat |
a list of four elements that represents the
"compatibility(sufficient) statistics" for
|
npoints |
is a non-negative integer scalar indicating number of points on a regular spaced grid between [0, 1], where we calculate the log of the posterior and search for the mode. |
prior |
a list of the hyperparameters in the prior for both
|
Details
See example.
Value
A numeric value between 0 and 1.
Author(s)
Zifei Han hanzifei1@gmail.com
References
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.
See Also
ModeDeltaBerNPP
;
ModeDeltaNormalNPP
;
ModeDeltaMultinomialNPP
Examples
ModeDeltaPoisNPP(CompStat = list(n0 = 50, mean0 = 10, n1 = 50, mean1 = 10), npoints = 1000,
prior = list(lambda.shape = 1/2, lambda.scale = 100,
delta.alpha = 1, delta.beta = 1))
ModeDeltaPoisNPP(CompStat = list(n0 = 50, mean0 = 10, n1 = 50, mean1 = 9.5), npoints = 1000,
prior = list(lambda.shape = 1/2, lambda.scale = 100,
delta.alpha = 1, delta.beta = 1))
ModeDeltaPoisNPP(CompStat = list(n0 = 50, mean0 = 10, n1 = 50, mean1 = 9), npoints = 1000,
prior = list(lambda.shape = 1/2, lambda.scale = 100,
delta.alpha = 1, delta.beta = 1))
MCMC Sampling for Multinomial Population using Normalized Power Prior
Description
Conduct posterior sampling for multinomial 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 vector \theta
, Gibbs sampling is used.
Assume the prior for model parameter \theta
comes from a Dirichlet distribution.
Usage
MultinomialNPP_MCMC(Data.Cur = c(10, 10, 10), Data.Hist = c(10, 10, 10),
CompStat = list(n0 = NULL, n1 = NULL),
prior = list(theta.dir = c(0.5, 0.5, 0.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))
Arguments
Data.Cur |
a non-negative integer vector of |
Data.Hist |
a non-negative integer vector of |
CompStat |
a list of two elements that represents the
"compatibility(sufficient) statistics" for
|
prior |
a list of the hyperparameters in the prior for both
|
MCMCmethod |
sampling method for |
rw.logit.delta |
the stepsize(variance of the normal distribution) for the random walk proposal of logit |
ind.delta.alpha |
specifies the first parameter |
ind.delta.beta |
specifies the first parameter |
nsample |
specifies the number of posterior samples in the output. |
control.mcmc |
a list of three elements used in posterior sampling.
|
Details
The outputs include posteriors of the model parameter(s) and power parameter, acceptance rate in sampling \delta
, and
the deviance information criteria.
Value
A list of class "NPP" with four elements:
p |
posterior of the model parameter |
delta |
posterior of the power parameter |
acceptance |
the acceptance rate in MCMC sampling for |
DIC |
the deviance information criteria for model diagnostics. |
Author(s)
Tianyu Bai tianyu.bai24@gmail.com Zifei Han hanzifei1@gmail.com
References
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.
See Also
BerNPP_MCMC
;
NormalNPP_MCMC
;
PoissonNPP_MCMC
Examples
MultinomialNPP_MCMC(Data.Cur = c(3,11,3,669), Data.Hist = c(9,20,9,473),
prior = list(theta.dir = c(1,1,1,1),
delta.alpha = 1, delta.beta = 1),
MCMCmethod = 'IND', rw.logit.delta = 0.1,
ind.delta.alpha = 1, ind.delta.beta = 1, nsample = 10000,
control.mcmc = list(delta.ini = NULL,
burnin = 2000, thin = 5))
MCMC Sampling for Normal Population using Normalized Power Prior
Description
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.
Usage
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))
Arguments
Data.Cur |
a vector of individual level current data. |
Data.Hist |
a vector of individual level historical data. |
CompStat |
a list of six elements(scalar) that represents the
"compatibility(sufficient) statistics" for model parameters.
Default is
|
prior |
a list of the hyperparameters in the prior for both
|
MCMCmethod |
sampling method for |
rw.logit.delta |
the stepsize(variance of the normal distribution) for the random walk proposal of logit |
ind.delta.alpha |
specifies the first parameter |
ind.delta.beta |
specifies the first parameter |
nsample |
specifies the number of posterior samples in the output. |
control.mcmc |
a list of three elements used in posterior sampling.
|
Details
The outputs include posteriors of the model parameter(s) and power parameter, acceptance rate in sampling \delta
, and
the deviance information criteria.
Value
A list of class "NPP" with five elements:
mu |
posterior of the model parameter |
sigmasq |
posterior of the model parameter |
delta |
posterior of the power parameter |
acceptance |
the acceptance rate in MCMC sampling for |
DIC |
the deviance information criteria for model diagnostics. |
Author(s)
Zifei Han hanzifei1@gmail.com
References
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.
See Also
BerNPP_MCMC
;
MultinomialNPP_MCMC
;
PoissonNPP_MCMC
;
Examples
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))
PH Data on four sites in Virginia
Description
The dataset is used to assess if there is site impairment. The site impairment is defined as whether the pH values at a site indicate that the site violates a (lower) standard of 6.0 more than 10% of the time.
Usage
data("PHData")
Format
A data frame with 325 observations on the following 3 variables.
Station
the site number, labeled as 1 to 4
Data.Time
indicator of historical data (coded as 0) or current data (coded as 1)
PH
value of PH on the site
Examples
data(PHData)
MCMC Sampling for Poisson Population using Normalized Power Prior with Multiple Historical Data
Description
This function incorporates multiple sets of historical data for posterior sampling in a Poisson population using a normalized power prior. The power parameter \delta
uses a Metropolis-Hastings algorithm, which can be either an independence proposal or a random walk proposal on its logit scale. For the model parameter \lambda
, Gibbs sampling is employed.
Usage
PoiMNPP_MCMC1(n0, n, prior_lambda, prop_delta, prior_delta_alpha,
prior_delta_beta, rw_delta, delta_ini, nsample, burnin, thin)
Arguments
n0 |
A vector of natural numbers: number of successes in historical data. |
n |
A natural number: number of successes in the current data. |
prior_lambda |
A vector of hyperparameters for the prior distribution |
prop_delta |
The class of proposal distribution for |
prior_delta_alpha |
A vector of hyperparameter |
prior_delta_beta |
A vector of hyperparameter |
rw_delta |
The stepsize (variance of the normal distribution) for the random walk proposal of logit |
delta_ini |
The initial value for |
nsample |
Specifies the number of posterior samples in the output. |
burnin |
The number of burn-ins. Only the MCMC samples after this burn-in will be shown in the output. |
thin |
The thinning parameter used in MCMC sampling. |
Details
The function returns posteriors for both the model and power parameters, as well as the acceptance rate for sampling \delta
. The normalized power prior distribution is given by:
\frac{\pi_0(\delta)\pi_0(\lambda)\prod_{k=1}^{K}L(\lambda|D_{0k})^{\delta_{k}}}{\int \pi_0(\lambda)\prod_{k=1}^{K}L(\lambda|D_{0k})^{\delta_{k}} d\lambda}.
Here, \pi_0(\delta)
and \pi_0(\lambda)
are the initial prior distributions for \delta
and \lambda
, respectively. L(\lambda|D_{0k})
is the likelihood function based on historical data D_{0k}
, with \delta_k
being its corresponding power parameter.
Value
A list of class "NPP" comprising:
acceptrate |
The acceptance rate in MCMC sampling for |
lambda |
Posterior samples of the model parameter |
delta |
Posterior samples of the power parameter |
Author(s)
Qiang Zhang zqzjf0408@163.com
References
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.
See Also
PoiMNPP_MCMC2
,
PoiOMNPP_MCMC1
,
PoiOMNPP_MCMC2
Examples
PoiMNPP_MCMC1(n0 = c(0, 3, 5), n = 3, prior_lambda = c(1, 1/10), prop_delta = "IND",
prior_delta_alpha = c(1, 1, 1), prior_delta_beta = c(1, 1, 1),
rw_delta = 0.1, delta_ini = NULL, nsample = 2000, burnin = 500, thin = 2)
MCMC Sampling for Poisson Population of multiple historical data using Normalized Power Prior
Description
Multiple historical data are combined individually.
Conduct posterior sampling for Poisson 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 \lambda
, Gibbs sampling is used.
Usage
PoiMNPP_MCMC2(n0,n,prior_lambda,prop_delta,prior_delta_alpha,
prior_delta_beta,rw_delta, delta_ini,nsample,burnin,thin)
Arguments
n0 |
a natural number vector : number of successes in historical data. |
n |
a natural number : number of successes in the current data. |
prior_lambda |
a vector of the hyperparameters in the prior distribution |
prop_delta |
the class of proposal distribution for |
prior_delta_alpha |
a vector of the hyperparameter |
prior_delta_beta |
a vector of the hyperparameter |
rw_delta |
the stepsize(variance of the normal distribution) for the random walk proposal of logit |
delta_ini |
the initial value of |
nsample |
specifies the number of posterior samples in the output. |
burnin |
the number of burn-ins. The output will only show MCMC samples after bunrin. |
thin |
the thinning parameter in MCMC sampling. |
Details
The outputs include posteriors of the model parameter(s) and power parameter, acceptance rate in sampling \delta
.
The normalized power prior distribution is
\pi_0(\delta)\prod_{k=1}^{K}\frac{\pi_0(\lambda)L(\lambda|D_{0k})^{\delta_{k}}}{\int \pi_0(\lambda)L(\lambda|D_{0k})^{\delta_{k}} d\lambda}.
Here \pi_0(\delta)
and \pi_0(\lambda)
are the initial prior distributions of \delta
and \lambda
, respectively. L(\lambda|D_{0k})
is the likelihood function of historical data D_{0k}
, and \delta_k
is the corresponding power parameter.
Value
A list of class "NPP" with three elements:
acceptrate |
the acceptance rate in MCMC sampling for |
lambda |
posterior of the model parameter |
delta |
posterior of the power parameter |
Author(s)
Qiang Zhang zqzjf0408@163.com
References
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.
See Also
PoiMNPP_MCMC1
;
PoiOMNPP_MCMC1
;
PoiOMNPP_MCMC2
Examples
PoiMNPP_MCMC2(n0=c(0,3,5),n=3,prior_lambda=c(1,1/10),prop_delta="IND",
prior_delta_alpha=c(1,1,1), prior_delta_beta=c(1,1,1), rw_delta=0.1,
delta_ini=NULL, nsample = 2000, burnin = 500, thin = 2)
MCMC Sampling for Poisson Population of multiple ordered historical data using Normalized Power Prior
Description
Multiple ordered historical data are incorporated together.
Conduct posterior sampling for Poisson population with normalized power prior.
For the power parameter \gamma
, a Metropolis-Hastings algorithm with independence proposal is used.
For the model parameter \lambda
, Gibbs sampling is used.
Usage
PoiOMNPP_MCMC1(n0,n,prior_gamma,prior_lambda, gamma_ind_prop,
gamma_ini,nsample,burnin,thin)
Arguments
n0 |
a natural number vector : number of successes in historical data. |
n |
a natural number : number of successes in the current data. |
prior_gamma |
a vector of the hyperparameters in the prior distribution |
prior_lambda |
a vector of the hyperparameters in the prior distribution |
gamma_ind_prop |
a vector of the hyperparameters in the proposal distribution |
gamma_ini |
the initial value of |
nsample |
specifies the number of posterior samples in the output. |
burnin |
the number of burn-ins. The output will only show MCMC samples after bunrin. |
thin |
the thinning parameter in MCMC sampling. |
Details
The outputs include posteriors of the model parameter(s) and power parameter, acceptance rate in sampling \gamma
.
The normalized power prior distribution is
\frac{\pi_0(\gamma)\pi_0(\lambda)\prod_{k=1}^{K}L(\lambda|D_{0k})^{(\sum_{i=1}^{k}\gamma_i)}}{\int \pi_0(\lambda)\prod_{k=1}^{K}L(\lambda|D_{0k})^{(\sum_{i=1}^{k}\gamma_i)}d\lambda }.
Here \pi_0(\gamma)
and \pi_0(\lambda)
are the initial prior distributions of \gamma
and \lambda
, respectively. L(\lambda|D_{0k})
is the likelihood function of historical data D_{0k}
, and \sum_{i=1}^{k}\gamma_i
is the corresponding power parameter.
Value
A list of class "NPP" with three elements:
acceptrate |
the acceptance rate in MCMC sampling for |
lambda |
posterior of the model parameter |
delta |
posterior of the power parameter |
Author(s)
Qiang Zhang zqzjf0408@163.com
References
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.
See Also
PoiMNPP_MCMC1
;
PoiMNPP_MCMC2
;
PoiOMNPP_MCMC2
Examples
PoiOMNPP_MCMC1(n0=c(0,3,5),n=3,prior_gamma=c(1/2,1/2,1/2,1/2), prior_lambda=c(1,1/10),
gamma_ind_prop=rep(1,4),gamma_ini=NULL, nsample = 2000, burnin = 500, thin = 2)
MCMC Sampling for Poisson Population of multiple ordered historical data using Normalized Power Prior
Description
Multiple ordered historical data are combined individually.
Conduct posterior sampling for Poisson population with normalized power prior.
For the power parameter \gamma
, a Metropolis-Hastings algorithm with independence proposal is used.
For the model parameter \lambda
, Gibbs sampling is used.
Usage
PoiOMNPP_MCMC2(n0,n,prior_gamma,prior_lambda, gamma_ind_prop,gamma_ini,
nsample, burnin, thin)
Arguments
n0 |
a natural number vector : number of successes in historical data. |
n |
a natural number : number of successes in the current data. |
prior_gamma |
a vector of the hyperparameters in the prior distribution |
prior_lambda |
a vector of the hyperparameters in the prior distribution |
gamma_ind_prop |
a vector of the hyperparameters in the proposal distribution |
gamma_ini |
the initial value of |
nsample |
specifies the number of posterior samples in the output. |
burnin |
the number of burn-ins. The output will only show MCMC samples after bunrin. |
thin |
the thinning parameter in MCMC sampling. |
Details
The outputs include posteriors of the model parameter(s) and power parameter, acceptance rate in sampling \gamma
.
The normalized power prior distribution is
\pi_0(\gamma)\prod_{k=1}^{K}\frac{\pi_0(\lambda)L(\lambda|D_{0k})^{(\sum_{i=1}^{k}\gamma_i)}}{\int \pi_0(\lambda)L(\lambda|D_{0k})^{(\sum_{i=1}^{k}\gamma_i)} d\lambda}.
Here \pi_0(\gamma)
and \pi_0(\lambda)
are the initial prior distributions of \gamma
and \lambda
, respectively. L(\lambda|D_{0k})
is the likelihood function of historical data D_{0k}
, and \sum_{i=1}^{k}\gamma_i
is the corresponding power parameter.
Value
A list of class "NPP" with three elements:
acceptrate |
the acceptance rate in MCMC sampling for |
lambda |
posterior of the model parameter |
delta |
posterior of the power parameter |
Author(s)
Qiang Zhang zqzjf0408@163.com
References
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.
See Also
PoiMNPP_MCMC1
;
PoiMNPP_MCMC2
;
PoiOMNPP_MCMC1
Examples
PoiOMNPP_MCMC2(n0=c(0,3,5),n=3,prior_gamma=c(1/2,1/2,1/2,1/2),
prior_lambda=c(1,1/10), gamma_ind_prop=rep(1,4),
gamma_ini=NULL, nsample = 2000, burnin = 500, thin = 2)
MCMC Sampling for Bernoulli Population using Normalized Power Prior
Description
Conduct posterior sampling for Poisson 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 \lambda
, Gibbs sampling is used.
Usage
PoissonNPP_MCMC(Data.Cur, Data.Hist,
CompStat = list(n0 = NULL, mean0 = NULL, n1 = NULL, mean1 = NULL),
prior = list(lambda.shape = 1/2, lambda.scale = 100,
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))
Arguments
Data.Cur |
a non-negative integer vector of each observed current data. |
Data.Hist |
a non-negative integer vector of each observed historical data. |
CompStat |
a list of four elements that represents the
"compatibility(sufficient) statistics" for
|
prior |
a list of the hyperparameters in the prior for both
|
MCMCmethod |
sampling method for |
rw.logit.delta |
the stepsize(variance of the normal distribution) for the random walk proposal of logit |
ind.delta.alpha |
specifies the first parameter |
ind.delta.beta |
specifies the first parameter |
nsample |
specifies the number of posterior samples in the output. |
control.mcmc |
a list of three elements used in posterior sampling.
|
Details
The outputs include posteriors of the model parameter(s) and power parameter, acceptance rate in sampling \delta
, and
the deviance information criteria.
Value
A list of class "NPP" with four elements:
lambda |
posterior of the model parameter |
delta |
posterior of the power parameter |
acceptance |
the acceptance rate in MCMC sampling for |
DIC |
the deviance information criteria for model diagnostics. |
Author(s)
Zifei Han hanzifei1@gmail.com
References
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.
See Also
MultinomialNPP_MCMC
;
NormalNPP_MCMC
;
BerNPP_MCMC
;
Examples
set.seed(1234)
DataHist <- rpois(n = 100, lambda = 49)
set.seed(12345)
DataCur <- rpois(n = 100, lambda = 49)
PoissonNPP_MCMC(Data.Cur = DataCur, Data.Hist = DataHist,
CompStat = list(n0 = 20, mean0 = 10, n1 = 30, mean1 = 11),
prior = list(lambda.shape = 1/2, lambda.scale = 100,
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 = 2000, thin = 1))
Dataset for Diagnostic Test (PartoSure Test, Medical Device) Evaluation for Spontaneous Preterm Delivery
Description
The diagnostic test was developed to aid in rapidly assess the risk of spontaneouspreterm delivery within 7 days from the time of diagnosis in pre-pregnant women with signs and symptoms. The same diagnostic test was used for two populations in US and EU respectively. The number of counts in the four cells (True positive, false positive, false negative, true negative) was recorded.
Usage
data("SPDData")
Format
A data frame with 2 observations on the following 5 variables.
Data.Region
region where the diagnostic test was conducted
TPDP
number of subjects with tested positive and the disease status positive (true positive)
TPDN
number of subjects with tested positive but the disease status negative (false positive)
TNDP
number of subjects with tested negative and the disease status positive (false negative)
TNDN
number of subjects with tested negative and the disease status negative (true negative)
Source
https://www.accessdata.fda.gov/cdrh_docs/pdf16/P160052C.pdf
Examples
data(SPDData)
Dataset of a Vaccine Trial for RotaTeq and Multiple Historical Trials for Control Group
Description
The study was designed to investigate the concomitant use of RotaTeq(Test Vaccine) and some routine pediatric vaccines between 2001-2005. The dataset includes four historical control trials. The purpose of the study is to borrow the historical controls for the non-inferiority trial. The interest is in the response rate to the routine vaccines.
Usage
data("VaccineData")
Format
A data frame with 6 observations on the following 7 variables.
Data.Time
indicator of historical data (coded as 0) or current data (coded as 1).
StudyID
character to distinguish different studies.
Group
indicator of control group (coded as 0) or treatment group (coded as 1).
Start.Year
start year of the trial
End.Year
end year of the trial
N
total number of patients enrolled and dosed in the group
y
total number of patients respond to the vaccine
References
Liu, G.F. (2018). A Dynamic Power Prior for Borrowing Historical Data in Noninferiority Trials with Binary Endpoint. Pharmaceutical Statistics 17:61-73.
Examples
data(VaccineData)
A Function to Interpolate logC(\delta)
Based on Its Values on Selected Knots
Description
The function returns the interpolated value (a scalar) of logC(\delta)
based on its results on selected knots,
given input vector of \delta
.
Usage
logCdelta(delta, deltaknot, lCknot)
Arguments
delta |
a scalar of the input value of |
deltaknot |
a vector of the knots for |
lCknot |
a vector of the values |
Value
A sequence of the values, logC(\delta)
on selected knots.
Author(s)
Zifei Han hanzifei1@gmail.com
References
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.
See Also
loglikNormD0
;
loglikBerD0
;
logCknot
A Function to Calculate logC(\delta)
on Selected Knots
Description
The function returns a sequence of the values, logC(\delta)
on selected knots, given
input vector of \delta
.
Usage
logCknot(deltaknot, llikf0)
Arguments
deltaknot |
a vector of the knots for |
llikf0 |
a matrix of the log-likelihoods of class "npp". |
Value
A sequence of the values, logC(\delta)
on selected knots.
Author(s)
Zifei Han hanzifei1@gmail.com
References
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.
See Also
loglikNormD0
;
loglikBerD0
;
logCdelta
A Function to Calculate Log-likelihood of the Historical Data, Given Matrix-valued Parameters, for Bernoulli Population
Description
The function returns a matrix of class "npp", each element is a log-likelihood of the historical data.
It is an intermediate step to calculate the "normalizing constant" C(\delta)
in the normalized
power prior, for the purpose of providing a flexible implementation.
Users can specify their own likelihood function of the same class following this structure.
Usage
loglikBerD0(D0, thetalist, ntheta = 1)
Arguments
D0 |
a vector of each observation(binary) in historical data. |
thetalist |
a list of parameter values. The number of elements is equal to |
ntheta |
a positive integer indicating number of parameters to be estimated in the model. Default is 1 for Bernoulli. |
Value
A numeric matrix of log-likelihood, for the historical data given the matrix(or array)-valued parameters.
Author(s)
Zifei Han hanzifei1@gmail.com
References
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.
See Also
loglikNormD0
;
logCknot
;
logCdelta
A Function to Calculate Log-likelihood of the Historical Data, Given Array-valued Parameters, for Normal Population
Description
The function returns a matrix of class "npp", each element is a log-likelihood of the historical data.
It is an intermediate step to calculate the "normalizing constant" C(\delta)
in the normalized
power prior, for the purpose of providing a flexible implementation.
Users can specify their own likelihood function of the same class following this structure.
Usage
loglikNormD0(D0, thetalist, ntheta = 2)
Arguments
D0 |
a vector of each observation in historical data. |
thetalist |
a list of parameter values. The number of elements is equal to |
ntheta |
a positive integer indicating number of parameters to be estimated in the model. |
Value
A numeric matrix of log-likelihood, for the historical data given the matrix(or array)-valued parameters.
Author(s)
Zifei Han hanzifei1@gmail.com
References
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.