LG_bandwidths_advanced: Find bandwidths to use for the local Gaussian estimates

View source: R/LG_bandwidths_advanced.R

LG_bandwidths_advancedR Documentation

Find bandwidths to use for the local Gaussian estimates

Description

The original bandwidth-algorithm gives a global result that does not work so good when used in the periphery of the data. This internal function enables us to combine the bandwidths from the original algorithm and those found by a nearest-neighbour strategy where the selection is made with regard to the requirement that a certain percentage of the total number of lagged points should be contained inside the region specified by a central point and a bandwidth-square.

Usage

LG_bandwidths_advanced(
  save_dir = NULL,
  TS,
  lag_max,
  .bws_mixture = c("mixture", "local", "global"),
  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 a Local Gaussian Approximation (and later on with Local Gaussian Spectra).

lag_max

The number of lags to include in the analysis.

.bws_mixture

An argument that specifies how the global bandwidths and those obtained by the nearest-neighbour strategy should be combined. The three available options are c("mixture", "local", "global"), which have the following effects. The alternatives local and global will respectively only select the nearest neighbour or global. These alternatives seems however to not work well when used on some parts of the lagged pairs of interest, i.e. the nearest neighbour values might be to "small" in the center of the distribution, whereas the global bandwidths seems to fail in the periphery of the distribution. The alternative mixture attempt to resolve this by (for each grid point) selecting the largest of the two alternative bandwidths. Note that the value of .bws_mixture decides how much information that is computed, i.e. the alternative local will turn off the computation of global bandwidths. However, the computations of the nearest neighbour bandwidths will also be computed when the alternative global is used, since it does not take long to compute and it is that function that creates the array we need as a mould for the result. If the user does not make a selection, then all three alternatives will be computed.

bw_points

A vector, default c(25, 35), that specifies the percentage of the observations that we want inside the "bandwidth-square". If .bws_mixture is selected to be global, then this argument will be ignored. and no nearest neighbours will be computed.

levels

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

Value

A list with the two arrays h and convergence. The array h contains the bandwidths to be used when finding local Gaussian estimates for the lagged pairs (of the time series TS) from 1 to lag_max, whereas the array convergence contains information related to the numerical convergence of the bandwidths returned from the global algorithm.


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