smooth.over.time: Function to perform smoothing over time of spectral...

Description Usage Arguments Details Value Author(s) References See Also Examples

View source: R/smooth.over.time.R

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

1
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 length(M)==1, a factor indicating how the smoothing parameter (binwidth) in the time-domain kernel smoothing method should increase from one scale to the next.

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

cnlt.spec, pre.per

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
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)

CNLTtsa documentation built on May 1, 2019, 9:39 p.m.