TLSWsim {TrendLSW} | R Documentation |
Simulate Trend Locally Stationary Wavelet Process
Description
Simulates a trend locally stationary wavelet process with a given trend function
and spectrum. Extends the LSWsim
function from the wavethresh
package.
Usage
TLSWsim(
trend,
spec,
filter.number = 4,
family = "DaubExPhase",
innov.func,
...
)
Arguments
trend |
Either:
When using a numeric vector for |
spec |
Either:
When using a numeric matrix for |
filter.number |
The filter number for the wavelet used to simulate the LSW process (default 4) |
family |
The family of the wavelet used to simulate the LSW process (default |
innov.func |
A function with first argument |
... |
Optional arguments to be passed to the function |
Value
A n
-length vector containing a TLSW process simulated from the trend and spectral description given by the trend and
spec arguments.
See Also
Examples
#---- simulate with numeric trend, and spec a wd object as in wavethresh-----
spec <- wavethresh::cns(1024)
spec <- wavethresh::putD(spec, level = 8, seq(from = 2, to = 8, length = 1024))
trend <- sin(pi * (seq(from = 0, to = 4, length = 1024)))
x <- TLSWsim(trend = trend, spec = spec)
plot.ts(x)
#---- simulate with numeric trend, and spec a matrix, with non-dyadic n-----
spec <- matrix(0, nrow = 9, ncol = 1000)
spec[1, ] <- seq(from = 1, to = 10, length = 1000)
trend <- sin(pi * (seq(from = 0, to = 4, length = 1000)))
x <- TLSWsim(trend = trend, spec = spec)
plot.ts(x)
#---- simulate with functional trend, and spec a list of functions-----
spec <- vector(mode = "list", length = 10)
spec[[1]] <- function(u) {
1 + 9 * u
}
trend <- function(u) {
sin(pi * u)
}
x <- TLSWsim(trend = trend, spec = spec)
plot.ts(x)