Description Usage Arguments Details Value Methods (by class) References Examples
Implementation of uniformly most powerful invariant equivalence tests for one and twosample problems (paired and unpaired). Also onesided alternatives (noninferiority and nonsuperiority tests) are supported. Basically a variant of a ttest with (relaxed) null and alternative hypotheses exchanged.
1 2 3 4 5 6 7 8  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 (nonempty) numeric vector of data values. 
... 
further arguments to be passed to or from methods. 
y 
an optional (nonempty) 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 twosample 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 onesample and (paired or unpaired) twosample problems. Also supported are onesided versions (socalled noninferiority or nonsuperiority tests).
All tests are on standardized (differences of) means theta:
theta = (mu_x  mu) / sigma
for the onesample case,
theta = (mu_d  mu) / sigma_d
for the paired twosample case and
theta = (mu_x  mu_y  mu) / sigma
for the unpaired test, where sigma is the standard deviation of x and y and sigma_d is the standard deviation of the differences. mu is a shift parameter that can be used to compare against a known value in the onesample case. mu should usually be zero for twosample problems.
The null and alternative hypotheses in equivalence tests (alternative = "two.sided"
) are
H_0: theta <= eps \qquad or \qquad theta >= eps
vs
H_1: eps < theta < eps
Currently, only symmetric equivalence intervals (eps, eps) are supported.
In the noninferoritycase (alternative = "greater"
) we test
H_0: theta <= eps
vs
H_1: theta > eps
In the nonsuperioritycase (alternative = "less"
) we test
H_0: theta >= eps
vs
H_1: theta < eps
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 twosample tests.
A list with class htest
containing the following components:
statistic 
the value of the tstatistic. 
parameter 
the degrees of freedom for the tstatistic. 
p.value 
the pvalue for the test. 
estimate 
the plugin 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 
nonequivalence 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).
1 2 3 4 5 6 7 8  # 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)

Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.