as_htest | R Documentation |
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.
as_htest(TOST)
TOST |
A TOSTER result object of class 'TOSTt' or 'TOSTnp'. |
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
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.
Other htest:
htest-helpers
,
simple_htest()
# 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.