Learn R Programming

robnptests (version 1.1.0)

rob_perm_statistic: Robust test statistics based on robust location estimators

Description

rob_perm_statistic calculates test statistics for robust permutation/randomization tests based on the sample median, the one-sample Hodges-Lehmann estimator, or the two-sample Hodges-Lehmann estimator.

Usage

rob_perm_statistic(
  x,
  y,
  type = c("HL11", "HL12", "HL21", "HL22", "MED1", "MED2"),
  na.rm = FALSE
)

Value

A named list containing the following components:

statistic

the selected test statistic.

estimates

estimate of location for each sample if available.

Arguments

x

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

y

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

type

a character string specifying the desired test statistic. It must be one of "HL11" (default), "HL12", "HL21", "HL22", "MED1", and "MED2", where "HL1", "HL2" and "MED" specify the location estimator and the numbers 1 and 2 the scale estimator, see the vignette vignette("robnptests") for more information.

na.rm

a logical value indicating whether NA values in x and y should be stripped before the computation proceeds. The default is na.rm = FALSE.

Details

The test statistics returned by rob_perm_statistic are of the form $$D_i/S_j$$ where the D_i, i = 1,...,3, are different estimators of location and the S_j, j = 1,...,4, are estimates for the mutual sample scale. See FriDeh11robu;textualrobnptests or the vignette vignette("robnptests") for details.

References

FriDeh11roburobnptests

Examples

Run this code
# Generate random samples
set.seed(108)
x <- rnorm(20); y <- rnorm(20)

# Compute HL21-statistic
rob_perm_statistic(x, y, type = "HL21")

Run the code above in your browser using DataLab