siegelTukeyTest: Siegel-Tukey Rank Dispersion Test

View source: R/siegelTukeyTest.R

siegelTukeyTestR Documentation

Siegel-Tukey Rank Dispersion Test

Description

Performs Siegel-Tukey non-parametric rank dispersion test.

Usage

siegelTukeyTest(x, ...)

## Default S3 method:
siegelTukeyTest(
  x,
  y,
  alternative = c("two.sided", "greater", "less"),
  median.corr = FALSE,
  ...
)

## S3 method for class 'formula'
siegelTukeyTest(formula, data, subset, na.action, ...)

Arguments

x, y

numeric vectors of data values.

...

further arguments to be passed to or from methods.

alternative

a character string specifying the alternative hypothesis, must be one of "two.sided" (default), "greater" or "less". You can specify just the initial letter.

median.corr

logical indicator, whether median correction should be performed prior testing. Defaults to FALSE.

formula

a formula of the form response ~ group where response gives the data values and group a vector or factor of the corresponding groups.

data

an optional matrix or data frame (or similar: see model.frame) containing the variables in the formula formula. By default the variables are taken from environment(formula).

subset

an optional vector specifying a subset of observations to be used.

na.action

a function which indicates what should happen when the data contain NAs. Defaults to getOption("na.action").

Details

Let x and y denote two identically and independently distributed variables of at least ordinal scale. Further, let \theta, and \lambda denote location and scale parameter of the common, but unknown distribution. Then for the two-tailed case, the null hypothesis H: \lambda_x / \lambda_y = 1 | \theta_x = \theta_y is tested against the alternative, A: \lambda_x / \lambda_y \ne 1.

The data are combinedly ranked according to Siegel-Tukey. The ranking is done by alternate extremes (rank 1 is lowest, 2 and 3 are the two highest, 4 and 5 are the two next lowest, etc.). If no ties are present, the p-values are computed from the Wilcoxon distribution (see Wilcoxon). In the case of ties, a tie correction is done according to Sachs (1997) and approximate p-values are computed from the standard normal distribution (see Normal).

If both medians differ, one can correct for medians to increase the specificity of the test.

Value

A list with class "htest" containing the following components:

method

a character string indicating what type of test was performed.

data.name

a character string giving the name(s) of the data.

statistic

the estimated quantile of the test statistic.

p.value

the p-value for the test.

parameter

the parameters of the test statistic, if any.

alternative

a character string describing the alternative hypothesis.

estimates

the estimates, if any.

null.value

the estimate under the null hypothesis, if any.

Source

The algorithm for the Siegel-Tukey ranks was taken from the code of Daniel Malter. See also the blog from Tal Galili (02/2010, https://www.r-statistics.com/2010/02/siegel-tukey-a-non-parametric-test-for-equality-in-variability-r-code/, accessed 2018-08-05).

References

Sachs, L. (1997), Angewandte Statistik. Berlin: Springer.

Siegel, S., Tukey, J. W. (1960), A nonparametric sum of ranks procedure for relative spread in unpaired samples, Journal of the American Statistical Association 55, 429–455.

Examples

## Sachs, 1997, p. 376
A <- c(10.1, 7.3, 12.6, 2.4, 6.1, 8.5, 8.8, 9.4, 10.1, 9.8)
B <- c(15.3, 3.6, 16.5, 2.9, 3.3, 4.2, 4.9, 7.3, 11.7, 13.7)
siegelTukeyTest(A, B)

## from example var.test
x <- rnorm(50, mean = 0, sd = 2)
y <- rnorm(30, mean = 1, sd = 1)
siegelTukeyTest(x, y, median.corr = TRUE)

## directional hypothesis
A <- c(33, 62, 84, 85, 88, 93, 97)
B <- c(4, 16, 48, 51, 66, 98)
siegelTukeyTest(A, B, alternative = "greater")


PMCMRplus documentation built on Nov. 27, 2023, 1:08 a.m.