randomThinningTest: Perform the random thinning test

Description Usage Arguments Value Examples

Description

Perform the random thinning test

Usage

1
2
randomThinningTest(ts, its = NULL, fr = 0.05, p = 5, n = 1000,
  alpha = 0.05, returnExtraInfo = FALSE)

Arguments

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.

fr

Which fractions to consider discarding (a numeric vector, with values between 0 and 1, although it is best if they are kept between between 0.001 and 0.2)

p

Length of the period to test for (a positive integer)

n

Number of resamples to use in the random thinning 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 TRUE, the function will return extra information (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). If FALSE, only the p-value is returned.

Value

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

Examples

 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)
randomThinningTest(ts = x, p = 8, n = 1000,
                   fr = 0.025, returnExtraInfo = TRUE)

## compare with periods either too short or too long:
randomThinningTest(ts = x, p = 7, n = 1000, fr = 0.025)
randomThinningTest(ts = x, p = 9, n = 1000, fr = 0.025)

JeremySilver/RandomThinning documentation built on May 30, 2019, 9:40 p.m.