RT1SAMP: One-sample or Paired comparison randomization test

View source: R/RT1SAMP.R

RT1SAMPR Documentation

One-sample or Paired comparison randomization test

Description

RT1SAMP carries out the Fisher randomization test or the paired comparison randomization test. The permutational one-sample randomization test does not require normality of the distribution. A randomization confidence interval for the mean can also be determined.

Usage

RT1SAMP(
  x,
  mu = 0,
  NRAND = 4999,
  alt = "two",
  complete = FALSE,
  CI = FALSE,
  silent = FALSE,
  seed = NULL
)

Arguments

x

a (non-empty) numeric vector of data values.

mu

an scalar; it is the value of mu under the null hypothesis

NRAND

numeric; the number of randomizations (permutations). It is ignored when complete=TRUE.

alt

a character string specifying the alternative hypothesis, must be one of "two" (two-sided, the default), "greater" or "less".

complete

a logical variable; when TRUE, all possible randomizations are enumerated. It is ignored when CI=TRUE.

CI

a logical variable indicating whether approximate 95\ randomization confidence intervals will be calculated (TRUE) or not (FALSE).

silent

a logical variable indicating whether calculation results are printed to the R console (silent = FALSE). If TRUE then calculation results are not printed to the R console (useful for simulations)

seed

a single value, interpreted as an integer, or NULL (see "Details").

Details

The procedure (1) calculates the mean scores for the difference between the observed data x and the value of mu under the null hypothesis mu. The user has the option to enumerate all possible randomizations or to sample the randomization distribution. In this latter case, the function sampleRD is invoked. In addition, it is possible to produce an approximate 95% / 99% confidence interval by interpolation (useful for simulations). If confidence limits are needed, the number of randomizations 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 x - mu 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 mu) 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 mu that is on the borderline of being significantly large at about the 2.5\ level. Analogously, the lower percentage points (the percentages of randomization differences less than or equal to the observed difference x - mu 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 - mu measurements producing a difference that is on the borderline of being significantly small at about the 2.5\

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.

Value

The function returns a RT result object (list)

Author(s)

Jorge Navarro-Alberto

References

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.

See Also

sampleRD, count, summary.RT and the main plotting function plot.RT

Examples


# Example in Manly and Navarro Alberto (2021), Section 1.5
Dif <- cornheight[,"Cross"] - cornheight[,"Self"]
corn1s.c <- RT1SAMP(Dif, complete=TRUE) # Complete enumerations
#
corn1s.s <- RT1SAMP(Dif, CI=TRUE) # Sampled distribution, CI for x - mu.



ganava4/rbmc documentation built on April 24, 2022, 12:14 a.m.