| Title: | Uniformly Most Powerful Invariant Tests of Equivalence |
|---|---|
| Description: | Implementation of uniformly most powerful invariant equivalence tests for one- and two-sample problems (paired and unpaired) as described in Wellek (2010, ISBN:978-1-4398-0818-4). Also one-sided alternatives (non-inferiority and non-superiority tests) are supported. Basically a variant of a t-test with (relaxed) null and alternative hypotheses exchanged. |
| Authors: | Thoralf Mildenberger [aut, cre] |
| Maintainer: | Thoralf Mildenberger <[email protected]> |
| License: | GPL (>=2) |
| Version: | 0.1.1 |
| Built: | 2026-05-31 08:10:22 UTC |
| Source: | https://github.com/thmild/equivump |
Implementation of uniformly most powerful invariant equivalence tests for one- and two-sample problems (paired and unpaired). Also one-sided alternatives (non-inferiority and non-superiority tests) are supported. Basically a variant of a t-test with (relaxed) null and alternative hypotheses exchanged.
equiv.test(x, ...) ## Default S3 method: equiv.test(x, y = NULL, alternative = c("two.sided", "less", "greater"), eps = 1, mu = 0, paired = FALSE, ...) ## S3 method for class 'formula' equiv.test(formula, data, subset, na.action, ...)equiv.test(x, ...) ## Default S3 method: equiv.test(x, y = NULL, alternative = c("two.sided", "less", "greater"), eps = 1, mu = 0, paired = FALSE, ...) ## S3 method for class 'formula' equiv.test(formula, data, subset, na.action, ...)
x |
a (non-empty) numeric vector of data values. |
... |
further arguments to be passed to or from methods. |
y |
an optional (non-empty) numeric vector of data values. |
alternative |
a character string specifying the alternative hypothesis, must be one of " |
eps |
a single strictly positive number giving the equivalence limits. |
mu |
a number indicating the true value of the mean (or difference in means if you are performing a two sample test). |
paired |
a logical indicating whether you want a paired equivalence test in the two-sample case. |
formula |
a formula of the form |
data |
an optional matrix or data frame containing the variables in the formula |
subset |
an optional vector specifying a subset of observations to be used. |
na.action |
a function which indicates what should happen when the data contain NAs. Defaults to |
equiv.test is modelled after (and borrows code from) R's t.test() and is intended to work as similarly as possible.
This functions implements uniformly most powerful invariant equivalence tests for one-sample and (paired or unpaired) two-sample problems. Also supported are one-sided versions (so-called non-inferiority or non-superiority tests).
All tests are on standardized (differences of) means :
for the one-sample case,
for the paired two-sample case and
for the unpaired test, where is the standard deviation of and and
is the standard deviation of the differences. is a shift parameter that can
be used to compare against a known value in the one-sample case. should usually be zero for
two-sample problems.
The null and alternative hypotheses in equivalence tests (alternative = "two.sided") are
vs
Currently, only symmetric equivalence intervals are supported.
In the non-inferority-case (alternative = "greater") we test
vs
In the non-superiority-case (alternative = "less") we test
vs
If paired is TRUE then both x and y must be specified and they must be the same length.
Missing values are silently removed (in pairs if paired is TRUE).
The formula interface is only applicable for the two-sample tests.
A list with class htest containing the following components:
statistic |
the value of the t-statistic. |
parameter |
the degrees of freedom for the t-statistic. |
p.value |
the p-value for the test. |
estimate |
the plug-in estimate of the standardized mean (or mean difference), i.e. the empirical mean (or difference of empirical means) divided by the empirical standard deviation. Note that this estimate is not unbiaded. |
null.value |
non-equivalence limits, i.e. boundaries of null hypothesis |
alternative |
a character string describing the alternative hypothesis. |
method |
a character string indicating what type of equivalence test was performed. |
data.name |
a character string giving the name(s) of the data. |
default: Default S3 method:
formula: S3 method for class 'formula'
Wellek, S. (2010). Testing Statistical Hypotheses of Equivalence and Noniferiority. Second edition. Boca Raton: Chapman & Hall. (especially Chapters 5.3 and 6.1).
# compare two feed from chickwts dataset data("chickwts") chickwts2 <- chickwts[chickwts$feed %in% c("linseed", "soybean"),] chickwts2$feed <- droplevels(chickwts2$feed) # similar but cannot be shown to be equivalent up to 0.5 sigma at 0.05 level^ plot(weight ~ feed, data = chickwts2) equiv.test(weight ~ feed, data = chickwts2, eps = 0.5)# compare two feed from chickwts dataset data("chickwts") chickwts2 <- chickwts[chickwts$feed %in% c("linseed", "soybean"),] chickwts2$feed <- droplevels(chickwts2$feed) # similar but cannot be shown to be equivalent up to 0.5 sigma at 0.05 level^ plot(weight ~ feed, data = chickwts2) equiv.test(weight ~ feed, data = chickwts2, eps = 0.5)