Seasonal decomposition
Well, it looks like the number of flights fluctuates a lot on weekdays, which is indeed a dominant characteristic of human-related activities. Let's verify that by identifying and removing the weekly seasonality by decomposing this time-series into the seasonal, trend, and random components with moving averages.
Although this can be done manually by utilizing the diff
and lag
functions, there's a much more straightforward way to do so with the decompose
function from the stats
package:
> plot(decompose(ts(daily$N, frequency = 7)))
Removing the spikes in the means of weekly seasonality reveals the overall trend of the number ...
Get Mastering Data Analysis with R now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.