wav.diff.trend.est: Wavelet Thresholding Trend Estimation of Time Series

View source: R/wav.diff.trend.est.R

wav.diff.trend.estR Documentation

Wavelet Thresholding Trend Estimation of Time Series

Description

Internal function to compute the wavelet thresholding trend estimate for a time series that may be second-order nonstationary. The function calculates the wavelet transform of the time series, thresholds the coefficients based on an estimate of their variance, and inverts to give the trend estimate. This function is not intended for general use by regular users of the package.

Usage

wav.diff.trend.est(
  x,
  spec.est,
  filter.number = 4,
  family = "DaubExPhase",
  thresh.type = "hard",
  normal = TRUE,
  transform.type = "nondec",
  max.scale = floor(0.7 * log2(length(x))),
  boundary.handle = FALSE,
  T.CI = FALSE,
  reps = 199,
  sig.lvl = 0.05,
  confint.type = "normal",
  ...
)

Arguments

x

The time series you want to estimate the trend function of.

spec.est

You must supply the estimate of the evolutionary wavelet spectrum of the time series. This is the output of the ewspec.diff function.

filter.number

Selects the index of the wavelet used in the estimation procedure. For Daubechies compactly supported wavelets the filter number is the number of vanishing moments.

family

Selects the wavelet family to use. Recommended to only use the Daubechies compactly supported wavelets DaubExPhase and DaubLeAsymm.

thresh.type

The type of thresholding function used. Currently only "soft" and "hard" (default) are available.

normal

If TRUE, uses a threshold assuming the data are normally distributed. If FALSE, uses a larger threshold to reflect non-normality.

transform.type

String giving the type of wavelet transform used. Can be "dec", in which case a standard (decimated) wavelet transform is used, or "nondec", (default) in which case a nondecimated transform is used.

max.scale

Selects the number of scales of the wavelet transform to apply thresholding to. Should be a value from 1 (finest) to J-1 (coarsest), where n =2^J is the length of the time series. Recommended to use 0.7 J scales.

boundary.handle

Logical variable, decides if boundary handling should be applied to the time series before estimation.

T.CI

Logical variable. If TRUE, a bootstrapped (1-sig.lvl) pointwise confidence interval is computed for the trend estimate.

reps

Used only if T.CI = TRUE; the number of bootstrap replications used to calculate the confidence interval.

sig.lvl

Used only if T.CI = TRUE; a numeric value (0 <= sig.lvl <= 1) with which a (1-sig.lvl) pointwise confidence interval for the trend estimate is generated.

confint.type

Used only if T.CI = TRUE; the type of confidence interval computed. Can be "percentile", in which case empirical percentiles are used, or "normal" (default), in which case the normal approximation is used.

...

Further arguments to be passed to the ewspec.diff call, only to be used if T.CI = TRUE.

Details

Estimates the trend function of a locally stationary time series, by incorporating the evolutionary wavelet spectrum estimate in a wavelet thresholding procedure. To use this function, first compute the spectral estimate of the time series, using the function ewspec.diff.

The function works as follows:

1. The wavelet transform of the time series is calculated.

2. The wavelet coefficients at scale j and location k are individually thresholded using the universal threshold \hat{\sigma}_{j,k}\sqrt{2 \log n}, where \hat{\sigma}_{j,k}^2 is an estimate of their variance. The variance estimate is calculated using the spectral estimate, supplied by the user in the spec argument.

3. The inverse wavelet transform is applied to obtain the final estimate.

Value

A list object containing the following fields:

x

Input data

filter.number, family

Input wavelet parameters

transform.type, max.scale, boundary.handle, thresh.type, normal, T.CI

Input parameters

T

A vector of length length(x) containing the trend estimate

lower.CI

Returned if T.CI = TRUE. The lower limit of the pointwise confidence interval

upper.CI

Returned if T.CI = TRUE. The upper limit of the pointwise confidence interval

reps

Returned if T.CI = TRUE. The number of bootstrap replicates used to compute pointwise confidence interval

sig.lvl

Returned if T.CI = TRUE. The significance level of the pointwise confidence interval

References

McGonigle, E. T., Killick, R., and Nunes, M. (2022). Modelling time-varying first and second-order structure of time series via wavelets and differencing. Electronic Journal of Statistics, 6(2), 4398-4448.

See Also

TLSW


TrendLSW documentation built on May 29, 2024, 6:06 a.m.