check_test_input: Checks for input arguments

View source: R/helpers.R

check_test_inputR Documentation

Checks for input arguments

Description

check_test_input is a helper functions that contains checks for the input arguments of the two-sample tests.

Usage

check_test_input(
  x,
  y,
  alternative,
  delta,
  method,
  scale,
  n.rep,
  na.rm,
  scale.test,
  wobble,
  wobble.seed,
  gamma = NULL,
  psi = NULL,
  k = NULL,
  test.name
)

Arguments

x

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

y

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

alternative

a character string specifying the alternative hypothesis, must be one of "two.sided", "greater", or "less".

delta

a numeric value indicating the true difference in the location or scale parameter, depending on whether the test should be performed for a difference in location or in scale.

scale

a character string specifying the scale estimator used for standardization in the test statistic; must be one of "S1", "S2", "S3", and "S4".

n.rep

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

na.rm

a logical value indicating whether NA values in x and y should be stripped before the computation proceeds.

scale.test

a logical value testing whether the samples should be compared for a difference in scale.

wobble

a logical value indicating whether the sample should be checked for duplicated values that can cause the scale estimate to be zero. If such values are present, uniform noise is added to the sample, see wobble.

wobble.seed

an integer value used as a seed for the random number generation in case of wobble = TRUE or when scale.test = TRUE with one of the vectors x and y containing zeros. When no seed is specified, it is chosen randomly and printed in a message. The argument is ignored if scale.test = FALSE and/or wobble = FALSE.

gamma

a numeric value in [0, 0.5] specifying the fraction of observations to be trimmed/replaced from each end of the sample before trimmed mean/winsorized variance.

psi

kernel used for optimization in the computation of the M-estimates. Must be one of "bisquare", "hampel" and "huber".

k

tuning parameter(s) for the respective psi function.

test.name

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

Details

The two-sample tests in this package share similar arguments. To reduce the amount of repetitive code, this function contains the argument checks so that only check_test_input needs to be called within the functions for the two-sample tests.

The scale estimators "S1" and "S2" can only be used in combination with test.name = "hl1_test" or test.name = "hl2_test". The estimators "S3" and "S4" can only be used with test.name = "med_test".

Value

An error message if a check fails.


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