rob_perm_statistic: Robust test statistics based on robust location estimators

View source: R/testStatistics.R

rob_perm_statisticR Documentation

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
)

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 \insertCiteFriDeh11robu;textualrobnptests or the vignette vignette("robnptests") for details.

Value

A named list containing the following components:

statistic

the selected test statistic.

estimates

estimate of location for each sample if available.

References

\insertRef

FriDeh11roburobnptests

Examples

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

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


s-abbas/robTests documentation built on Feb. 20, 2023, 10:14 a.m.