## ---- computes estimate of local autocovariance function
spec <- matrix(0, nrow = 9, ncol = 512)
spec[2, ] <- 1 + sin(seq(from = 0, to = 2 * pi, length = 512))^2
trend <- seq(from = 0, to = 10, length = 512)
set.seed(123)
x <- TLSWsim(trend = trend, spec = spec)
## ---- first estimate the spectrum:
x.TLSW <- TLSW(x)
#---- estimate the lacf:
lacf.est <- TLSWlacf(x.TLSW)
#---- plot the variance (lag 0 lacf) over time:
plot.ts(lacf.est$lacf[, 1], ylab = "Variance")
Run the code above in your browser using DataLab