bws_nearest_neighbour: Compute nearest-neighbour bandwidths, (with file-storage).

View source: R/bws_nearest_neighbour.R

bws_nearest_neighbourR Documentation

Compute nearest-neighbour bandwidths, (with file-storage).

Description

This internal function will check if a file with previous computations exists, and if so rather read the results from that file than recomputing the results. If no file is found in the specified directory, or if only some of the results are computed, then it will do the required computations and create a file to be used later on.

Usage

bws_nearest_neighbour(
  save_dir = NULL,
  TS,
  lag_min = 0,
  lag_max,
  bw_points = c(25, 35),
  levels
)

Arguments

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.

TS

The time series we want to investigate by means of local Gaussian approximation (and later on with local Gaussian spectra). Note that it is assumed that this time series have normalised marginals.

lag_min

A non-negative integer, default value 0, that specifies the lowest lagged pairs to compute the bandwidths for. This allows the computation of the bandwidths to be performed in smaller chunks.

lag_max

How many lags should be included in the analysis.

bw_points

A vector, default c(25, 35), that specifies the percentage of the observations that we want inside the "bandwidth-square".

levels

The points at which we (for different lags) want to center "bandwidth-squares" that encapsulates the desired percentage (given by bw_points of the lagged pairs. The format of levels must be a matrix with one row for each point of interest, and with columns named c("v1", "v2").

Value

This function will return a list with the desired "nearest-neighbour" bandwidths to the work-flow, one part for the lag zero case and one part for positive lags. In addition will there be created/update a file with the desired information. If later on there's a need for a computation with a higher value for lag_max, then the values from the saved file will be used in order to avoid redoing previous computations.


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