Wolfram Language

Time Series Processing

Trends and Seasonalities

The number of airline passengers in years 1949 to 1960 was increasing but also varied seasonally. Apply MovingMap with Total over non-overlapping yearly windows to visualize annual growth. Use DateHistogram for monthly data with yearly date reduction to study seasonal dependencies.

The number of international airline passengers per month in years 1949 to 1960 is available via ExampleData.

In[1]:=
Click for copyable input
data = ExampleData[{"Statistics", "InternationalAirlinePassengers"}, "TimeSeries"]
Out[1]=

The data exhibits both a long-term increasing trend and seasonal oscillations.

In[2]:=
Click for copyable input
DateListPlot[data, PlotTheme -> "Detailed"]
Out[2]=

Aggregate yearly to see the global trend. Place the aggregated results at the last day of each year to make the 1-year moving windows non-overlapping.

In[3]:=
Click for copyable input
positionspec = {{1949, 12, 31}, {1960, 12, 31}, Quantity[1, "Year"]};
In[4]:=
Click for copyable input
mm = MovingMap[Total, data, {Quantity[1, "Years"], Right, positionspec}];
In[5]:=
Click for copyable input
DateListPlot[mm, PlotMarkers -> Automatic, GridLines -> {mm["Dates"], None}]
Out[5]=

Analyze seasonal dependence. Create WeightedData with number of passengers as weights for the dates.

In[6]:=
Click for copyable input
wd = WeightedData[data["Dates"], data["Values"]];

DateHistogram aggregates the weights for each month over the years as specified by DateReduction.

In[7]:=
Click for copyable input
DateHistogram[wd, "Month", DateReduction -> "Year"]
Out[7]=

Related Examples

de es fr ja ko pt-br ru zh