| seasonal | R Documentation |
Returns a univariate time series equal to either a seasonal component, trend-cycle component or remainder component from a time series decomposition.
seasonal(object)
trendcycle(object)
remainder(object)
object |
Object created by |
Univariate time series.
Rob J Hyndman
stats::stl(), stats::decompose(), tbats(), seasadj().
plot(USAccDeaths)
fit <- stl(USAccDeaths, s.window = "periodic")
lines(trendcycle(fit), col = "red")
library(ggplot2)
autoplot(
cbind(
Data = USAccDeaths,
Seasonal = seasonal(fit),
Trend = trendcycle(fit),
Remainder = remainder(fit)
),
facets = TRUE
) +
labs(x = "Year", y = "")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.