Examples in Multiparadigm Data Science:​
Time Series

Sophisticated time series functions automatically select from built-in fitting methods for highly accurate forecasting, with options for creating and fitting new classes of hybrid models.
Use TimeSeriesModelFit to create seasonal autoregressive integrated moving-average process (SARIMA)
models in a few lines of code.
Model seasonal data of monthly retail sales in the United States. Begin by querying Wolfram|Alpha:
raw=WolframAlpha["usa retail sales",{{"History:RetailSales:EconomicData",1},"TimeSeriesData"}];
Create a TimeSeries from the selection and plot the sales with grid lines at December peaks:
data=TimeSeries[{QuantityMagnitude[raw[[-12*15;;,2]]]},{Automatic,raw[[-1,1]],"Month"}];​​grids=Table[{1992,12i},{i,data["PathLength"]}];​​DateListPlot[data,GridLines{grids,None},AspectRatio1/3]
Fit a seasonal model and generate process parameters using TimeSeriesModelFit and forecast the
next seven years with 95% confidence bands:
model=TimeSeriesModelFit[data,{"SARIMA",12}];​​proc=model["BestFit"];​​forecast=TimeSeriesForecast[model,{0,7*12}];​​α=.95;​​q=Quantile[NormalDistribution[],1-(1-α)/2];​​err=forecast["MeanSquaredErrors"];​​bands=TimeSeriesThread[{{1,-q}.#,{1,q}.#}&,{forecast,Sqrt[err]}];​​grids=Table[{1992,12i},{i,data["PathLength"]+forecast["PathLength"]}];​​DateListPlot[{data,forecast,bands["PathComponent",1],bands["PathComponent",2]},Filling{3{4}},AspectRatio1/3,PlotStyleAutomatic,GridLines{grids,None}]
Simulate many forecast paths with a multidimensional visualization using RandomFunction:
rfproc=RandomFunction[proc,{50},200];​​sd=rfproc["SliceData",50];​​cf=ColorData["Rainbow"];​​sliced=BarChart[Last[#],AxesFalse,BarOriginLeft,AspectRatio4,ChartStyle(cf/@Rescale[MovingAverage[First[#],2],{Min[sd],Max[sd]},{0,1}]),ImageSize65]&[HistogramList[sd,{Range[Min[sd],Max[sd],(Max[sd]-Min[sd])/20]}]];​​ListLinePlot[rfproc,ImageSize400,PlotRangeAll,AspectRatio3/4,EpilogInset[sliced,{51,0},{0,2.5}],PlotStyle(cf/@Rescale[sd]),BaseStyleDirective[Thin,Opacity[0.5]],PlotRangePadding{{0,15},{.5,.5}}]​​
​
Fit a time series model and forecast airline passenger volume using ExampleData. Obtain the monthly
total number of US international airline passengers (in thousands) from January 1949 to December 1960:
passengers=ExampleData[{"Statistics","InternationalAirlinePassengers"},"TimeSeries"]
TimeSeries
Time: 01 Jan 1949 to 01 Dec 1960
Data points: 144

Make a simple plot to examine the data:
DateListPlot[passengers,JoinedTrue]
Find a time series model using TimeSeriesModelFit:
tsm=TimeSeriesModelFit[passengers,{"SARIMA",12}]
TimeSeriesModel
Family: SARIMA
Order: {{1,1,0},
{2,1,0}
12
}

proc=tsm["Process"]
SARIMAProcess[0.22472,{-0.361058},1,{},{12,{-0.128311,0.234166},1,{}},130.919]
Forecast for the next five years with a plot of prediction bands:
k=5;​​start="December 1st, 1960";​​forecastDates=DateRange[start,DatePlus[start,{k,"Year"}],"Month"];​​forecast=tsm/@forecastDates;​​bands=tsm["PredictionLimits"][#]&/@forecastDates;​​pforecast=DateListPlot[{bands[[All,1]],forecast,bands[[All,2]]},{start,Automatic,"Month"},JoinedTrue,Filling{1{3}},PlotStyle{Directive[{Dashed,Gray}],Automatic,Directive[{Dashed,Gray}]}]
Simulate the next five years:
k=5;​​sim=RandomFunction[tsm,{0,12*k},100];​​psim=DateListPlot[sim,PlotStyleDirective[Opacity[.25]],JoinedTrue,PlotRangeAll]
Find the mean function of the simulated paths and make a plot:
Simulate many forecast paths with a multidimensional visualization using RandomFunction:

Go Further: