TS_boot_sample: Create bootstrap-replicates of a time series.

View source: R/TS_boot_sample.R

TS_boot_sampleR Documentation

Create bootstrap-replicates of a time series.

Description

This internal function will, based on the specified bootstrapping-algorithm and the given time series, create and save a matrix of bootstrapped time series.

Usage

TS_boot_sample(
  TS,
  main_dir,
  save_dir,
  nb = 5,
  boot_type = c("cibbb_tuples", "block"),
  block_length = 20,
  boot_seed = NULL
)

Arguments

TS

The original time series that we want to create bootstrap-replicates of.

main_dir

The path to the main directory, that contains the file-hierarchy created when using the local Gassian approach for the investigation of time series.

save_dir

A specification of the directory to be used when saving (and loading) data. The default value NULL will turn of the interaction with disk.

nb

An integer that specifies how many bootstrap-replicates we want to use in our analysis. Default value 5 (at least in the development phase).

boot_type

This argument should be either "cibbb_tuples" or "block", the former gives an implementation of the circular index-based block bootstrap for tuples adjustment, whereas the latter gives the ordinary block bootstrap. The default option is "cibbb_tuples".

block_length

The length of the blocks to be used when boot_type="block" is used. Default value 20 in the development phase, but I suppose in general it should be some formula based on the time series under investigation.

boot_seed

Use this to enable reproducible results. The default value NULL will trigger a random seed to be selected for this value (that then will be recorded in case a reproduction of the result is desired later on).

Details

The bootstrapped replicates are stored in a matrix with nb rows and length(TS) columns, i.e. each row is a bootstrapped replicate of TS.

Value

A list with the following three components is returned to the internal workflow.

main_dir

The path (to the hierarchy) given by the main_dir-argument.

TS

The internal (in-hierarchy) path to the saved data.

save_dir

The (in-hierarchy) name of the directory that the files are saved into.


LAJordanger/localgaussSpec documentation built on May 6, 2023, 4:31 a.m.