Calculates two sample hypothesis tests and effect size depending on the class of its input.
two_sample_htest(value, group, ...)# S3 method for character
two_sample_htest(value, group, ...)
# S3 method for factor
two_sample_htest(value, group, ...)
# S3 method for logical
two_sample_htest(value, group, ...)
# S3 method for numeric
two_sample_htest(value, group, ...)
# S3 method for ordered
two_sample_htest(value, group, ...)
An atomic vector.
A factor with two levels and same length as value. Defines the two groups
of value.
Passed to methods.
A named list with length > 0.
Most hypothesis-test-functions in R like t.test or chisq.test
return an object of class 'htest'. 'htest'-objects are a suitable output for function
two_sample_htest. Function check_tests checks if the output is suitable for
further processing.
character: Casts value to factor and then calls method two_sample_htest again.
factor: Calls chisq.test on value.
Effect size is the odds ratio calculated by fisher.test (if value has two levels),
or Cramer's V by CramerV.
logical: Casts value to factor and then calls two_sample_htest again.
numeric: Calls ks.test on value.
Effect size is Cohen's d calculated by cohen.d.
ordered: Calls wilcox.test on value.
Effect size is Cliff's delta calculated by cliff.delta.
Results are passed to function format_tests for the final table.
So the results of two_sample_htest must have a class for which the generic
format_tests has a method.
If you are not pleased with the current hypothesis tests you may alter these functions. But you must keep the original output-format, see section Value.
Note that the various statistical test functions in R have heterogeneous arguments:
for example chisq.test and ks.test do not have
formula/data as arguments, whereas wilcox.test and
kruskal.test do. So the function two_sample_htest is essentially
a wrapper to standardize the arguments of various hypothesis test functions.
As two_sample_htest is only intended to be applied to unpaired two sample data,
the two arguments value and group are sufficient to describe the data.
Note that e.g. for class numeric the p-value is calculated by ks.test and the effects
size 95% CI by cohen.d. As these are two different functions the results may be
contradicting: the p-value of ks.test can be smaller than 0.05
and the CI of cohen.d contains 0 at the same time.