Description Usage Arguments Value Examples
Perform the random shuffle test
1 2 | randomShuffleTest(ts, its = NULL, blockLength = 1, p = 5, n = 1000,
alpha = 0.05, returnExtraInfo = FALSE)
|
ts |
A time-series (a numeric vector) |
its |
Indices of which bin the values of x correspond to (a numeric vector of integers between 1 and p). This is optional, and taken to be cyclical by default. |
blockLength |
Shuffle the order of blocks of this length (a positive integer between 1 and less than |
p |
Length of the period to test for (a positive integer) |
n |
Number of resamples to use in the random shuffle test (a positive integer) |
alpha |
P-value threshold to use when calculating the power (a positive scalar between 0 and 1, although it is recommended to be around 0.05) |
returnExtraInfo |
Logical value - if |
This depends on the value of returnExtraInfo
:
- if returnExtraInfo
is FALSE
(the default), the function returns the p-value only
- if returnExtraInfo
is TRUE
, the function returns a list with the p-value, the value of the range test statistic, the mean per bin, the departures within each bin from the mean value, and a confidence interval on the p-value
1 2 3 4 5 6 7 8 9 10 11 12 13 | ## Generate a random time-series:
## - length = 1000
## - signal period = 8
## - signal to noise ratio = 0.2
set.seed(42)
x <- rep(rnorm(8)*0.2,length.out = 1000) + rnorm(1000)
randomShuffleTest(ts = x, p = 8, n = 1000,
blockLength = 10, returnExtraInfo = TRUE)
## compare with periods either too short or too long:
randomShuffleTest(ts = x, p = 7, n = 1000, blockLength = 10)
randomShuffleTest(ts = x, p = 9, n = 1000, blockLength = 10)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.