select_method: Select principle for computing null distribution

Description Usage Arguments Details Value

View source: R/helpers.R


select_method is a helper function that chooses the principle for computing the null distribution of a two-sample test.


select_method(x, y, method,, n.rep)



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


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


a character string specifying how the p-value is computed with possible values "asymptotic" for an asymptotic test based on a normal approximation, "permutation" for a permutation test, and "randomization" for a randomization test. The permutation test uses all splits of the joint sample into two samples of sizes m and n, while the randomization test draws n.rep random splits with replacement. The values m and n denote the sample sizes.

character string specifying the two-sample test for which the helper function is used.


an integer value specifying the number of random splits used to calculate the randomization distribution if method = "randomization".


When the principle is specified by the user, i.e. method contains only one element, the selected method is returned. Otherwise, if the user does not specify the principle, it depends on the sample size: When both samples contain more than 30 observations, an asymptotic test is performed. If one of the samples contains less than 30 observations, the null distribution is computed via the randomization principle. The number of replications n.rep for the randomization test needs to be specified outside of this function. Each test function contains the argument n.rep where this can be done.

If n.rep is larger than the maximum number of splits and method = "randomization", a permutation test is performed.


A character string, which specifies the principle for computing the null distribution.

robnptests documentation built on Nov. 8, 2021, 5:07 p.m.