rob_scale: Robust scale estimators based on median absolute deviation

View source: R/scaleEstimators.R

rob_scaleR Documentation

Robust scale estimators based on median absolute deviation

Description

rob_scale calculates an estimator for the within-sample dispersion based on two samples.

Usage

rob_scale(
  x,
  y,
  type = c("S1", "S2", "S3", "S4"),
  na.rm = FALSE,
  check.for.zero = FALSE
)

Arguments

x

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

y

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

type

character that specifies the estimator for the variance, can be "S1", "S2", "S3" and "S4"; see details for description of the scale estimators.

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.

check.for.zero

logical value indicating a warning should be triggered if the scale estimate is zero. The default is FALSE.

Details

For definitions of the scale estimators, see Fried and Dehling (2011).

If check.for.zero = TRUE, an error is thrown when the scale estimate is zero. This argument is only included because the function is used in rob_perm_statistic to compute values of robust test statistics where the scale estimate is used for standardization. A scale estimate of zero leads to a non-existing test statistic, so that the corresponding test cannot be performed.

Value

An estimate of the pooled variance of the two samples.

References

\insertRef

FriDeh11roburobnptests


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