SiegelTukeyTest.Rd
Non-parametric Siegel-Tukey test for equality in variability.
The null hypothesis is that the variability of x is equal between two
groups. A rejection of the null hypothesis indicates that variability differs between
the two groups. SiegelTukeyRank
returns the ranks, calculated after Siegel Tukey logic.
SiegelTukeyTest(x, ...)
# Default S3 method
SiegelTukeyTest(x, y, adjust.median = FALSE,
alternative = c("two.sided", "less", "greater"),
mu = 0, exact = NULL, correct = TRUE, conf.int = FALSE,
conf.level = 0.95, ...)
# S3 method for class 'formula'
SiegelTukeyTest(formula, data, subset, na.action, ...)
SiegelTukeyRank(x, g, drop.median = TRUE)
numeric vector of data values. Non-finite (e.g. infinite or missing) values will be omitted.
a vector or factor object giving the group for the corresponding elements of x.
Should between-group differences in medians be leveled
before performing the test? In certain cases, the Siegel-Tukey test is
susceptible to median differences and may indicate significant differences
in variability that, in reality, stem from differences in medians. Default is FALSE
.
a character string specifying the alternative hypothesis, must be one of "two.sided"
(default), "greater"
or "less"
. You can specify just the initial letter.
a number specifying an optional parameter used to form the null hypothesis. See Details.
a logical indicating whether an exact p-value should be computed. This is passed directly to wilcox.test
.
a logical indicating whether to apply continuity correction in the normal approximation for the p-value.
a logical indicating whether a confidence interval should be computed.
confidence level of the interval.
a formula of the form lhs ~ rhs
where lhs
gives the data values and rhs the corresponding groups.
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)
.
an optional vector specifying a subset of observations to be used.
a function which indicates what should happen when the data contain NAs. Defaults to getOption("na.action")
.
logical, defining whether the median of the combined samples should be left out, ensuring that there's an even number of elements (which is a requirement of the Siegel-Tukey test). Defaults to TRUE
.
further arguments to be passed to or from methods.
The Siegel-Tukey test has relatively low power and may, under certain
conditions, indicate significance due to differences in medians rather than
differences in variabilities (consider using the argument adjust.median
).
Consider also using mood.test
or ansari.test
.
A list of class htest
, containing the following components:
Siegel-Tukey test (Wilcoxon test on tie-adjusted Siegel-Tukey ranks, after the median adjustment if specified).
the p-value for the test
is the value of the median specified by the null hypothesis. This
equals the input argument mu
.
a character string describing the alternative hypothesis.
the type of test applied
a character string giving the names of the data.
Siegel, S., Tukey, J. W. (1960): A nonparametric sum of ranks procedure for relative spread in unpaired samples. Journal of the American Statistical Association.
Sheskin, D. J. (2004): Handbook of parametric and nonparametric statistical procedures 3rd edition. Chapman and Hall/CRC. Boca Raton, FL.
# Duller, S. 183
x <- c(12, 13, 29, 30)
y <- c(15, 17, 18, 24, 25, 26)
SiegelTukeyTest(x, y)
#>
#> Siegel-Tukey-test for equal variability
#>
#> data: x and y
#> ST = 10, p-value = 0.009524
#> alternative hypothesis: true ratio of scales is not equal to 1
#>
SiegelTukeyTest(x, y, alternative="greater")
#>
#> Siegel-Tukey-test for equal variability
#>
#> data: x and y
#> ST = 10, p-value = 0.004762
#> alternative hypothesis: true ratio of scales is greater than 1
#>
# Duller, S. 323
old <- c(870,930,935,1045,1050,1052,1055)
new <- c(932,970,980,1001,1009,1030,1032,1040,1046)
SiegelTukeyTest(old, new, alternative = "greater")
#>
#> Siegel-Tukey-test for equal variability
#>
#> data: old and new
#> ST = 34, p-value = 0.002622
#> alternative hypothesis: true ratio of scales is greater than 1
#>
# compare to the recommended alternatives
mood.test(old, new, alternative="greater")
#>
#> Mood two-sample test of scale
#>
#> data: old and new
#> Z = 2.8666, p-value = 0.002075
#> alternative hypothesis: greater
#>
ansari.test(old, new, alternative="greater")
#>
#> Ansari-Bradley test
#>
#> data: old and new
#> AB = 18, p-value = 0.001573
#> alternative hypothesis: true ratio of scales is greater than 1
#>
# Bortz, S. 250
x <- c(26.3,26.5,26.8,27.0,27.0,27.2,27.3,27.3,27.4,27.5,27.6,27.8,27.9)
id <- c(2,2,2,1,2,2,1,2,2,1,1,1,2)-1
SiegelTukeyTest(x ~ id)
#> Warning: cannot compute exact p-value with ties
#>
#> Siegel-Tukey-test for equal variability
#>
#> data: x by id
#> ST = 35.5, p-value = 0.6842
#> alternative hypothesis: true ratio of scales is not equal to 1
#>
# Sachs, Angewandte Statistik, 12. Auflage, 2007, S. 314
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.1)
SiegelTukeyTest(A, B)
#> Warning: cannot compute exact p-value with ties
#>
#> Siegel-Tukey-test for equal variability
#>
#> data: A and B
#> ST = 134.5, p-value = 0.02324
#> alternative hypothesis: true ratio of scales is not equal to 1
#>
### 1
x <- c(4,4,5,5,6,6)
y <- c(0,0,1,9,10,10)
SiegelTukeyTest(x, y)
#> Warning: cannot compute exact p-value with ties
#>
#> Siegel-Tukey-test for equal variability
#>
#> data: x and y
#> ST = 57, p-value = 0.003601
#> alternative hypothesis: true ratio of scales is not equal to 1
#>
### 2
# example for a non equal number of cases:
x <- c(4,4,5,5,6,6)
y <- c(0,0,1,9,10)
SiegelTukeyTest(x, y)
#> Warning: cannot compute exact p-value with ties
#>
#> Siegel-Tukey-test for equal variability
#>
#> data: x and y
#> ST = 15, p-value = 0.01141
#> alternative hypothesis: true ratio of scales is not equal to 1
#>
### 3
x <- c(33, 62, 84, 85, 88, 93, 97, 4, 16, 48, 51, 66, 98)
id <- c(0,0,0,0,0,0,0,1,1,1,1,1,1)
SiegelTukeyTest(x ~ id)
#>
#> Siegel-Tukey-test for equal variability
#>
#> data: x by id
#> ST = 24, p-value = 0.202
#> alternative hypothesis: true ratio of scales is not equal to 1
#>
### 4
x <- c(177,200,227,230,232,268,272,297,47,105,126,142,158,172,197,220,225,230,262,270)
id <- c(rep(0,8),rep(1,12))
SiegelTukeyTest(x ~ id, adjust.median=TRUE)
#>
#> Siegel-Tukey-test for equal variability
#>
#> data: x by id
#> ST = 106, p-value = 0.09788
#> alternative hypothesis: true ratio of scales is not equal to 1
#>
### 5
x <- c(33,62,84,85,88,93,97)
y <- c(4,16,48,51,66,98)
SiegelTukeyTest(x, y)
#>
#> Siegel-Tukey-test for equal variability
#>
#> data: x and y
#> ST = 24, p-value = 0.202
#> alternative hypothesis: true ratio of scales is not equal to 1
#>
### 6
x <- c(0,0,1,4,4,5,5,6,6,9,10,10)
id <- c(0,0,0,1,1,1,1,1,1,0,0,0)
SiegelTukeyTest(x ~ id)
#> Warning: cannot compute exact p-value with ties
#>
#> Siegel-Tukey-test for equal variability
#>
#> data: x by id
#> ST = 21, p-value = 0.003601
#> alternative hypothesis: true ratio of scales is not equal to 1
#>
### 7
x <- c(85,106,96, 105, 104, 108, 86)
id <- c(0,0,1,1,1,1,1)
SiegelTukeyTest(x ~ id)
#>
#> Siegel-Tukey-test for equal variability
#>
#> data: x by id
#> ST = 4, p-value = 0.2667
#> alternative hypothesis: true ratio of scales is not equal to 1
#>