findbetamupsi: The findbetamupsi function

View source: R/findbetamupsi.r

findbetamupsiR Documentation

The findbetamupsi function

Description

A function to estimate (a) the parameters of a Beta distribution for the expected mean of a proportion - usually the prevalence of disease/infection for the units in an area/region and (b) the parameters of a Gamma distribution expressing our prior belief about the variability of the prevalence estimates across the units of the area/region under consideration.

Usage

findbetamupsi(themean, percentile=0.95, lower.v=T, percentile.value,
  psi.percentile=0.90, percentile.median, percentile95value,
  seed = 280385, nsims = 10000, root.method = "multiroot")

Arguments

themean

specify your prior belief about the mean. It takes a value between 0 and 1.

percentile

specify the level of confidence that the true value of the mean is greater or lower than the percentile.value. It takes a value between 0 and 1 and the default is 0.95.

lower.v

logical, if TRUE the specified percentile.value is the upper limit for the mean at the specified confidence level (percentile). If FALSE the specified percentile.value is the lower limit for the mean at the specified confidence level (percentile).The default is TRUE.

percentile.value

specify the upper or lower limit for the mean at the specified level of confidence (percentile). It takes a value between 0 and 1.

psi.percentile

specify the level of confidence that a certain fraction of the units under study has a prevalence less than the percentile.median. It takes a value between 0 and 1 and the default is 0.90.

percentile.median

specify the median value that corresponds to the defined psi.percentile. It takes a value between 0 and 1 and has to be higher than both themean and the percentile.

percentile95value

specify the value that the percentile.median does not exceed with 95% confidence. It takes a value between 0 and 1 and has to be higher than the percentile.median.

seed

A fixed seed for replication purposes.

nsims

Number of simulations for the creation of various summary metrics of the elicited prior.

root.method

Choose between two alternatives to solve the two non-linear equations to identify the hyperparameters of psi. root.method="multiroot" involves the basic function of the rootSolve package, root.method="nleqslv" involves the base functions of the nleqslv package.

Value

param_beta: The beta distribution parameters Beta(a,b)

param_gamma: The gamma distribution parameters gamma(a,b)

summary: A basic summary of the elicited prior

input: The initial input value that produced the above prior.

param_upper: simulated mu and psi of Beta(mu psi,psi(1-mu))

References

Branscum, A. J., Gardner, I. A., & Johnson, W. O. (2005): Estimation of diagnostic test sensitivity and specificity through Bayesian modeling. Preventive veterinary medicine, 68, 145–163.

Examples

## Example
## The mean prevalence of a disease/infection for the units within an area/region
## is thought to be 0.20 and we are 99% confident that it is not more than 0.40.
## Within this area, we are also confident that 90% of all units have a prevalence
## less or equal to 0.50 and we are 95% certain that it does not exceed 0.60

res1 <- findbetamupsi(
  themean = 0.20, percentile = 0.99,
  lower.v = TRUE, percentile.value = 0.30, psi.percentile = 0.90,
  percentile.median = 0.50, percentile95value = 0.60
)

res2 <- findbetamupsi(
  themean = 0.20, percentile = 0.99,
  lower.v = TRUE, percentile.value = 0.30, psi.percentile = 0.90,
  percentile.median = 0.50, percentile95value = 0.60,
  root.method = "nleqslv"
)

res1
res2


PriorGen documentation built on April 3, 2023, 5:15 p.m.