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.
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",
...
)A list object containing the following fields:
Input data
Input wavelet parameters
Input parameters
A vector of length length(x) containing the trend estimate
Returned if T.CI = TRUE. The lower limit of the pointwise confidence interval
Returned if T.CI = TRUE. The upper limit of the pointwise confidence interval
Returned if T.CI = TRUE. The number of bootstrap replicates used to compute
pointwise confidence interval
Returned if T.CI = TRUE. The significance level of the pointwise confidence interval
The time series you want to estimate the trend function of.
You must supply the estimate of the evolutionary wavelet
spectrum of the time series. This is the output of the ewspec.diff
function.
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.
Selects the wavelet family to use. Recommended to only use the Daubechies compactly supported wavelets DaubExPhase and DaubLeAsymm.
The type of thresholding function used. Currently only
"soft" and "hard" (default) are available.
If TRUE, uses a threshold assuming the data are normally distributed. If FALSE, uses a larger threshold to reflect non-normality.
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.
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.
Logical variable, decides if boundary handling should be applied to the time series before estimation.
Logical variable. If TRUE, a bootstrapped (1-sig.lvl)
pointwise confidence interval is computed for the trend estimate.
Used only if T.CI = TRUE; the number of bootstrap
replications used to calculate the confidence interval.
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.
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.
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.
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.
TLSW