LG_boot_approx: Local Gaussian approximations for bootstrapped replicates

Description Usage Arguments Details Value

View source: R/LG_boot_approx.R


This is a wrapper for the function LG_approx, to be used when we want to use bootstrap-based statistics in our analysis of e.g. its local Gaussian spectra.


LG_boot_approx(save_dir = NULL, TS_boot, lag_max, LG_points,
  .bws_mixture, bw_points, .bws_fixed, .bws_fixed_only, content_details,



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


The matrix of bootstrap-replicates produced by TS_boot_sample, where we want to find estimated parameters of the local Gaussian approximations.


The number of lags to include in the analysis.


An array that specifies the point at which it is desired to compute the local Gaussian estimates. The default value NULL will imply that the values used in the computations upon the original data are recycled. Values can alternatively be computed by the help of the function LG_select_points, but these must then be a subset of the original values.


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.


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.


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.


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.


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.


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


This function can be called manually from the work-space, but the intention is that it only should be called from LG_boot_approx_scribe, since that will ensure that the arguments are properly recorded and that the result are saved to appropriately named files. In order to dissuade users from calling this (often quite time consuming) function directly, no default values have been specified for the arguments.


data.0, a data-frame with a column levels, which for each value is matched with bw_points (the prescribed numbers of observations), bw the corresponding local bandwidths, and then for each replicate in TS_boot the estimated local Gaussian approximation parameters mu and sig obtained when loclik2 has been used on the specified level. The estimated value of the density at the point of interest, f.est are also included. (Note: The square of sig gives the value we will need later on in the quest for the local Gaussian spectra based on local Gaussian auto-correlations.)

data.h, a data-frame with columns lag and levels that specify the points of interest, and for each combination of these we have information about bw_points (the prescribed numbers of observations), bw the corresponding local bandwidths, and then for each replicate in TS_boot we have from localgauss the coefficients mu_1, mu_2, sig_1, sig_2 and rho for the local bivariate Gaussian approximation. The column par_one gives the extracted local Gaussian auto-covariance that will be used in the computation of the local Gaussian spectra, and f.est gives the estimated density.

eflag, vector, which gives the sum of the exit flags from localgauss. If this is something else than 0, then it means that some value(s) for that bootstrap-replicate not should be trusted. (To find the actual problematic values, pick out the relevant replicate(s) and create a TS.object based on it, then run LG_approx on that object.)

LAJordanger/localgaussSpec documentation built on Dec. 18, 2018, 2:31 a.m.