RT2SAMP | R Documentation |
RT2SAMP carries out a two sample randomization test on the mean difference between two samples. A randomization confidence interval for the mean difference between two source populations can also be determined.
RT2SAMP( x, y, NRAND = 4999, alt = "two", CI = FALSE, silent = FALSE, seed = NULL )
x |
a (non-empty) numeric vector of data values. |
y |
a (non-empty) numeric vector of data values. |
NRAND |
numeric; the number of randomizations (permutations). |
alt |
a character string specifying the alternative hypothesis, must
be one of " |
CI |
a logical variable indicating whether approximate 95% and
99% randomization confidence intervals will be calculated ( |
silent |
a logical variable indicating whether calculation results are
printed to the R console ( |
seed |
a single value, interpreted as an integer, or |
The procedure (1) calculates the mean scores for vectors x
and
y
, and the difference D[0]
between these; then (2)
length(x)
and length(y)
observations are randomly reallocated
to the first and second group, respectively, using the sample
function. Step (2) is repeated NRAND
times to find the randomization
distribution of D
differences. alt = "greater"
is the
alternative that x has a larger mean than y.
The randomization test allows confidence intervals to be placed on
treatment effects (when CI = TRUE
), as described in Manly and
Navarro (2021, Section 1.4). If confidence limits are needed, NRAND
should be a large enough number (probably 4999 or more). The upper
percentage points (percentages of randomization differences greater than or
equal to the observed between x
and y
means) can be
determined for a range of trial values for L and U, which, when subtracted
from the x
, just avoid giving a significant difference between the
two sample means. The upper percentage points (percentages of randomization
differences greater than or equal to the observed difference between
x
and y
) can be determined for a range of trial values for L,
and linear interpolation is used to determine the value of L to be
substracted from the x
measurements producing a difference between
x
and y
that is on the borderline of being significantly
large at about the 2.5% or 0.5%. Analogously, the lower percentage
points (the percentages of randomization differences less than or equal to
the observed difference between x
and y
means) can be
determined for some trial values of U. Again, linear interpolation is used
to determine the value of U to be substracted from the x
measurements producing a difference between x
and y
that is
on the borderline of being significantly small at about the 2.5% or
0.5% level.
seed
is a way to call the set.seed
function,
"the recommended way to specify seeds" in random number generation.
The function summary.RT
is used to obtain and print a summary of the
results, and a plot.RT
method is available for displaying the
randomization distribution of mean differences.
The function returns a RT
result object (list)
Jorge Navarro-Alberto
Manly, B.F.J. and Navarro-Alberto, J.A. (2021) Randomization, Bootstrap and Monte Carlo Methods in Biology. 4th Edition. Chapman and Hall/ CRC Press.
summary.RT
and the main plotting function
plot.RT
# Example in Manly and Navarro Alberto (2021), Section 1.1 male <- jackals$Mand.length[jackals$Sex=="M"] female <- jackals$Mand.length[jackals$Sex=="F"] jackals.RT2 <- RT2SAMP(male, female, alt="greater")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.