as_htest: Convert TOSTER Results to Class 'htest'

View source: R/htest.R

as_htestR Documentation

Convert TOSTER Results to Class 'htest'

Description

[Maturing]

Converts a TOSTER result object of class 'TOSTt' or 'TOSTnp' to a list of class 'htest', making it compatible with standard R hypothesis testing functions and workflows.

Usage

as_htest(TOST)

Arguments

TOST

A TOSTER result object of class 'TOSTt' or 'TOSTnp'.

Details

This function allows you to convert the specialized TOSTER result objects to the standard 'htest' class used by most R hypothesis testing functions (e.g., t.test(), cor.test()). This enables:

  • Integration with other statistical functions that expect 'htest' objects

  • Using helper functions like df_htest() or describe_htest()

  • Consistent reporting and interpretation of results

Value

Returns a list of class 'htest' containing the following components:

  • statistic: The value of the test statistic (t for TOSTt, WMW for TOSTnp).

  • parameter: The degrees of freedom of the test statistic (df for TOSTt, NULL for TOSTnp).

  • p.value: The p-value of the test.

  • estimate: Estimated difference in raw units.

  • null.value: Equivalence bounds.

  • alternative: A character string describing the alternative hypothesis ("equivalence" or "minimal.effect").

  • method: A character string indicating the performed test.

  • data.name: A character string giving the names of the data.

  • conf.int: The confidence interval of the difference.

See Also

Other htest: htest-helpers, simple_htest()

Examples

# Example 1: Converting TOST t-test results to htest
res1 <- t_TOST(formula = extra ~ group, data = sleep, eqb = .5, smd_ci = "goulet")
htest_result <- as_htest(res1)
htest_result  # Print the htest object

# Example 2: Using the converted result with htest helpers
describe_htest(htest_result)
df_htest(htest_result)

# Example 3: Converting a non-parametric TOST result
res2 <- wilcox_TOST(extra ~ group, data = sleep, eqb = 2)
as_htest(res2)


Lakens/TOSTER documentation built on June 9, 2025, 8:57 p.m.