Description Usage Arguments Value See Also Examples
Extracts seasonal component of time series by averaging observations on the same position in the cycle.
1 | seasonal.ave(x, ave.FUN = mean, ...)
|
x |
A univariate time series. |
ave.FUN |
Averaging function. |
... |
Additional arguments passed to |
A time series object with times from 0 to 1 and the same frequency as
x
.
ave
, seasonal.smooth
for alternative
seasonal extraction method.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | set.seed(19860306)
## Artificial example
x <- ts(sin(2*pi*(3:97)/10) + 0.5*rnorm(length(3:97)),
start = c(0, 3), frequency = 10)
plot.default(time(x)%%1, x, xlab = "Phase")
lines(seasonal.ave(x), col = "blue")
lines(seasonal.ave(x, median), col = "green")
legend("bottomleft",
legend = c("Mean averaging",
"Median averaging"),
col = c("blue", "green"),
lty = "solid")
## Realistic example
data(nesterov.index, package = "mar1s")
x <- log(nesterov.index[, "mean"])
x[x < -10] <- -Inf
plot.default(time(x)%%1, x, xlab = "Phase", pch = ".")
lines(seasonal.ave(x), col = "blue")
lines(seasonal.ave(x, median), col = "green")
legend("topleft",
legend = c("Mean averaging",
"Median averaging"),
col = c("blue", "green"),
lty = "solid")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.