smooth.over.time {CNLTtsa} | R Documentation |
Function to perform smoothing over time of spectral quantities
Description
This function uses a running mean (box kernel) smoother to smooth spectra over time, with potentially different smoothing parameters used for each scale of the spectra
Usage
smooth.over.time(x, spec, M, fact = 1)
Arguments
x |
A vector corrsponding to the sampling grid of a component of a series. |
spec |
A spectral object (matrix), with rows corrsponding to different scales. |
M |
The smoothing parameter (binwidth) or vector of smoothing parameters (one for each scale) for the smoothing method. |
fact |
If |
Details
The function takes in a matrix and performs a kernel smoother on row i
of the matrix, using a bandwidth of M[i]
if length(M)==nrow(spec)
, and M * fact^{i-1}
if length(M)==1
. Thus if the scaling factor, fact, is chosen to be greater than one, a wider kernel is used for the smoothing for later scales.
Value
smooth.spec |
A matrix of same dimension as spec, containing smoothed spectral values. |
Author(s)
Jean Hamilton
References
Hamilton, J., Nunes, M. A., Knight, M. I. and Fryzlewicz, P. (2018) Complex-valued wavelet lifting and applications. Technometrics, 60 (1), 48-60, DOI 10.1080/00401706.2017.1281846.
See Also
Examples
x<-sort(runif(100))
y <-sin(2*pi*(1/25)*x) + sin(2*pi*(1/50)*x)
## Not run:
xy.dec<-cnlt.univ(x,y,P=300)
# compute the real part of the spectrum (real details^2) and smooth over scale, then over time
ReS <- smooth.over.scale(x, sapply(xy.dec$det1,Re), sapply(xy.dec$det1,Re), xy.dec$lre,
xy.dec$lreA, positive = TRUE)
ReS.smooth <- smooth.over.time(x,ReS$spec,5,1.05)
## End(Not run)