two_sample_htest {atable}R Documentation

Two sample hypothesis tests and effect size

Description

Calculates two sample hypothesis tests and effect size depending on the class of its input.

Usage

two_sample_htest(value, group, ...)

## S3 method for class 'character'
two_sample_htest(value, group, ...)

## S3 method for class 'factor'
two_sample_htest(value, group, two_sample_htest.factor = NULL, ...)

## S3 method for class 'logical'
two_sample_htest(value, group, ...)

## S3 method for class 'numeric'
two_sample_htest(value, group, two_sample_htest.numeric = NULL, ...)

## S3 method for class 'ordered'
two_sample_htest(value, group, two_sample_htest.ordered = NULL, ...)

Arguments

value

An atomic vector. These values will be tested.

group

A factor with two levels and same length as value. Defines the two groups of value, that are compared by a two sample hypothesis tests.

...

Passed to methods.

two_sample_htest.factor

Analog to argument two_sample_htest.numeric

two_sample_htest.numeric

Either NULL or a function. Default is NULL. If a function, then it will replace atable:::two_sample_htest.numeric. The function must mimic two_sample_htest.numeric: arguments are value, group and the ellipsis ... . Result is a named list with length > 0 with unique names.

two_sample_htest.ordered

Analog to argument two_sample_htest.numeric

Details

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.

Value

A named list with length > 0, where all elements of the list are atomic and have the same length.

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.

Methods (by class)


[Package atable version 0.1.14 Index]