LG_approx: Approximations of the local Gaussian auto- and...

View source: R/LG_approx.R

LG_approxR Documentation

Approximations of the local Gaussian auto- and cross-correlations

Description

This function approximates the local Gaussian auto- and cross-correlations for the given combination of tuning parameters.

Usage

LG_approx(
  save_dir = NULL,
  TS,
  lag_max = ceiling(3 * sqrt(length(TS))),
  LG_points,
  .bws_mixture = c("mixture", "local", "global"),
  bw_points = c(25, 35),
  .bws_fixed = NULL,
  .bws_fixed_only = FALSE,
  content_details = c("rho_only", "rho_log.fun", "rho_all"),
  LG_type = c("par_five", "par_one")
)

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 techniques based on local Gaussian approximations. Note that this argument in the "wrapper"- and "scribe"-functions can be given as a character vector that specifies the file where TS from TS_LG_object was stored.

lag_max

The number of lags to include in the analysis. The default value ceiling(3*sqrt(length(TS))) will probably in most cases include more lags than actually required. It might thus be worthwhile to run some test and see if a smaller value can be used instead.

LG_points

An array that specifies the point at which it is desired to compute the local Gaussian estimates. Use the function LG_select_points to create this argument.

.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.

.bws_fixed

A vector of non-negative real values, that can be used to specify fixed values for the bandwidths (which might be of interest to do in a preliminary analysis). The default value NULL will prevent the computation of Local Gaussian Estimates based on fixed bandwidths.

.bws_fixed_only

A logic value, default FALSE, that can be used to drop the rather time-consuming data-driven estimation of bandwidths in favour of the simplified approach where fixed bandwidths are used instead. Note that .bws_fixed must be specified when .bws_fixed_only are set to TRUE.

content_details

A character string from c("rho_only", "rho_log.fun", "rho_all"), of which the first will be selected if the user doesn't specify something else. The purpose of this argument is to decide the amount of details that should be stored from the estimates governed by the argument LG_type. The default rho_only is the one needed for the computation of the Local Gaussian Spectral Densities, whereas rho_log.fun in addition returns the estimated values of the logarithm of the density. The option rho_all will in addition return all the parameters when LG_type is given as par_five.

LG_type

One of c("par_five", "par_one"), i.e. should the Local Gaussian Autocorrelations be based on the approach using five parameters or the simplified approach using only one parameter. The default choice is "par_five".

Value

This function will return a list with nodes as described below:

LG_type

The value of the argument LG_type. This is included in order to simplify the code later on.

.bws_mixture

The value of the argument .bws_mixture. This is included in order to simplify the code later on.

content_details

The value of the argument content_details. This is included in order to simplify the code later on.

par_one_data

This will be null if LG_type does not contain "par_one", otherwise it will contain information about the Local Gaussian approximation based on the one free parameter approach. This can contain NA-values if some numerical convergence failed.

par_five_data

This will be null if LG_type does not contain "par_five", otherwise it will contain information about the Local Gaussian approximation based on the five free parameters approach. This object contains an attribute convergence that reveals if the numerical convergence of the function localgauss was successful.

level_points

The attributes that the LG_extend_points-function added when it was given the LG_points-argument.

Note

Regarding the case where the LG_type-argument is equal to "par_one": The author of this package has always considered the "par_one"-approach to be reasonable when the aim of the investigation is to estimate a density at a given point. However, the extraction of the correlation value from the resulting density-estimate will in general not capture the local geometrical properties of the targeted distribution at the point of investigation. The "par_one"-approach is as such (in general) a complete waste of computation resources.

It is not intended that this function should be called directly. The idea is that the function LG_approx_scribe should be called, which then (after some sanity testing of the arguments) will call this function only when it is necessary, i.e. it will keep track of the bookkeeping and prevent previously computed results from being recomputed.


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