The hardware and bandwidth for this mirror is donated by METANET, the Webhosting and Full Service-Cloud Provider.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]metanet.ch.

Title: Bayesian Multigroup Equivalence Testing
Version: 0.1.0
Description: Calculates the necessary quantities to perform Bayesian multigroup equivalence testing. Currently the package includes the Bayesian models and equivalence criteria outlined in Pourmohamad and Lee (2023) <doi:10.1002/sta4.645>, but more models and equivalence testing features may be added over time.
License: MIT + file LICENSE
Encoding: UTF-8
RoxygenNote: 7.2.3
Imports: MASS, MCMCpack, stats, utils
NeedsCompilation: no
Packaged: 2023-12-21 17:20:10 UTC; pourmoht
Author: Tony Pourmohamad [aut, cre]
Maintainer: Tony Pourmohamad <tpourmohamad@gmail.com>
Repository: CRAN
Date/Publication: 2024-01-08 23:20:02 UTC

All pairwise comparisons

Description

Function creates a contrast matrix for all pairwise comparisons

Usage

apc(ngroups, labs = NULL)

Arguments

ngroups

A positive integer greater than 1 denoting the number of groups

labs

A vector of groups labels with length equal to ngroups. The default is set to NULL, and if used, the labels will be set to 1:length(ngroups).

Value

The function returns a matrix of all pairwise contrasts.

Examples

### A contrast matrix based on all pairwise contrasts of 5 groups
apc(5)

### Adding group labels
apc(5, labs = paste("Group", 1:5, sep = " "))


Posterior based Bayesian multigroup equivalence testing

Description

Function provides the necessary tools to carry out Bayesian multigroup equivalence testing based on sampling of the posterior distribution. The function returns posterior samples of the average differences amongst groups, as well as posterior samples of group variances.

Usage

bet(values, groups, em, A, B = 10000, test = "mean")

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 samples to draw. By default B is set to 10000.

test

Setting this to anything other than "mean" tells the function to not calculate the posterior probability that the average differences fall within the equivalence margins (applicable when testing equivalence based on something other than just average differences).

Value

The function returns a list object containing the following:

References

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

Examples

### 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 <- bet(values, groups, mads, A, B = 10000)

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


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)

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.

Value

The function returns a list object containing the following:

References

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

Examples

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

These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.