calculatePower: Estimate the power of the random thinning test based on the...

Description Usage Arguments Value Examples

Description

Estimate the power of the random thinning test based on the properties a given time-series

Usage

1
2
3
calculatePower(ts, p, nMC = 1000, nThin = 1000, its = NULL,
  fr = c(0.001, 0.025, 0.01, 0.025, 0.1), pThreshold = 0.05,
  useNApattern = FALSE)

Arguments

ts

A time-series (a numeric vector)

p

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

nMC

Number of samples to estimate the power (a positive integer)

nThin

Number of resamples to use in the random thinning test (a positive integer)

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)

pThreshold

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)

useNApattern

Logical value - if TRUE, the synthetic time-series inherit the same missingness pattern as in the original time-series

Value

A numeric vector, with one entry per value of fr, giving the power of the test for this particular value

Examples

1
2
3
4
5
6
7
8
9
## 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)
calculatePower(ts = x, p = 8, nMC = 200, nThin = 200,
                           fr = c(0.01,0.025,0.1))

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