ts_permtest_block: Permutation Test: Block Randomisation

View source: R/ts.R

ts_permtest_blockR Documentation

Permutation Test: Block Randomisation

Description

Use block randomistion to get a permutation test evaluation of the deviation of an observed value at each time point from a target value. To do block permutation without any tests, pass NULL for argument targetValue.

Usage

ts_permtest_block(
  y1,
  y2 = NULL,
  targetValue = 0,
  Nperms = 19,
  sim = "geom",
  l = 3,
  alpha = 0.05,
  returnBootObject = FALSE,
  ...
)

Arguments

y1

Time series 1. The goal of the permutation test will be to decide whether the difference y1-targetValue != 0 for each time point, given alpha.

y2

An optional second time series. If this timeseries is provided then the goal of the permutation test will be the to decide wether the difference y2-y1 != targetValue for each time point, given alpha.

targetValue

The target value for the permutation test. If NULL, the function will return a data frame with the block randomised surrogates columns (default = 0)

Nperms

Number of permutations (default = 19)

sim

Value passed to the sim argument of boot::tsboot() valid options are: ⁠"model","fixed","geom","scramble"⁠ (default = "geom")

l

Block sizes to use, see boot::tsboot() for details (default = 3)

alpha

Alpha level for deciding significance (default = 0.05)

returnBootObject

Return the boot object (default = FALSE)

...

Other arguments passed to function boot::tsboot()

Value

A data frame with the difference time series and variables indicating N and significance.

See Also

Other Time series operations: ts_center(), ts_changeindex(), ts_checkfix(), ts_detrend(), ts_diff(), ts_discrete(), ts_duration(), ts_embed(), ts_integrate(), ts_levels(), ts_peaks(), ts_permtest_transmat(), ts_rasterize(), ts_sd(), ts_slice(), ts_slopes(), ts_standardise(), ts_sumorder(), ts_symbolic(), ts_trimfill(), ts_windower()

Examples


set.seed(4321)
y1 <- rnorm(5000)
y2 <- y1-(mean(y1)+rnorm(1))

ts_permtest_block(y1 = y1, y2 = y2)


FredHasselman/casnet documentation built on April 20, 2024, 3:05 p.m.