count | R Documentation |
Carries out the Fisher randomization test or the paired comparison
randomization test. It is a convenience function invoked by the fuller
function RT1SAMP
.
count(x, mu = 0)
x |
a (non-empty) numeric vector of data values. |
mu |
an scalar used in Fisher's one-sample randomization test, where only a single sample is concerned rather than paired comparisons, and the question of interest is whether this sample could have come from a population with a mean equal to a particular value μ. |
The function calculates the sum of elements in x
as the test
statistic; then the full set of 2^n elements (n = length(x)
)
in the randomization distribution of the test statistic are generated by
consecutively changing the sign of each element in x
. In this way
all possible signs of all elements in x
occur by the time the
2^n-th calculation is made. The assumption made is that the
significance level of the observed statistic Sobs
is the proportion
of randomized values greater than or equal to Sobs
. For a lower tail
test, the proportion is incremented if the randomized values of the test
statistic are less than or equal Sobs
. For a two-tailed test, the
proportion is incremented if the absolute value of the values attained by
the randomized test statistic are greater than or equal the absolute value
of the observed test statistic.
The function returns a RT
result object (list).
Sobs |
Observed sum of elements in |
name |
A character string giving the name of the test. |
P |
A numeric vector, giving the p-value for the lower-, upper-, and two-tailed tests, respectively |
nperm |
An scalar, namely 2^n, the number of elements in the full randomization distribution |
Jorge Navarro-Alberto
Manly, B.F.J. and Navarro-Alberto, J.A. (2021) Randomization, Bootstrap and Monte Carlo Methods in Biology. 4th Edition. CRC Press.
RT1SAMP
, the main function for Fisher's (or paired
sample) randomization test.
# Example in Manly and Navarro Alberto (2021), Section 5.1 Dif <- cornheight[,"Cross"] - cornheight[,"Self"] Results.count <- count(Dif) Results.count
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.