A function for TOST with all types of t-tests.

t_TOST(
x,
...,
hypothesis = "EQU",
paired = FALSE,
var.equal = FALSE,
eqb,
low_eqbound,
high_eqbound,
eqbound_type = "raw",
alpha = 0.05,
bias_correction = TRUE,
rm_correction = FALSE,
glass = NULL,
smd_ci = c("nct", "goulet", "t", "z")
)

# S3 method for default
t_TOST(
x,
y = NULL,
hypothesis = c("EQU", "MET"),
paired = FALSE,
var.equal = FALSE,
eqb,
low_eqbound,
high_eqbound,
eqbound_type = c("raw", "SMD"),
alpha = 0.05,
mu = 0,
bias_correction = TRUE,
rm_correction = FALSE,
glass = NULL,
smd_ci = c("nct", "goulet", "t", "z"),
...
)

# S3 method for formula
t_TOST(formula, data, subset, na.action, ...)

## Arguments

x

a (non-empty) numeric vector of data values.

...

further arguments to be passed to or from methods.

hypothesis

'EQU' for equivalence (default), or 'MET' for minimal effects test, the alternative hypothesis.

paired

a logical indicating whether you want a paired t-test.

var.equal

a logical variable indicating whether to treat the two variances as being equal. If TRUE then the pooled variance is used to estimate the variance otherwise the Welch (or Satterthwaite) approximation to the degrees of freedom is used.

eqb

Equivalence bound. Can provide 1 value (negative value is taken as the lower bound) or 2 specific values that represent the upper and lower equivalence bounds.

low_eqbound

lower equivalence bounds (deprecated).

high_eqbound

upper equivalence bounds (deprecated).

eqbound_type

Type of equivalence bound. Can be set to "SMD" for standardized mean difference (i.e., Cohen's d) or "raw" for the mean difference. Default is "raw". Raw is strongly recommended as SMD bounds will produce biased results.

alpha

alpha level (default = 0.05)

bias_correction

Apply Hedges' correction for bias (default is TRUE).

rm_correction

Repeated measures correction to make standardized mean difference Cohen's d(rm). This only applies to repeated/paired samples. Default is FALSE.

glass

A option to calculate Glass's delta as an alternative to Cohen's d type SMD. Default is NULL to not calculate Glass's delta, "glass1" will use the first group's SD as the denominator whereas "glass2" will use the 2nd group's SD.

smd_ci

Method for calculating SMD confidence intervals. Methods include Goulet, noncentral t (nct), central t (t), and normal method (z).

y

an optional (non-empty) numeric vector of data values.

mu

a number indicating the true value of the mean for the two tailed test (or difference in means if you are performing a two sample test).

formula

a formula of the form lhs ~ rhs where lhs is a numeric variable giving the data values and rhs either 1 for a one-sample or paired test or a factor with two levels giving the corresponding groups. If lhs is of class "Pair" and rhs is 1, a paired test is done.

data

an optional matrix or data frame (or similar: see model.frame) containing the variables in the formula formula. By default the variables are taken from environment(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 getOption("na.action").

## Value

An S3 object of class

"TOSTt" is returned containing the following slots:

"TOST"

A table of class "data.frame" containing two-tailed t-test and both one-tailed results.

"eqb"

A table of class "data.frame" containing equivalence bound settings.

"effsize"

table of class "data.frame" containing effect size estimates

"hypothesis"

String stating the hypothesis being tested

"smd"

List containing the results of the standardized mean difference calculations (e.g., Cohen's d).Items include: d (estimate), dlow (lower CI bound), dhigh (upper CI bound), d_df (degrees of freedom for SMD), d_sigma (SE), d_lambda (non-centrality), J (bias correction), smd_label (type of SMD), d_denom (denominator calculation)

"alpha"

Alpha level set for the analysis.

"method"

Type of t-test.

"decision"

List included text regarding the decisions for statistical inference.

## Details

For details on the calculations in this function see vignette("IntroTOSTt") & vignette("SMD_calcs").

Other TOST: simple_htest(), tsum_TOST()

## Examples

data(mtcars)
t_TOST(mpg ~ am,
data = mtcars,
eqb = 3)
#>
#> Welch Two Sample t-test
#>
#> The equivalence test was non-significant, t(18.33) = -2.2, p = 0.98
#> The null hypothesis test was significant, t(18.33) = -3.77p < 0.01
#> NHST: reject null significance hypothesis that the effect is equal to zero
#> TOST: don't reject null equivalence hypothesis
#>
#> TOST Results
#>                 t    df p.value
#> t-test     -3.767 18.33   0.001
#> TOST Lower -2.207 18.33    0.98
#> TOST Upper -5.327 18.33 < 0.001
#>
#> Effect Sizes
#>                Estimate    SE                C.I. Conf. Level
#> Raw              -7.245 1.923 [-10.5766, -3.9133]         0.9
#> Hedges's g(av)   -1.360 0.694   [-2.032, -0.6603]         0.9
#> Note: SMD confidence intervals are an approximation. See vignette("SMD_calcs").