Description Usage Arguments Value Note References See Also Examples
The statistic for the nested ranks test is a Z-score calculated by
comparing ranks between treatment levels, with contributions of each group
to the final Z-score weighted by group size. The p-value is determined by
comparing the observed Z-score against a distribution of Z-scores
calculated by bootstrapping ranks assuming no influence of treatment while
respecting group sizes. When there is just one group, this test is
essentially identical to a standard Mann-Whitney-Wilcoxon test. This test
is intended to be a mixed-model extension of the wilcox.test
,
for which treatment is a fixed effect and group membership is a random
effect.
1 2 3 4 5 6 | ## S3 method for class 'formula'
nestedRanksTest(formula, data, groups = NULL, subset, ...)
## Default S3 method:
nestedRanksTest(x, y, groups, n.iter = 10000,
lightweight = FALSE, ...)
|
formula |
A formula of the form |
data |
An optional matrix or data frame (or similar: see
|
groups |
A (non-empty) vector specifying group membership for each
|
subset |
An optional vector specifying a subset of observations to be used. |
... |
Further arguments to be passed to or from methods. |
x |
A (non-empty) vector of treatments for each |
y |
A (non-empty) numeric vector of data values. |
n.iter |
Number of bootstrap iterations to perform. The value of
the final iteration is provided by the observed Z-score.
Using |
lightweight |
If |
A list with class 'htest_boot'
based on class
'htest'
containing the following components. Components
marked with "*"
are additions to 'htest'
.
statistic | the value of the observed Z-score. |
p.value | the p-value for the test. |
alternative | a character string describing the alternative hypothesis. |
method | a character string indicating the nested ranks test performed. |
data.name | a character string giving the name(s) of the data. |
bad.obs | the number of observations in the data
excluded because of NA values. |
null.values | quantiles of the null distribution used for calculating the p-value. |
n.iter* | the number of bootstrap iterations used for generating the null distribution. |
weights* | the weights for groups, calculated by
nestedRanksTest_weights . |
null.distribution* | null distribution of Z-scores, with
statistic the last value. |
The length of null.distribution
equals n.iter
. Note that
null.distribution
will not be present if the
lightweight = TRUE
option was given to nestedRanksTest
.
Cases for which any of x
, y
or groups
are
NA
are removed.
The generation of a null distribution can take some time. For
example, if any use of nestedRanksTest
in the examples were
run with the default n.iter = 10000
, completion would require
a few seconds.
Thompson, P. G., Smouse, P. E., Scofield, D. G. and Sork, V. L. (2014) What seeds tell us about birds: a multi-year analysis of acorn woodpecker foraging movements. Movement Ecology 2:12. http://www.movementecologyjournal.com/content/2/1/12
https://github.com/douglasgscofield/nestedRanksTest
wilcox.test
, print.htest_boot
,
plot.htest_boot
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | require(graphics)
data(woodpecker_multiyear)
## S3 method for class 'formula'
## n.iter set to 1000 to shorten completion time
## group in formula
nestedRanksTest(Distance ~ Year | Granary, n.iter = 1000,
data = woodpecker_multiyear,
subset = Species == "agrifolia")
## group in 'groups='
nestedRanksTest(Distance ~ Year, groups = Granary, n.iter = 1000,
data = woodpecker_multiyear,
subset = Species == "lobata")
## Default S3 method
dat.a <- subset(woodpecker_multiyear, Species == "agrifolia")
## arguments in default order
nestedRanksTest(dat.a$Year, dat.a$Distance, dat.a$Granary, n.iter = 1000)
## named arguments used in 'formula' order
res <- with(subset(woodpecker_multiyear, Species == "lobata"),
nestedRanksTest(y = Distance, x = Year, groups = Granary,
n.iter = 1000))
plot(res)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.