Learn R Programming

bmet (version 0.1.0)

betpp: Posterior predictive based Bayesian multigroup equivalence testing

Description

Function provides the necessary tools to carry out Bayesian multigroup equivalence testing based on sampling of the posterior predictive distribution. The function returns posterior predictive samples of future differences amongst groups.

Usage

betpp(values, groups, em, A, B = 10000)

Value

The function returns a list object containing the following:

  • prob: The probability that future differences fall within the equivalence margins.

  • delta: A B x c matrix of posterior predictive samples of future differences for each pairwise comparison of interest.

Arguments

values

A vector of measurements sorted in the same order as the groups variable.

groups

A vector of groups labels corresponding to the individual measurements in the groups variable.

em

A c x 2 matrix of lower and upper equivalence margins. Here, c is the number of pairwise comparisons of interest.

A

A c x k matrix of pairwise contrasts. Here, k is the number of groups, i.e., length(unique(groups)).

B

A positive integer specifying the number of posterior predictive samples to draw. By default B is set to 10000.

References

Pourmohamad, T. and Lee, H.K.H. (2023). Equivalence Testing for Multiple Groups. Stat, e645.

Examples

Run this code
### Multigroup equivalence test for A vs. B and A vs. C
values <- rnorm(75)
groups <- rep(LETTERS[1:3], each = 25)

mad1 <- 0.65  # The equivalence margin for A vs. B
mad2 <- 0.65  # The equivalence margin for A vs. C
mads <- c(mad1, mad2)
mads <- cbind(-mads, mads)

A <- apc(3)
A <- A[1:2, ]

out <- betpp(values, groups, mads, A, B = 10000)

out$prob   # The probability that future differences
           # fall within the equivalence margins

Run the code above in your browser using DataLab