# Time Series Processes with Initial Conditions

Mathematica 10 supports time series processes with given past values, which cover both the stationary time series conditioned on past values as well as nonstationary time series with initial conditions. When autoregressive coefficients satisfy the stationarity condition, the process with initial values converges to the stationary process in the long run.

Define an autoregressive process with given past values.

 In:= Xar\[ScriptCapitalP] = ARProcess[\[ScriptC], {r1 + r2, -r1 r2}, \[Sigma]^2, {Subscript[ y, -2], Subscript[y, -1]}]
 Out= Find the mean function of the process.

 In:= XmeanF = FunctionExpand[ar\[ScriptCapitalP][t] // Mean]
 Out= Form conditions for longrun stability of the mean function.

 In:= Xcond = Apply[And, Cases[meanF, b_^(t + s_.) :> (Abs[b] < 1), Infinity] // Union]
 Out= Verify that these conditions are equivalent to weak stationarity condition.

 In:= XcondR = Reduce[ a1 == r1 + r2 && a2 == -r1 r2 && cond && {a1, a2} \[Element] Reals, {a1, a2}, {r1, r2}, Backsubstitution -> True]
 Out= In:= XReduce[Equivalent[condR, WeakStationarity[ARProcess[c, {a1, a2}, \[Sigma]^2]]], {a1, a2}, Reals]
 Out= Visualize the parameter region and three sample parameter pointsinside, outside, and on the boundary of the region of weak stationarity.

 In:= XRegionPlot[condR, {a1, -2, 2}, {a2, -2, 2}, Epilog -> {Red, PointSize[Medium], Point[{{0.1, -0.5}, {0.7, 0.6}, {-0.9, 0.1}}]}]
 Out= Visualize sample trajectories for a few parameter choices.

 In:= X{pInside, pOutside, pBoundary} = ARProcess[\[ScriptC], {a1, a2}, \[Sigma]^2, {Subscript[y, -2], Subscript[y, -1]}] /. {\[ScriptC] -> 1, \[Sigma] -> 1, Subscript[y, -1] -> -0.23, Subscript[y, -2] -> 0.8} /. {{a1 -> 0.1, a2 -> -0.5}, {a1 -> 0.7, a2 -> 0.6}, {a1 -> -0.9, a2 -> 0.1}}
 Out= In:= X{Table[ListPlot[RandomFunction[p, {0, 100}, 3], Filling -> Axis], {p, {pInside, pOutside, pBoundary}}], {"Inside", "Outside", "Boundary"}} // Grid
 Out= Visualize mean functions for these parameter choices.

 In:= X{Table[DiscretePlot[Mean[p[t]], {t, 0, 30}, PlotRange -> All], {p, {pInside, pOutside, pBoundary}}], {"Inside", "Outside", "Boundary"}} // Grid
 Out= ## Mathematica

Questions? Comments? Contact a Wolfram expert »