Package 'NPP'

Title: Normalized Power Prior Bayesian Analysis
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.
Authors: Zifei Han, Qiang Zhang, Tianyu Bai Yuyan Duan and Keying Ye
Maintainer: Zifei Han <[email protected]>
License: GPL (>= 2)
Version: 0.6.0
Built: 2024-11-07 02:39:48 UTC
Source: https://github.com/cran/NPP

Help Index


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 pp.

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 Beta(α,β)Beta(\alpha, \beta) for pp.

prior_delta_alpha

a vector of the hyperparameter α\alpha in the prior distribution Beta(α,β)Beta(\alpha, \beta) for each δ\delta.

prior_delta_beta

a vector of the hyperparameter β\beta in the prior distribution Beta(α,β)Beta(\alpha, \beta) for each δ\delta.

prop_delta_alpha

a vector of the hyperparameter α\alpha in the proposal distribution Beta(α,β)Beta(\alpha, \beta) for each δ\delta.

prop_delta_beta

a vector of the hyperparameter β\beta in the proposal distribution Beta(α,β)Beta(\alpha, \beta) for each δ\delta.

delta_ini

the initial value of δ\delta in MCMC sampling.

prop_delta

the class of proposal distribution for δ\delta.

rw_delta

the stepsize(variance of the normal distribution) for the random walk proposal of logit δ\delta. Only applicable if prop_delta = 'RW'.

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

π0(δ)π0(θ)k=1KL(θD0k)δkπ0(θ)k=1KL(θD0k)δkdθ.\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 π0(δ)\pi_0(\delta) and π0(θ)\pi_0(\theta) are the initial prior distributions of δ\delta and θ\theta, respectively. L(θD0k)L(\theta|D_{0k}) is the likelihood function of historical data D0kD_{0k}, and δk\delta_k is the corresponding power parameter.

Value

A list of class "NPP" comprising:

acceptrate

Acceptance rate in MCMC sampling for δ\delta via the Metropolis-Hastings algorithm.

p

Posterior distribution of the model parameter pp.

delta

Posterior distribution of the power parameter δ\delta.

Author(s)

Qiang Zhang [email protected]

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 pp, 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 Beta(α,β)Beta(\alpha, \beta) for pp.

prior_delta_alpha

a vector of the hyperparameter α\alpha in the prior distribution Beta(α,β)Beta(\alpha, \beta) for each δ\delta.

prior_delta_beta

a vector of the hyperparameter β\beta in the prior distribution Beta(α,β)Beta(\alpha, \beta) for each δ\delta.

prop_delta_alpha

a vector of the hyperparameter α\alpha in the proposal distribution Beta(α,β)Beta(\alpha, \beta) for each δ\delta.

prop_delta_beta

a vector of the hyperparameter β\beta in the proposal distribution Beta(α,β)Beta(\alpha, \beta) for each δ\delta.

delta_ini

the initial value of δ\delta in MCMC sampling.

prop_delta

the class of proposal distribution for δ\delta.

rw_delta

the stepsize (variance of the normal distribution) for the random walk proposal of logit δ\delta. Only applicable if prop_delta = 'RW'.

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

π0(δ)k=1Kπ0(θ)L(θD0k)δkπ0(θ)L(θD0k)δkdθ.\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 π0(δ)\pi_0(\delta) and π0(θ)\pi_0(\theta) are the initial prior distributions of δ\delta and θ\theta, respectively. L(θD0k)L(\theta|D_{0k}) is the likelihood function of historical data D0kD_{0k}, and δk\delta_k is the corresponding power parameter.

Value

A list of class "NPP" with three elements:

acceptrate

the acceptance rate in MCMC sampling for δ\delta using Metropolis-Hastings algorithm.

p

posterior of the model parameter pp.

delta

posterior of the power parameter δ\delta.

Author(s)

Qiang Zhang [email protected]

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 pp, 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 pp. 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.

prior

a list of the hyperparameters in the prior for both pp and δ\delta.

p.alpha is the hyperparameter α\alpha in the prior distribution Beta(α,β)Beta(\alpha, \beta) for pp.

p.beta is the hyperparameter β\beta in the prior distribution Beta(α,β)Beta(\alpha, \beta) for pp.

delta.alpha is the hyperparameter α\alpha in the prior distribution Beta(α,β)Beta(\alpha, \beta) for δ\delta.

delta.beta is the hyperparameter β\beta in the prior distribution Beta(α,β)Beta(\alpha, \beta) for δ\delta.

MCMCmethod

sampling method for δ\delta in MCMC. It can be either 'IND' for independence proposal; or 'RW' for random walk proposal on logit scale.

rw.logit.delta

the stepsize(variance of the normal distribution) for the random walk proposal of logit δ\delta. Only applicable if MCMCmethod = 'RW'.

ind.delta.alpha

specifies the first parameter α\alpha when independent proposal Beta(α,β)Beta(\alpha, \beta) for δ\delta is used. Only applicable if MCMCmethod = 'IND'

ind.delta.beta

specifies the first parameter β\beta when independent proposal Beta(α,β)Beta(\alpha, \beta) for δ\delta is used. Only applicable if MCMCmethod = 'IND'

nsample

specifies the number of posterior samples in the output.

control.mcmc

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.

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 pp.

delta

posterior of the power parameter δ\delta.

acceptance

the acceptance rate in MCMC sampling for δ\delta using Metropolis-Hastings algorithm.

DIC

the deviance information criteria for model diagnostics.

Author(s)

Zifei Han [email protected]

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 pp, 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 Dirichlet(α1,α2,...,αK)Dirichlet(\alpha_1, \alpha_2, ... ,\alpha_K) for γ\gamma.

prior_p

a vector of the hyperparameters in the prior distribution Beta(α,β)Beta(\alpha, \beta) for pp.

gamma_ind_prop

a vector of the hyperparameters in the proposal distribution Dirichlet(α1,α2,...,αK)Dirichlet(\alpha_1, \alpha_2, ... ,\alpha_K) for γ\gamma.

gamma_ini

the initial value of γ\gamma in MCMC sampling.

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:

π0(γ)π0(θ)k=1KL(θD0k)(i=1kγi)π0(θ)k=1KL(θD0k)(i=1kγi)dθ.\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, π0(γ)\pi_0(\gamma) and π0(θ)\pi_0(\theta) are the initial prior distributions of γ\gamma and θ\theta, respectively. L(θD0k)L(\theta|D_{0k}) is the likelihood function of historical data D0kD_{0k}, and i=1kγi\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 γ\gamma using Metropolis-Hastings algorithm.

p

posterior of the model parameter pp.

delta

posterior of the power parameter δ\delta. It is equal to the cumulative sum of γ\gamma.

Author(s)

Qiang Zhang [email protected]

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 pp, 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 Dirichlet(α1,α2,...,αK)Dirichlet(\alpha_1, \alpha_2, ... ,\alpha_K) for γ\gamma.

prior_p

a vector of the hyperparameters in the prior distribution Beta(α,β)Beta(\alpha, \beta) for pp.

gamma_ind_prop

a vector of the hyperparameters in the proposal distribution Dirichlet(α1,α2,...,αK)Dirichlet(\alpha_1, \alpha_2, ... ,\alpha_K) for γ\gamma.

gamma_ini

the initial value of γ\gamma in MCMC sampling.

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

π0(γ)k=1Kπ0(θ)L(θD0k)(i=1kγi)π0(θ)L(θD0k)(i=1kγi)dθ.\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 π0(γ)\pi_0(\gamma) and π0(θ)\pi_0(\theta) are the initial prior distributions of γ\gamma and θ\theta, respectively. L(θD0k)L(\theta|D_{0k}) is the likelihood function of historical data D0kD_{0k}, and i=1kγi\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 γ\gamma using Metropolis-Hastings algorithm.

p

posterior of the model parameter pp.

delta

posterior of the power parameter δ\delta. It is equal to the cumulative sum of γ\gamma

Author(s)

Qiang Zhang [email protected]

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)

A Function to Calculate logC(δ)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 logC(δ)logC(\delta)

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(δ)logC(\delta) based on the Laplace approximation. Can be used for the posterior sampling in the normalized power prior.

Author(s)

Zifei Han [email protected]

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

logCknot


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 (β,σ2)(\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 kk elements representing kk historical data, where the ithi^{th} element corresponds to the ithi^{th} historical data named as “D0i”.

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 σ2\sigma^2.

b

a positive scale parameter for inverse-gamma prior on model parameter σ2\sigma^2.

mu0

a vector of the mean for prior βσ2\beta|\sigma^2.

R

a inverse matrix of the covariance matrix for prior βσ2\beta|\sigma^2.

delta_ini

the initial value of δ\delta in MCMC sampling.

prop_delta

the class of proposal distribution for δ\delta.

prior_delta_alpha

a vector of the hyperparameter α\alpha in the prior distribution Beta(α,β)Beta(\alpha, \beta) for each δ\delta.

prior_delta_beta

a vector of the hyperparameter β\beta in the prior distribution Beta(α,β)Beta(\alpha, \beta) for each δ\delta.

prop_delta_alpha

a vector of the hyperparameter α\alpha in the proposal distribution Beta(α,β)Beta(\alpha, \beta) for each δ\delta.

prop_delta_beta

a vector of the hyperparameter β\beta in the proposal distribution Beta(α,β)Beta(\alpha, \beta) for each δ\delta.

rw_delta

the stepsize(variance of the normal distribution) for the random walk proposal of logit δ\delta. Only applicable if prop_delta = 'RW'.

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=(β,σ2)(\beta, \sigma^2), the normalized power prior distribution is

π0(δ)π0(θ)k=1KL(θD0k)δkπ0(θ)k=1KL(θD0k)δkdθ.\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 π0(δ)\pi_0(\delta) and π0(θ)\pi_0(\theta) are the initial prior distributions of δ\delta and θ\theta, respectively. L(θD0k)L(\theta|D_{0k}) is the likelihood function of historical data D0kD_{0k}, and δk\delta_k is the corresponding power parameter.

Value

A list of class "NPP" with four elements:

acceptrate

the acceptance rate in MCMC sampling for δ\delta using Metropolis-Hastings algorithm.

beta

posterior of the model parameter β\beta in vector or matrix form.

sigma

posterior of the model parameter σ2\sigma^2.

delta

posterior of the power parameter δ\delta.

Author(s)

Qiang Zhang [email protected]

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 (β,σ2)(\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 kk elements representing kk historical data, where the ithi^{th} element corresponds to the ithi^{th} historical data named as “D0i”.

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 σ2\sigma^2.

b

a positive scale parameter for inverse-gamma prior on model parameter σ2\sigma^2.

mu0

a vector of the mean for prior βσ2\beta|\sigma^2.

R

a inverse matrix of the covariance matrix for prior βσ2\beta|\sigma^2.

delta_ini

the initial value of δ\delta in MCMC sampling.

prop_delta

the class of proposal distribution for δ\delta.

prior_delta_alpha

a vector of the hyperparameter α\alpha in the prior distribution Beta(α,β)Beta(\alpha, \beta) for each δ\delta.

prior_delta_beta

a vector of the hyperparameter β\beta in the prior distribution Beta(α,β)Beta(\alpha, \beta) for each δ\delta.

prop_delta_alpha

a vector of the hyperparameter α\alpha in the proposal distribution Beta(α,β)Beta(\alpha, \beta) for each δ\delta.

prop_delta_beta

a vector of the hyperparameter β\beta in the proposal distribution Beta(α,β)Beta(\alpha, \beta) for each δ\delta.

rw_delta

the stepsize(variance of the normal distribution) for the random walk proposal of logit δ\delta. Only applicable if prop_delta = 'RW'.

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=(β,σ2)(\beta, \sigma^2), the normalized power prior distribution is

π0(δ)k=1Kπ0(θ)L(θD0k)δkπ0(θ)L(θD0k)δkdθ.\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 π0(δ)\pi_0(\delta) and π0(θ)\pi_0(\theta) are the initial prior distributions of δ\delta and θ\theta, respectively. L(θD0k)L(\theta|D_{0k}) is the likelihood function of historical data D0kD_{0k}, and δk\delta_k is the corresponding power parameter.

Value

A list of class "NPP" with four elements:

acceptrate

the acceptance rate in MCMC sampling for δ\delta using Metropolis-Hastings algorithm.

beta

posterior of the model parameter β\beta in vector or matrix form.

sigma

posterior of the model parameter σ2\sigma^2.

delta

posterior of the power parameter δ\delta.

Author(s)

Qiang Zhang [email protected]

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 σ2\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 (β,σ2)(\beta, \sigma^2) and δ\delta. The form of the prior for model parameter (β,σ2)(\beta, \sigma^2) is in the section "Details".

a a positive hyperparameter for prior on model parameters. It is the power aa in formula (1/σ2)a(1/\sigma^2)^a; See details.

b equals 0 if a flat prior is used for β\beta. Equals 1 if a normal prior is used for β\beta; See details.

mu0 a vector of the mean for prior βσ2\beta|\sigma^2. Only applicable if b = 1.

Rinv inverse of the matrix RR. The covariance matrix of the prior for βσ2\beta|\sigma^2 is σ2R1\sigma^2 R^{-1}.

delta.alpha is the hyperparameter α\alpha in the prior distribution Beta(α,β)Beta(\alpha, \beta) for δ\delta.

delta.beta is the hyperparameter β\beta in the prior distribution Beta(α,β)Beta(\alpha, \beta) for δ\delta.

MCMCmethod

sampling method for δ\delta in MCMC. It can be either 'IND' for independence proposal; or 'RW' for random walk proposal on logit scale.

rw.logit.delta

the stepsize(variance of the normal distribution) for the random walk proposal of logit δ\delta. Only applicable if MCMCmethod = 'RW'.

ind.delta.alpha

specifies the first parameter α\alpha when independent proposal Beta(α,β)Beta(\alpha, \beta) for δ\delta is used. Only applicable if MCMCmethod = 'IND'

ind.delta.beta

specifies the first parameter β\beta when independent proposal Beta(α,β)Beta(\alpha, \beta) for δ\delta is used. Only applicable if MCMCmethod = 'IND'

nsample

specifies the number of posterior samples in the output.

control.mcmc

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.

Details

If b=1b = 1, prior for (β,σ)(\beta, \sigma) is (1/σ2)aN(mu0,σ2R1)(1/\sigma^2)^a * N(mu0, \sigma^2 R^{-1}), which includes the g-prior. If b=0b = 0, prior for (β,σ)(\beta, \sigma) is (1/σ2)a(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 β\beta in vector or matrix form.

sigmasq

posterior of the model parameter σ2\sigma^2.

delta

posterior of the power parameter δ\delta.

acceptance

the acceptance rate in MCMC sampling for δ\delta using Metropolis-Hastings algorithm.

DIC

the deviance information criteria for model diagnostics.

Author(s)

Zifei Han [email protected]

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 (β,σ2)(\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 kk elements representing kk historical data, where the ithi^{th} element corresponds to the ithi^{th} historical data named as “D0i”.

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 σ2\sigma^2.

b

a positive scale parameter for inverse-gamma prior on model parameter σ2\sigma^2.

mu0

a vector of the mean for prior βσ2\beta|\sigma^2.

R

a inverse matrix of the covariance matrix for prior βσ2\beta|\sigma^2.

gamma_ini

the initial value of γ\gamma in MCMC sampling.

prior_gamma

a vector of the hyperparameters in the prior distribution Dirichlet(α1,α2,...,αK)Dirichlet(\alpha_1, \alpha_2, ... ,\alpha_K) for γ\gamma.

gamma_ind_prop

a vector of the hyperparameters in the proposal distribution Dirichlet(α1,α2,...,αK)Dirichlet(\alpha_1, \alpha_2, ... ,\alpha_K) for γ\gamma.

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=(β,σ2)(\beta, \sigma^2), the normalized power prior distribution is

π0(γ)π0(θ)k=1KL(θD0k)(i=1kγi)π0(θ)k=1KL(θD0k)(i=1kγi)dθ.\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 π0(γ)\pi_0(\gamma) and π0(θ)\pi_0(\theta) are the initial prior distributions of γ\gamma and θ\theta, respectively. L(θD0k)L(\theta|D_{0k}) is the likelihood function of historical data D0kD_{0k}, and i=1kγi\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 γ\gamma using Metropolis-Hastings algorithm.

beta

posterior of the model parameter β\beta in vector or matrix form.

sigma

posterior of the model parameter σ2\sigma^2.

delta

posterior of the power parameter δ\delta.

Author(s)

Qiang Zhang [email protected]

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 (β,σ2)(\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 kk elements representing kk historical data, where the ithi^{th} element corresponds to the ithi^{th} historical data named as “D0i”.

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 σ2\sigma^2.

b

a positive scale parameter for inverse-gamma prior on model parameter σ2\sigma^2.

mu0

a vector of the mean for prior βσ2\beta|\sigma^2.

R

a inverse matrix of the covariance matrix for prior βσ2\beta|\sigma^2.

gamma_ini

the initial value of γ\gamma in MCMC sampling.

prior_gamma

a vector of the hyperparameters in the prior distribution Dirichlet(α1,α2,...,αK)Dirichlet(\alpha_1, \alpha_2, ... ,\alpha_K) for γ\gamma.

gamma_ind_prop

a vector of the hyperparameters in the proposal distribution Dirichlet(α1,α2,...,αK)Dirichlet(\alpha_1, \alpha_2, ... ,\alpha_K) for γ\gamma.

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=(β,σ2)(\beta, \sigma^2), the normalized power prior distribution is

π0(γ)k=1Kπ0(θ)L(θD0k)(i=1kγi)π0(θ)L(θD0k)(i=1kγi)dθ.\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 π0(γ)\pi_0(\gamma) and π0(θ)\pi_0(\theta) are the initial prior distributions of γ\gamma and θ\theta, respectively. L(θD0k)L(\theta|D_{0k}) is the likelihood function of historical data D0kD_{0k}, and i=1kγi\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 γ\gamma using Metropolis-Hastings algorithm.

beta

posterior of the model parameter β\beta in vector or matrix form.

sigma

posterior of the model parameter σ2\sigma^2.

delta

posterior of the power parameter δ\delta.

Author(s)

Qiang Zhang [email protected]

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 Interpolate logC(δ)logC(\delta) Based on Its Values on Selected Knots

Description

The function returns the interpolated value (a scalar) of logC(δ)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 δ\delta.

deltaknot

a vector of the knots for δ\delta. It should be selected before conduct the sampling.

lCknot

a vector of the values logC(δ)logC(\delta) on selected knots, coming from the function logCknot.

Value

A sequence of the values, logC(δ)logC(\delta) on selected knots.

Author(s)

Zifei Han [email protected]

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(δ)logC(\delta) on Selected Knots

Description

The function returns a sequence of the values, logC(δ)logC(\delta) on selected knots, given input vector of δ\delta.

Usage

logCknot(deltaknot, llikf0)

Arguments

deltaknot

a vector of the knots for δ\delta. It should be selected before conduct the sampling.

llikf0

a matrix of the log-likelihoods of class "npp".

Value

A sequence of the values, logC(δ)logC(\delta) on selected knots.

Author(s)

Zifei Han [email protected]

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(δ)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. Each element is a matrix. The sample should come from the posterior of the powered likelihood for historical data, with each column corresponds to a distinct value of the power parameter δ\delta (the corresponding power parameter increases from left to right). The number of rows is the number of Monte Carlo samples for each δ\delta fixed. The number of columns is the number of selected knots (number of distinct δ\delta).

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 [email protected]

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(δ)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. Each element is a matrix. The sample should come from the posterior of the powered likelihood for historical data, with each column corresponds to a distinct value of the power parameter δ\delta (the corresponding power parameter increases from left to right). The number of rows is the number of Monte Carlo samples for each δ\delta fixed. The number of columns is the number of selected knots (number of distinct δ\delta).

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 [email protected]

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

loglikBerD0; logCknot; logCdelta


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 pp. 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.

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 pp and δ\delta.

p.alpha is the hyperparameter α\alpha in the prior distribution Beta(α,β)Beta(\alpha, \beta) for pp.

p.beta is the hyperparameter β\beta in the prior distribution Beta(α,β)Beta(\alpha, \beta) for pp.

delta.alpha is the hyperparameter α\alpha in the prior distribution Beta(α,β)Beta(\alpha, \beta) for δ\delta.

delta.beta is the hyperparameter β\beta in the prior distribution Beta(α,β)Beta(\alpha, \beta) for δ\delta.

Details

See example.

Value

A numeric value between 0 and 1.

Author(s)

Zifei Han [email protected]

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 (β,σ2)(\beta, \sigma^2) and δ\delta. The form of the prior for model parameter (β,σ2)(\beta, \sigma^2) is in the section "Details".

a a positive hyperparameter for prior on model parameters. It is the power aa in formula (1/σ2)a(1/\sigma^2)^a; See details.

b equals 0 if a flat prior is used for β\beta. Equals 1 if a normal prior is used for β\beta; See details.

mu0 a vector of the mean for prior βσ2\beta|\sigma^2. Only applicable if b = 1.

Rinv inverse of the matrix RR. The covariance matrix of the prior for βσ2\beta|\sigma^2 is σ2R1\sigma^2 R^{-1}.

delta.alpha is the hyperparameter α\alpha in the prior distribution Beta(α,β)Beta(\alpha, \beta) for δ\delta.

delta.beta is the hyperparameter β\beta in the prior distribution Beta(α,β)Beta(\alpha, \beta) for δ\delta.

Details

If b=1b = 1, prior for (β,σ)(\beta, \sigma) is (1/σ2)aN(mu0,σ2R1)(1/\sigma^2)^a * N(mu0, \sigma^2 R^{-1}), which includes the g-prior. If b=0b = 0, prior for (β,σ)(\beta, \sigma) is (1/σ2)a(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 [email protected]

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 KK elements: c(number of success in group 1, number of success in group 2, ..., number of success in group KK) in the current data.

Data.Hist

a non-negative integer vector of KK elements: c(number of success in group 1, number of success in group 2, ..., number of success in group KK) in the historical data.

CompStat

a list of two elements that represents the "compatibility(sufficient) statistics" for θ\theta. 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 multinomial case providing CompStat is equivalent to provide the data summary as in Data.Cur and Data.Cur.

n0 is a non-negative integer vector of KK elements for compatible statistics in historical data: c(number of success in group 1, number of success in group 2, ..., number of success in group KK).

n1 is a non-negative integer vector of KK elements for compatible statistics in current data: c(number of success in group 1, number of success in group 2, ..., number of success in group KK).

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 pp and δ\delta.

theta.dir is a vector of KK elements of the hyperparameter α\alpha in the prior distribution Dir(α[1],α[2],...,α[K])Dir(\alpha[1],\alpha[2],...,\alpha[K]) for θ\theta.

delta.alpha a scalar, the hyperparameter α\alpha in the prior distribution Beta(α,β)Beta(\alpha, \beta) for δ\delta.

delta.beta a scalar, the hyperparameter β\beta in the prior distribution Beta(α,β)Beta(\alpha, \beta) for δ\delta.

Details

See example.

Value

A numeric value between 0 and 1.

Author(s)

Zifei Han [email protected]

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 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.

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 (μ,σ2)(\mu, \sigma^2) and δ\delta. The form of the prior for model parameter (μ,σ2)(\mu, \sigma^2) is (1/σ2)a(1/\sigma^2)^a. When a=1a = 1 it corresponds to the reference prior, and when a=1.5a = 1.5 it corresponds to the Jeffrey's prior.

a is the power aa in formula (1/σ2)a(1/\sigma^2)^a, the prior for (μ,σ2)(\mu, \sigma^2) jointly.

delta.alpha is the hyperparameter α\alpha in the prior distribution Beta(α,β)Beta(\alpha, \beta) for δ\delta.

delta.beta is the hyperparameter β\beta in the prior distribution Beta(α,β)Beta(\alpha, \beta) for δ\delta.

Details

See example.

Value

A numeric value between 0 and 1.

Author(s)

Zifei Han [email protected]

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 λ\lambda. 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 number of observations in the historical data.

mean0 is the sample mean of the historical data.

n1 is the number of observations in the current data.

mean1 is the sample mean of the current data.

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 λ\lambda and δ\delta. A Gamma distribution is used as the prior of λ\lambda, and a Beta distribution is used as the prior of δ\delta.

lambda.shape is the shape (hyper)parameter in the prior distribution Gamma(shape,scale)Gamma(shape, scale) for λ\lambda.

lambda.scale is the scale (hyper)parameter in the prior distribution Gamma(shape,scale)Gamma(shape, scale) for λ\lambda.

delta.alpha is the hyperparameter α\alpha in the prior distribution Beta(α,β)Beta(\alpha, \beta) for δ\delta.

delta.beta is the hyperparameter β\beta in the prior distribution Beta(α,β)Beta(\alpha, \beta) for δ\delta.

Details

See example.

Value

A numeric value between 0 and 1.

Author(s)

Zifei Han [email protected]

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 KK elements: c(number of success in group 1, number of success in group 2, ..., number of success in group KK) in the current data.

Data.Hist

a non-negative integer vector of KK elements: c(number of success in group 1, number of success in group 2, ..., number of success in group KK) in the historical data.

CompStat

a list of two elements that represents the "compatibility(sufficient) statistics" for θ\theta. 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 multinomial case providing CompStat is equivalent to provide the data summary as in Data.Cur and Data.Cur.

n0 is a non-negative integer vector of KK elements for compatible statistics in historical data: c(number of success in group 1, number of success in group 2, ..., number of success in group KK).

n1 is a non-negative integer vector of KK elements for compatible statistics in current data: c(number of success in group 1, number of success in group 2, ..., number of success in group KK).

prior

a list of the hyperparameters in the prior for both pp and δ\delta.

theta.dir is a vector of KK elements of the hyperparameter α\alpha in the prior distribution Dir(α[1],α[2],...,α[K])Dir(\alpha[1],\alpha[2],...,\alpha[K]) for θ\theta.

delta.alpha a scalar, the hyperparameter α\alpha in the prior distribution Beta(α,β)Beta(\alpha, \beta) for δ\delta.

delta.beta a scalar, the hyperparameter β\beta in the prior distribution Beta(α,β)Beta(\alpha, \beta) for δ\delta.

MCMCmethod

sampling method for δ\delta in MCMC. It can be either 'IND' for independence proposal; or 'RW' for random walk proposal on logit scale.

rw.logit.delta

the stepsize(variance of the normal distribution) for the random walk proposal of logit δ\delta. Only applicable if MCMCmethod = 'RW'.

ind.delta.alpha

specifies the first parameter α\alpha when independent proposal Beta(α,β)Beta(\alpha, \beta) for δ\delta is used. Only applicable if MCMCmethod = 'IND'

ind.delta.beta

specifies the first parameter β\beta when independent proposal Beta(α,β)Beta(\alpha, \beta) for δ\delta is used. Only applicable if MCMCmethod = 'IND'

nsample

specifies the number of posterior samples in the output.

control.mcmc

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.

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 θ\theta.

delta

posterior of the power parameter δ\delta.

acceptance

the acceptance rate in MCMC sampling for δ\delta using Metropolis-Hastings algorithm.

DIC

the deviance information criteria for model diagnostics.

Author(s)

Tianyu Bai [email protected] Zifei Han [email protected]

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 π(μσ2)\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 σ2\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 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.

prior

a list of the hyperparameters in the prior for both (μ,σ2)(\mu, \sigma^2) and δ\delta. The form of the prior for model parameter (μ,σ2)(\mu, \sigma^2) is (1/σ2)a(1/\sigma^2)^a. When a=1a = 1 it corresponds to the reference prior, and when a=1.5a = 1.5 it corresponds to the Jeffrey's prior.

a is the power aa in formula (1/σ2)a(1/\sigma^2)^a, the prior for (μ,σ2)(\mu, \sigma^2) jointly.

delta.alpha is the hyperparameter α\alpha in the prior distribution Beta(α,β)Beta(\alpha, \beta) for δ\delta.

delta.beta is the hyperparameter β\beta in the prior distribution Beta(α,β)Beta(\alpha, \beta) for δ\delta.

MCMCmethod

sampling method for δ\delta in MCMC. It can be either 'IND' for independence proposal; or 'RW' for random walk proposal on logit scale.

rw.logit.delta

the stepsize(variance of the normal distribution) for the random walk proposal of logit δ\delta. Only applicable if MCMCmethod = 'RW'.

ind.delta.alpha

specifies the first parameter α\alpha when independent proposal Beta(α,β)Beta(\alpha, \beta) for δ\delta is used. Only applicable if MCMCmethod = 'IND'

ind.delta.beta

specifies the first parameter β\beta when independent proposal Beta(α,β)Beta(\alpha, \beta) for δ\delta is used. Only applicable if MCMCmethod = 'IND'

nsample

specifies the number of posterior samples in the output.

control.mcmc

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.

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 μ\mu.

sigmasq

posterior of the model parameter σ2\sigma^2.

delta

posterior of the power parameter δ\delta.

acceptance

the acceptance rate in MCMC sampling for δ\delta using Metropolis-Hastings algorithm.

DIC

the deviance information criteria for model diagnostics.

Author(s)

Zifei Han [email protected]

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 Gamma(α,β)Gamma(\alpha, \beta) of λ\lambda.

prop_delta

The class of proposal distribution for δ\delta.

prior_delta_alpha

A vector of hyperparameter α\alpha for the prior distribution Beta(α,β)Beta(\alpha, \beta) for each δ\delta.

prior_delta_beta

A vector of hyperparameter β\beta for the prior distribution Beta(α,β)Beta(\alpha, \beta) for each δ\delta.

rw_delta

The stepsize (variance of the normal distribution) for the random walk proposal of logit δ\delta. This is only applicable if prop_delta = 'RW'.

delta_ini

The initial value for δ\delta in MCMC sampling.

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:

π0(δ)π0(λ)k=1KL(λD0k)δkπ0(λ)k=1KL(λD0k)δkdλ.\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, π0(δ)\pi_0(\delta) and π0(λ)\pi_0(\lambda) are the initial prior distributions for δ\delta and λ\lambda, respectively. L(λD0k)L(\lambda|D_{0k}) is the likelihood function based on historical data D0kD_{0k}, with δk\delta_k being its corresponding power parameter.

Value

A list of class "NPP" comprising:

acceptrate

The acceptance rate in MCMC sampling for δ\delta using the Metropolis-Hastings algorithm.

lambda

Posterior samples of the model parameter λ\lambda.

delta

Posterior samples of the power parameter δ\delta.

Author(s)

Qiang Zhang [email protected]

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 Gamma(α,β)Gamma(\alpha, \beta) for λ\lambda.

prop_delta

the class of proposal distribution for δ\delta.

prior_delta_alpha

a vector of the hyperparameter α\alpha in the prior distribution Beta(α,β)Beta(\alpha, \beta) for each δ\delta.

prior_delta_beta

a vector of the hyperparameter β\beta in the prior distribution Beta(α,β)Beta(\alpha, \beta) for each δ\delta.

rw_delta

the stepsize(variance of the normal distribution) for the random walk proposal of logit δ\delta. Only applicable if prop_delta = 'RW'.

delta_ini

the initial value of δ\delta in MCMC sampling.

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

π0(δ)k=1Kπ0(λ)L(λD0k)δkπ0(λ)L(λD0k)δkdλ.\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 π0(δ)\pi_0(\delta) and π0(λ)\pi_0(\lambda) are the initial prior distributions of δ\delta and λ\lambda, respectively. L(λD0k)L(\lambda|D_{0k}) is the likelihood function of historical data D0kD_{0k}, and δk\delta_k is the corresponding power parameter.

Value

A list of class "NPP" with three elements:

acceptrate

the acceptance rate in MCMC sampling for δ\delta using Metropolis-Hastings algorithm.

lambda

posterior of the model parameter λ\lambda.

delta

posterior of the power parameter δ\delta.

Author(s)

Qiang Zhang [email protected]

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 Dirichlet(α1,α2,...,αK)Dirichlet(\alpha_1, \alpha_2, ... ,\alpha_K) for γ\gamma.

prior_lambda

a vector of the hyperparameters in the prior distribution Gamma(α,β)Gamma(\alpha, \beta) for λ\lambda.

gamma_ind_prop

a vector of the hyperparameters in the proposal distribution Dirichlet(α1,α2,...,αK)Dirichlet(\alpha_1, \alpha_2, ... ,\alpha_K) for γ\gamma.

gamma_ini

the initial value of γ\gamma in MCMC sampling.

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

π0(γ)π0(λ)k=1KL(λD0k)(i=1kγi)π0(λ)k=1KL(λD0k)(i=1kγi)dλ.\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 π0(γ)\pi_0(\gamma) and π0(λ)\pi_0(\lambda) are the initial prior distributions of γ\gamma and λ\lambda, respectively. L(λD0k)L(\lambda|D_{0k}) is the likelihood function of historical data D0kD_{0k}, and i=1kγi\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 γ\gamma using Metropolis-Hastings algorithm.

lambda

posterior of the model parameter λ\lambda.

delta

posterior of the power parameter δ\delta. It is equal to the cumulative sum of γ\gamma

Author(s)

Qiang Zhang [email protected]

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 Dirichlet(α1,α2,...,αK)Dirichlet(\alpha_1, \alpha_2, ... ,\alpha_K) for γ\gamma.

prior_lambda

a vector of the hyperparameters in the prior distribution Gamma(α,β)Gamma(\alpha, \beta) for λ\lambda.

gamma_ind_prop

a vector of the hyperparameters in the proposal distribution Dirichlet(α1,α2,...,αK)Dirichlet(\alpha_1, \alpha_2, ... ,\alpha_K) for γ\gamma.

gamma_ini

the initial value of γ\gamma in MCMC sampling.

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

π0(γ)k=1Kπ0(λ)L(λD0k)(i=1kγi)π0(λ)L(λD0k)(i=1kγi)dλ.\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 π0(γ)\pi_0(\gamma) and π0(λ)\pi_0(\lambda) are the initial prior distributions of γ\gamma and λ\lambda, respectively. L(λD0k)L(\lambda|D_{0k}) is the likelihood function of historical data D0kD_{0k}, and i=1kγi\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 γ\gamma using Metropolis-Hastings algorithm.

lambda

posterior of the model parameter λ\lambda.

delta

posterior of the power parameter δ\delta. It is equal to the cumulative sum of γ\gamma

Author(s)

Qiang Zhang [email protected]

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 λ\lambda. 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 number of observations in the historical data.

mean0 is the sample mean of the historical data.

n1 is the number of observations in the current data.

mean1 is the sample mean of the current data.

prior

a list of the hyperparameters in the prior for both λ\lambda and δ\delta. A Gamma distribution is used as the prior of λ\lambda, and a Beta distribution is used as the prior of δ\delta.

lambda.shape is the shape (hyper)parameter in the prior distribution Gamma(shape,scale)Gamma(shape, scale) for λ\lambda.

lambda.scale is the scale (hyper)parameter in the prior distribution Gamma(shape,scale)Gamma(shape, scale) for λ\lambda.

delta.alpha is the hyperparameter α\alpha in the prior distribution Beta(α,β)Beta(\alpha, \beta) for δ\delta.

delta.beta is the hyperparameter β\beta in the prior distribution Beta(α,β)Beta(\alpha, \beta) for δ\delta.

MCMCmethod

sampling method for δ\delta in MCMC. It can be either 'IND' for independence proposal; or 'RW' for random walk proposal on logit scale.

rw.logit.delta

the stepsize(variance of the normal distribution) for the random walk proposal of logit δ\delta. Only applicable if MCMCmethod = 'RW'.

ind.delta.alpha

specifies the first parameter α\alpha when independent proposal Beta(α,β)Beta(\alpha, \beta) for δ\delta is used. Only applicable if MCMCmethod = 'IND'

ind.delta.beta

specifies the first parameter β\beta when independent proposal Beta(α,β)Beta(\alpha, \beta) for δ\delta is used. Only applicable if MCMCmethod = 'IND'

nsample

specifies the number of posterior samples in the output.

control.mcmc

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.

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 λ\lambda.

delta

posterior of the power parameter δ\delta.

acceptance

the acceptance rate in MCMC sampling for δ\delta using Metropolis-Hastings algorithm.

DIC

the deviance information criteria for model diagnostics.

Author(s)

Zifei Han [email protected]

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)