hd.diffbetas {bssbinom}R Documentation

HD interval for the difference of two beta distributions

Description

Computes the highest density interval for the difference of two beta distributions.

Usage

hd.diffbetas(c1, d1, c2, d2, rho = NULL, len = NULL, N = 1000)

Arguments

c1

First parameter of the beta distribution of the first proportion.

d1

Second parameter of the beta distribution of the first proportion.

c2

First parameter of the beta distribution of the second proportion.

d2

Second parameter of the beta distribution of the second proportion.

rho

A number in (0, 1) representing the fixed probability for the HD interval.

len

A positive real number representing the fixed length for the HD interval.

N

Number of replicates used in the simulation. Default is 1000.

Value

Lower and upper bounds of the HD interval.

Note

For fixed probability (rho) of the HD interval the function uses emp.hpd function from TeachingDemos R package. For fixed length of the HD interval the function uses an algorithm proposed in M'Lan et al. (2006). In the latter case, the provided interval may vary from one call to the next. The difference is expected to decrease as the number of replicates (N) increases.

References

M’Lan, C.E., Joseph, L., Wolfson, D.B. (2006). Bayesian sample size determination for case-control studies. Journal of the American Statistical Association, 101, 760–772.

Examples

hd.diffbetas(c1 = 8, d1 = 2, c2 = 2, d2 = 8, rho = 0.95)

hd.diffbetas(c1 = 8, d1 = 2, c2 = 2, d2 = 8, len = 0.2)

[Package bssbinom version 1.0.0 Index]