TS_acr: Autocovariances and autocorrelations the old-fashioned way.

View source: R/TS_acr.R

TS_acrR Documentation

Autocovariances and autocorrelations the old-fashioned way.

Description

This internal function use the "old-fashioned" way to compute the autocorrelations (and cross-correlations) for a given time series, i.e. the summation-approach. This is much slower than the fast Fourier transform approach used by acf, but it seems more natural to use this when computing the ordinary spectral density in the old fashioned way (using lag-window functions instead of periodograms).

The .TS_info-argument is given to the internal function TS_load, which loads the TS-part from file when required. TS_load will also compute the name of the directory in which the result should be stored.

Usage

TS_acr(.TS_info, lag_max = quote(ceiling(3 * sqrt(length(TS)))))

Arguments

.TS_info

A list containing the three components TS, main_dir and save_dir.

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.

Value

A file will be created containing an array with the (ordinary) autocorrelations (and cross-correlations) of TS. A list with the following to components will be returned to the internal workflow, in order to be added to the 'info'-object.

.acr_type

This will either simply be "acr" or "acr_boot". The suffix "boot" is added when the computations are based on bootstrapped replicates of an original time series. (The information about the bootstrap-status is available as an attribute of the TS-object the computation is based on.)

.acr_content

This will be a vector with the components needed in order to load the saved result back into the workflow.


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