ModeDeltaBerNPP: Calculate Posterior Mode of the Power Parameter in Normalized...

View source: R/PosteriorModeNPP.R

ModeDeltaBerNPPR Documentation

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 p. Default is NULL so the fitting will be based on the data. If the CompStat is provided then the inputs in Data.Cur and Data.Hist will be ignored. Note: in Bernoulli population providing CompStat is equivalent to provide the data summary as in Data.Cur and Data.Cur.

n0 is the number of trials in the historical data.

y0 is the number of successes in the historical data.

n1 is the number of trials in the current data.

y1 is the number of successes in the current data.

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

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

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

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

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

Details

See example.

Value

A numeric value between 0 and 1.

Author(s)

Zifei Han hanzifei1@gmail.com

References

Ibrahim, J.G., Chen, M.-H., Gwon, Y. and Chen, F. (2015). The Power Prior: Theory and Applications. Statistics in Medicine 34:3724-3749.

Duan, Y., Ye, K. and Smith, E.P. (2006). Evaluating Water Quality: Using Power Priors to Incorporate Historical Information. Environmetrics 17:95-106.

See Also

ModeDeltaNormalNPP; ModeDeltaPoisNPP; ModeDeltaMultinomialNPP

Examples

ModeDeltaBerNPP(Data.Cur = c(100, 40), Data.Hist = c(100, 40), npoints = 1000,
                prior = list(p.alpha = 1, p.beta = 1, delta.alpha = 1, delta.beta = 1))

ModeDeltaBerNPP(Data.Cur = c(100, 40), Data.Hist = c(100, 35), npoints = 1000,
                prior = list(p.alpha = 1, p.beta = 1, delta.alpha = 1, delta.beta = 1))

ModeDeltaBerNPP(Data.Cur = c(100, 40), Data.Hist = c(100, 50), npoints = 1000,
                prior = list(p.alpha = 1, p.beta = 1, delta.alpha = 1, delta.beta = 1))

NPP documentation built on Sept. 18, 2023, 5:18 p.m.

Related to ModeDeltaBerNPP in NPP...