ARIMA is built from these parts.Lesson 06 adds
differencing and seasonality to ARMA and gives forecast intervals. Almost every forecasting paper
uses ARIMA as a benchmark.
Lag features. A regression on yt−1,…,yt−p is an AR(p) model. Gradient-boosted
forecasters (lesson 08) use the same lags as input
features.
Linear recurrences in deep learning. A state-space layer (S4, Mamba) is a linear recurrence
xt=Axt−1+But. It is stable exactly when the eigenvalues of A lie inside the unit circle,
the same condition as for an AR model in companion form
(deep-learning lesson 16).
Science and engineering. Speech codecs model each short frame of speech as an AR process
(linear predictive coding). Climate scientists use an AR(1) process ("red noise") as the null model
for climate variability. Yule (1927) invented the AR(2) model to explain the sunspot cycle.
Start with AR(1) from lesson 02:
yt=ϕyt−1+εt with white noise εt∼WN(0,σ2).
Unroll it: yt=εt+ϕεt−1+ϕ2εt−2+…. A shock that
happened j steps ago still has weight ϕj. If ∣ϕ∣<1 the weights shrink and the series
is stationary; its ACF is ρ(k)=ϕk. If ∣ϕ∣≥1 old shocks never fade.
AR(2): two lags of feedback.yt=ϕ1yt−1+ϕ2yt−2+εt. Now the pair
(ϕ1,ϕ2) decides everything. In the figure, each point of the plane is one AR(2) model.
Interactive figure: loading…
Drag the orange point(ϕ1,ϕ2), or pick an example. Inside the
aqua triangle the model is stationary. Below the dashed parabola
ϕ12+4ϕ2=0 the roots are complex and the path (blue) oscillates with a period shown in
the readout. Notice: the ACF (blue bars) of an AR(2) decays, the PACF (violet bars) is zero after
lag 2, and outside the triangle the path explodes. Each path uses the same random shocks.
Three regions matter:
Inside the triangle, above the parabola: two real roots. The ACF decays like a mix of two
geometric sequences. The path wanders smoothly (ϕ1>0) or flips sign (ϕ1<0).
Inside the triangle, below the parabola: complex roots. The ACF is a damped cosine. The
path shows a quasi-cycle: it oscillates with a typical period, but the amplitude and phase
change at random. This is the sunspot picture.
Outside the triangle: no stationary (causal) solution. Shocks are amplified and the path
explodes, even though each coefficient may be smaller than 1.
Roots and eigenvalues. The stationarity rule has two equivalent forms. Write the AR polynomial
ϕ(z)=1−ϕ1z−ϕ2z2. The rule "all roots of ϕ(z) lie outside the unit
circle" is the same as "all eigenvalues of the companion matrix(ϕ11ϕ20) lie inside the unit circle", because the
eigenvalues are exactly the reciprocals 1/z of the roots. Section 3 proves it. The next figure lets
you place the roots yourself.
Interactive figure: loading…
Drag the orange rootz1 of ϕ(z) in the complex plane. In "complex pair" mode its
conjugate follows; in "two real roots" mode drag both roots along the real axis. The
aqua points are the companion eigenvalues λ=1/z. Notice: when a root
crosses the unit circle into the inside, its eigenvalue leaves the circle and the path explodes. The
closer the roots are to the circle, the slower the ACF decays.
MA(1): a shock that lives for two steps.yt=εt+θεt−1. The shock
εt enters yt and yt+1 and then disappears. So yt and yt+2 share no shock,
and ρ(2)=0. The ACF of an MA(1) cuts off after lag 1. Its PACF, however, decays slowly
(section 3 explains why).
Interactive figure: loading…
Move the sliderθ and watch the theoretical ACF (blue) and PACF (violet). Notice: the ACF is
exactly zero after lag q. In MA(1) mode the lower chart draws ρ(1)=θ/(1+θ2): it
never goes above 0.5. Press θ → 1/θ: the ACF does not change, but only the model with
∣θ∣<1 is invertible.
Quick check
In the triangle figure, the point (ϕ1,ϕ2)=(1.0,−0.5) lies inside the triangle and below the parabola. What does a sample path look like?
Why.
Below the parabola (ϕ12+4ϕ2=1−2=−1<0) the roots are complex, so the process has a quasi-cycle. Inside the triangle it is stationary, so it does not explode. A single coefficient equal to 1 is not a unit root in AR(2): the test is on the roots of ϕ(z)=1−z+0.5z2, which are 1±i with modulus 2>1. Section 4 computes the period: 8.
The backshift operatorB moves a series one step back: Byt=yt−1, and
Bkyt=yt−k. Polynomials in B act term by term:
(1−0.5B)yt=yt−0.5yt−1. They multiply like ordinary polynomials:
(1−aB)(1−bB)=1−(a+b)B+abB2. This turns a model into an algebra problem in one variable.
or in short form ϕ(B)yt=c+εt with the AR polynomialϕ(z)=1−ϕ1z−⋯−ϕpzp. The shock εt is also called the
innovation: it is the part of yt that the past cannot predict.
Mean. If the process is stationary, Eyt=μ for every t. Take expectations of
both sides: μ=c+ϕ1μ+⋯+ϕpμ. So
μ=1−ϕ1−⋯−ϕpc=ϕ(1)c.
The constant c is not the mean. With c=2 and ϕ1=0.8, the mean is 2/0.2=10.
Equivalently, yt−μ=ϕ1(yt−1−μ)+⋯+ϕp(yt−p−μ)+εt.
Companion form. Stack the last p values into a state vector
xt=(yt,yt−1,…,yt−p+1)⊤. Then the AR(p) becomes a first-order vector recursion
with e1=(1,0,…,0)⊤. The first row is the AR equation; the other rows only shift the
old values down by one place. A is the companion matrix of the AR model.
Theorem (stationarity of AR(p)). Assume ϕp=0. The following are equivalent:
all roots of ϕ(z) lie outside the unit circle, ∣z∣>1;
all eigenvalues of the companion matrix A lie inside the unit circle, ∣λ∣<1.
Under these conditions the AR equation has exactly one stationary solution that depends only on present
and past shocks (a causal solution):
yt=μ+∑j≥0ψjεt−j with ψj=(Aj)11, and
∑j∣ψj∣<∞. If some eigenvalue has ∣λ∣≥1, no causal stationary solution
exists.
Proof of 1 ⇔ 2.
The characteristic polynomial of the companion matrix is
det(λI−A)=λp−ϕ1λp−1−⋯−ϕp−1λ−ϕp.
(Expand the determinant along the first row; for p=2:det(λ−ϕ1−1−ϕ2λ)=λ2−ϕ1λ−ϕ2.)
Multiply ϕ(1/λ) by λp:λpϕ(1/λ)=λp−ϕ1λp−1−⋯−ϕp. This is the same
polynomial.
ϕp=0, so λ=0 is not an eigenvalue. Therefore λ is an eigenvalue of A
exactly when z=1/λ is a root of ϕ(z).
∣z∣=1/∣λ∣, so ∣z∣>1⟺∣λ∣<1.■
Why the eigenvalues decide stationarity
Eigenvalues inside the circle give a stationary solution.
Unroll the companion recursion k times:
xt=Akxt−k+∑j=0k−1Aje1(c+εt−j).
If every eigenvalue has ∣λ∣<1, then ∥Aj∥≤Crj for some C and some r<1
(by the Jordan form of linear-algebra lesson 05,
the entries of Aj are sums of terms jmλj, and jm∣λ∣j→0 when ∣λ∣<1). So Akxt−k→0, and the sum converges
absolutely when k→∞.
The limit xt=∑j≥0Aje1(c+εt−j) uses only present and past shocks
and has the same distribution for every t: it is a causal stationary solution. Its first entry is
yt=μ+∑jψjεt−j with ψj=(Aj)11.
An eigenvalue on or outside the circle rules it out.
Let w⊤A=λw⊤ with ∣λ∣≥1 (a left eigenvector). For a companion matrix
the first entry w1 of a left eigenvector is never 0 (if w1=0, the equations
w⊤A=λw⊤ force all other entries to 0, column by column).
Put ut=w⊤xt. Then ut=λut−1+w1(c+εt).
In a causal stationary solution, ut−1 depends only on shocks up to t−1, so it is
uncorrelated with εt, and Var(ut)=Var(ut−1)=v.
Then v=∣λ∣2v+∣w1∣2σ2>∣λ∣2v≥v. This is impossible. ■
For AR(2) the companion eigenvalues solve λ2−ϕ1λ−ϕ2=0, so
λ1+λ2=ϕ1 and λ1λ2=−ϕ2.
Theorem (AR(2) stationarity triangle). An AR(2) is stationary if and only if
ϕ1+ϕ2<1,ϕ2−ϕ1<1,∣ϕ2∣<1.
Its roots are complex when ϕ12+4ϕ2<0 (below the parabola).
Proof of the triangle
Let g(λ)=λ2−ϕ1λ−ϕ2. Note g(1)=1−ϕ1−ϕ2 and
g(−1)=1+ϕ1−ϕ2.
Real roots(ϕ12+4ϕ2≥0).
If both roots lie in (−1,1), then g(1)>0 and g(−1)>0 (an upward parabola is positive
outside its roots), and ∣ϕ2∣=∣λ1λ2∣<1.
Conversely, let g(1)>0,g(−1)>0 and ∣λ1λ2∣<1. A root in
(−∞,−1] and another in [1,∞) would make g(1)≤0. So both roots are on the same
side of 1 and on the same side of −1: both in (−1,1), both >1, or both <−1. The last
two cases give ∣λ1λ2∣>1. So both roots lie in (−1,1).
Complex roots(ϕ12+4ϕ2<0). Then λ2=λˉ1 and
∣λ1∣2=λ1λˉ1=−ϕ2. So ∣λ∣<1⟺ϕ2>−1. The other
two conditions hold automatically: ϕ2<−ϕ12/4 gives
ϕ1+ϕ2<ϕ1−ϕ12/4=1−(1−ϕ1/2)2≤1, and the same for −ϕ1.■
Quasi-cycle. With complex roots, write the eigenvalues as λ=re±iω. From
∣λ∣2=−ϕ2 and λ1+λ2=2rcosω=ϕ1:
r=−ϕ2,cosω=2−ϕ2ϕ1,period=ω2π.
The ACF solves the recursion ρ(k)=ϕ1ρ(k−1)+ϕ2ρ(k−2), so it is a combination of
λ1k and λ2k. With complex eigenvalues this combination is real and equals
arkcos(kω+b) for some constants a,b: a cosine with period 2π/ω that decays
by the factor r per step. Random shocks keep restarting the oscillation, so the path never settles.
Subtract the mean: y~t=yt−μ satisfies
y~t=ϕ1y~t−1+⋯+ϕpy~t−p+εt.
Multiply both sides by y~t−k and take expectations. On the left:
E[y~ty~t−k]=γ(k). On the right: ϕiγ(k−i) for each lag.
The last term is E[εty~t−k]. For k≥1 it is 0, because in the
causal solution y~t−k depends only on shocks up to t−k. For k=0 it is
E[εty~t]=σ2 (only the ψ0εt term of y~t
contributes).
So γ(k)=∑iϕiγ(k−i) for k≥1 and γ(0)=∑iϕiγ(i)+σ2.
Divide by γ(0) and use γ(−i)=γ(i).■
The equations for k=1,…,p form a linear system with a symmetric Toeplitz matrix
(constant along each diagonal, see linear-algebra lesson 19):
Two uses. Forward: given ϕ, solve for ρ(1),…,ρ(p) and then run the recursion
to get the whole ACF. Backward (estimation): replace ρ(k) by the sample ACF ρ^(k) and
solve for ϕ^. This is the Yule–Walker estimator. With the sample ACF that divides by n
(lesson 02), Rp is positive definite and the fitted model is always stationary.
The ACF of an AR(p) decays. For k>p the recursion has no forcing term, so ρ(k) is a
combination of λik over the companion eigenvalues. All ∣λi∣<1, so ρ(k) decays
geometrically: like ϕk, like a sum of such terms, or like a damped cosine. It never cuts off.
The PACF of an AR(p) cuts off after lag p. Recall from lesson 02 that the PACF value
ϕkk is the last coefficient of the best linear predictor of yt from
yt−1,…,yt−k. For k≥p, the best predictor is the AR equation itself, because the
remaining error εt is uncorrelated with all past values. Its coefficient vector is
(ϕ1,…,ϕp,0,…,0). So ϕpp=ϕp and ϕkk=0 for every k>p.
Quick check
A stationary AR(2) has ϕ1=0.5 and ϕ2=0.2. What is ρ(1)?
Why.
The Yule–Walker equation for k=1 is ρ(1)=ϕ1ρ(0)+ϕ2ρ(−1)=ϕ1+ϕ2ρ(1), so ρ(1)=ϕ1/(1−ϕ2)=0.5/0.8=0.625. The rule ρ(1)=ϕ1 holds only for AR(1): the second lag also carries correlation from yt−2 to yt−1.
with the MA polynomialθ(z)=1+θ1z+⋯+θqzq. It is a weighted sum of
the last q+1 shocks; it is not a moving average of the data (that is a smoother, lesson 01).
An MA(q) is always stationary. It is a finite sum of white noise terms, so its mean c and its
autocovariances do not depend on t. With θ0=1:
Proof.Cov(yt,yt+k)=∑i∑jθiθjCov(εt−i,εt+k−j).
The covariance is σ2 when t−i=t+k−j, that is j=i+k, and 0 otherwise. If k>q,
no pair (i,i+k) has both indices in {0,…,q}.■
So the ACF of an MA(q) cuts off after lag q. For MA(1):
ρ(1)=1+θ2θ,ρ(k)=0(k≥2).
Since (1−∣θ∣)2≥0 gives 1+θ2≥2∣θ∣, we get ∣ρ(1)∣≤1/2, with
equality only at θ=±1. An MA(1) can never have a lag-1 autocorrelation above 0.5.
Invertibility. Replace θ by 1/θ and σ2 by θ2σ2:γ(0)=θ2σ2(1+1/θ2)=σ2(1+θ2) and
γ(1)=θ2σ2⋅(1/θ)=σ2θ. Same autocovariances. With Gaussian
shocks the two models give exactly the same distribution of the data, so no data set can tell them
apart. We pick one by a rule:
An MA (or ARMA) model is invertible if all roots of θ(z) lie outside the unit circle. For
MA(1) this means ∣θ∣<1. Then the shocks can be recovered from past data. From
εt=yt−θεt−1 (take c=0) and repeated substitution:
εt=yt−θyt−1+θ2yt−2−⋯=j≥0∑(−θ)jyt−j.
The sum converges because ∣θ∣<1. So an invertible MA(1) is an AR(∞):
yt=θyt−1−θ2yt−2+θ3yt−3−⋯+εt. This has two
consequences. First, residuals computed from data converge to the true shocks, which forecasting needs
(lesson 06). Second, the best linear predictor uses
all past lags, so the PACF of an MA(1) never cuts off: it decays like (−θ)k.
Quick check
Can an MA(1) process have lag-1 autocorrelation ρ(1)=0.7?
Why.
θ=0.7 gives ρ(1)=0.7/1.49≈0.47, and θ=3 gives 3/10=0.3. The function θ/(1+θ2) has its maximum 0.5 at θ=1, and σ2 cancels in the ratio. If the sample ACF shows a lag-1 value of 0.7 with a cut-off after lag 1, an MA(1) cannot explain it; look for an AR or an MA of higher order.
It is causal (stationary) if the roots of ϕ(z) lie outside the unit circle. Then
yt=μ+∑j≥0ψjεt−j, the MA(∞) form, with
ψ(z)=θ(z)/ϕ(z). Comparing coefficients in ϕ(z)ψ(z)=θ(z) gives the
ψ-weights by a recursion: ψ0=1 and
ψj=θj+∑i=1min(j,p)ϕiψj−i, with θj=0 for j>q.
For ARMA(1,1): ψj=ϕj−1(ϕ+θ) for j≥1.
It is invertible if the roots of θ(z) lie outside the unit circle. Then
εt=π(B)(yt−μ) with π(z)=ϕ(z)/θ(z), the AR(∞) form.
Parameter redundancy. If ϕ(z) and θ(z) share a root, it cancels. Example:
yt=0.5yt−1+εt−0.5εt−1 is (1−0.5B)yt=(1−0.5B)εt,
which is white noise. Fitting software can return such a pair with large, opposite coefficients; it
is a sign that the model is too big.
Both the ACF and the PACF of an ARMA(p,q) with p,q≥1 decay and do not cut off. For ARMA(1,1)
the ACF is ρ(1)=1+2ϕθ+θ2(1+ϕθ)(ϕ+θ) and
ρ(k)=ϕρ(k−1) for k≥2.
Wold's theorem: why ARMA is general
Wold's decomposition theorem. Every zero-mean, covariance-stationary process can be written as
yt=∑j≥0ψjεt−j+dt, with ψ0=1,∑jψj2<∞,εt the white-noise one-step prediction errors (the innovations), and dt a
deterministic part that the past predicts perfectly (for example a pure sinusoid). So every stationary
process without a deterministic part is an MA(∞). An ARMA model approximates the infinite
sequence ψj by a ratio of two short polynomials θ(z)/ϕ(z). Few parameters can then
describe a long memory pattern, which is why ARMA models work well in practice.
AR(p) by conditional least squares. For t=p+1,…,n, regress yt on
1,yt−1,…,yt−p. This is ordinary least squares
(linear-algebra lesson 12); "conditional" means we
condition on the first p values. Estimate σ2 by the mean squared residual. The
Yule–Walker estimator gives almost the same answer on long series.
MA and ARMA by maximum likelihood. The residuals
et=yt−c−∑iϕiyt−i−∑jθjet−j depend on θ through the
recursion, so the problem is not linear. Software maximises the exact Gaussian likelihood
numerically. The likelihood is computed with the Kalman filter
(lesson 07). A cheaper version minimises the
conditional sum of squares∑tet2 with et=0 before the start.
A sample ACF or PACF value counts as "zero" if it lies inside the band ±1.96/n (lesson 02).
The table is a good start on long, clean series. On short or noisy series the patterns are hard to see.
Practice the reading in the next figure.
Interactive figure: loading…
Guess the model. The figure simulates one of AR(1), AR(2), MA(1), MA(2) or ARMA(1,1) and shows
the path (blue), the sample ACF (blue bars) and the sample PACF (violet bars) with the grey band
±1.96/n. Pick your answer; the feedback explains the pattern. Then make n small: with 60
points even the right answer is hard to see.
Therefore, in practice, fit a small grid of candidate models and compare them with an information
criterion. With L^ the maximised likelihood and k the number of estimated parameters
(including c and σ2):
The first term rewards fit; the second penalises the number of parameters, so the criterion trades
fit against complexity. Smaller is better. AICc corrects AIC for small samples; BIC penalises more
and picks smaller models. Compare criteria only between models fitted to the same data: the same
time points and the same transformation and differencing.
Then check the residuals. If the model is adequate, its residuals look like white noise: no
spikes in their ACF. The Ljung–Box test summarises the first h residual autocorrelations:
Q=n(n+2)k=1∑hn−kρ^e(k)2.
If the residuals are white noise, Q approximately follows a χ2 distribution with h−p−q
degrees of freedom. A small p-value says that correlation is left in the residuals.
Quick check
The sample PACF of a long series has clear spikes at lags 1 and 2 and nothing after. The sample ACF decays slowly like a damped wave. Which model is the best first guess?
Why.
A PACF that cuts off after lag 2 is the signature of AR(2); a decaying, wave-like ACF fits complex roots. An MA(2) would show the opposite: an ACF that cuts off after lag 2 and a decaying PACF. Start with AR(2), then compare neighbours by AIC and check the residuals.
Answers to section 1.
(1) It explodes. ϕ1+ϕ2=1.1>1 breaks the first triangle condition. Equivalently,
g(λ)=λ2−0.5λ−0.6 has roots λ≈1.06 and −0.56; one
eigenvalue is outside the unit circle. Small coefficients do not guarantee stability.
(2) At most 0.5, reached at θ=1.
(3) Yes. With complex roots an AR(2) produces a quasi-cycle with period 2π/ω. Section 4
fits it to the sunspots and finds a period of about 10.9 years.
Roots of ϕ(z)=1−z+0.5z2:z=11±1−2=1±i, with modulus
2≈1.414>1.
Companion eigenvalues: λ2−λ+0.5=0 gives λ=(1±i)/2, with modulus
0.5≈0.707=1/2. They are the reciprocals of the roots:
1/(1+i)=(1−i)/2.
Period: cosω=ϕ1/(2−ϕ2)=1/(2⋅0.7071)=0.7071, so ω=π/4
and the period is 2π/(π/4)=8 steps.
ACF by Yule–Walker. ρ(1)=ϕ1/(1−ϕ2)=1/1.5=0.667. Then
ρ(k)=ρ(k−1)−0.5ρ(k−2). For example ρ(2)=0.667−0.5⋅1=0.167 and
ρ(4)=−0.167−0.5⋅0.167=−0.250. The table lists the first values.
k
0
1
2
3
4
5
6
7
8
ρ(k)
1
0.667
0.167
−0.167
−0.250
−0.167
−0.042
0.042
0.063
The sign pattern repeats every 8 lags and the size shrinks by the factor r=0.707 per lag: a damped
cosine.
PACF: ϕ11=ρ(1)=0.667,ϕ22=ϕ2=−0.5, and ϕkk=0 for k≥3.
(b) Two MA(1) models with the same ACF.θ=0.5 gives ρ(1)=0.5/1.25=0.4.θ=2 gives ρ(1)=2/5=0.4. With σ2=1 for the first and σ2=0.25 for
the second, also γ(0)=1.25 and γ(1)=0.5 agree. Only θ=0.5 is invertible:
the root of θ(z)=1+0.5z is z=−2, outside the unit circle; the root of 1+2z is
z=−0.5, inside. The PACF of the invertible model is 0.4,−0.190,0.094,−0.047,…: it
alternates in sign and decays, roughly by the factor −θ per lag.
Quick check
Model A is an MA(1) with θ=2 and σ2=1. Model B is an MA(1) with θ=0.5 and σ2=4. Which statement is true?
Why.
Both give γ(0)=5 and γ(1)=2, so ρ(1)=0.4. Invertibility needs the root of θ(z)=1+θzoutside the unit circle: for B the root is −2, for A it is −0.5 (inside). We fit and report model B.
(c) The sunspot cycle with AR(2). The data are the yearly sunspot numbers 1700–2008 (n=309,
from the statsmodels data sets). Regress yt on (1,yt−1,yt−2) for the 307 years
1702–2008:
cosω=1.392/(2⋅0.831)=0.838, so ω=0.578 and the period is
2π/0.578=10.9 years: close to the 11-year solar cycle.
Mean: μ^=14.91/(1−1.392+0.690)=14.91/0.298=49.9; the sample mean is 49.8.
Is AR(2) the best order? On the common years 1710–2008, the AIC is 2732.5 for AR(1), 2536.3 for
AR(2), 2533.1 for AR(3) and smallest, 2485.8, for AR(9). The Ljung–Box test on the AR(2) residuals
with h=10 gives Q=32.4 with 8 degrees of freedom, p-value 0.0001: some correlation is left.
AR(2) captures the cycle with two parameters; AR(9) captures more detail. (The real cycle is also
asymmetric, rising faster than it falls, which no linear Gaussian model reproduces.)
Interactive figure: loading…
Choose the order p. The blue line is the sunspot series, the orange line the one-step fitted
values of an AR(p) fitted by least squares. Below: the residual ACF (magenta bars) with the grey band,
and the AIC for p=1,…,10 on the same years 1710–2008. Notice: AR(1) leaves a strong wave in
the residual ACF; AR(2) removes most of it and gives a period near 11 years; AIC prefers AR(9).
Classical forecasting. ARIMA and SARIMA (lesson 06)
are ARMA models of a differenced series. Exact likelihood estimation uses the state-space form and
the Kalman filter (lesson 07).
Machine learning. Lag features yt−1,…,yt−p in gradient boosting and in linear
baselines such as DLinear are nonlinear or multi-output cousins of AR(p)
(lesson 08,
lesson 09). AR(p) residuals are a common anomaly score
(lesson 11).
Deep learning. Linear recurrent layers and state-space models (S4, Mamba) keep the eigenvalues of
their transition matrix inside the unit circle for the same reason as the AR stationarity theorem.
Autoregressive generation in language models uses the same word: each output depends on the
previous outputs.
Signal processing. Linear predictive coding fits an AR model of order about 10–16 to each speech
frame by Yule–Walker (the Levinson–Durbin recursion solves the Toeplitz system in O(p2) steps).
AR spectra give high-resolution spectral estimates.
Science. AR(1) "red noise" is the null model for climate variability; AR models describe
sunspots, EEG rhythms and economic cycles; VAR models describe several linked series (macroeconomics,
neuroscience).
Vector autoregression (VAR) and Granger causality
For K series stacked in a vector yt∈RK, a VAR(p) model is
yt=c+Φ1yt−1+⋯+Φpyt−p+εt
with K×K matrices Φi and a noise covariance Σ. Each equation is a regression on
the lags of all series, so least squares works equation by equation. Stability: the Kp×Kp
block companion matrix (first block row Φ1,…,Φp, identity blocks below) must have all
eigenvalues inside the unit circle. The number of parameters, K2p, grows fast; large VARs need
regularisation.
Series xGranger-causes series y if the past of x improves the forecast of y beyond the
past of y alone; in a VAR it means some lag coefficients from x to y are nonzero (an F-test).
This is a statement about prediction, not about causation: a third series that drives both, or
different reaction delays, can produce it without any causal link (see the
causal-inference track).
Checking each coefficient instead of the roots.∣ϕi∣<1 for every i does not give
stationarity: (0.5,0.6) explodes. Use the roots, the companion eigenvalues or, for AR(2), the triangle.
Inside or outside? The roots of ϕ(z) must lie outside the unit circle; the companion
eigenvalues must lie inside. They are reciprocals, so both statements say the same thing.
Software such as statsmodels often reports arroots (outside) and some books plot inverse roots
(inside); read the label.
Reading c as the mean. In yt=c+ϕyt−1+εt the mean is c/(1−ϕ).
Many packages report the mean μ under the name "const" or "intercept"; check which one you get.
Mixing MA sign conventions. A fitted θ=−0.4 in statsmodels is θ=0.4 in
Box–Jenkins notation.
Trusting the ACF/PACF table blindly. On short series the sample ACF is noisy, and about 1 lag in
20 crosses the ±1.96/n band by chance. Use the table to pick candidates, then compare
them by AICc and residual checks.
Comparing AIC across different data. An AR(2) on years 1702–2008 and an AR(9) on 1709–2008 do
not have comparable likelihoods. Fit all candidates on the same time points (and the same
differencing).
Is yt=1.2yt−1−0.5yt−2+εt stationary? Are its roots real or complex? If
complex, give the period.AnswerTriangle: 1.2−0.5=0.7<1,−0.5−1.2=−1.7<1,∣−0.5∣<1: stationary. ϕ12+4ϕ2=1.44−2=−0.56<0: complex. cosω=1.2/(20.5)=0.849,ω=0.556, period 2π/0.556≈11.3 steps.
A stationary AR(1) has c=3 and ϕ=0.7. What is its mean? What is its variance if
σ2=1?Answerμ=3/(1−0.7)=10.γ(0)=σ2/(1−ϕ2)=1/0.51≈1.96.
Compute the ACF of the MA(2) yt=εt+0.5εt−1+0.2εt−2.Answerγ(0)/σ2=1+0.25+0.04=1.29;γ(1)/σ2=1⋅0.5+0.5⋅0.2=0.6;γ(2)/σ2=1⋅0.2=0.2. So ρ(1)=0.6/1.29=0.465,ρ(2)=0.2/1.29=0.155, and ρ(k)=0 for k≥3.
Is the MA(1) yt=εt+1.25εt−1 invertible? Give the invertible model
with the same ACF.AnswerNo: the root of 1+1.25z is z=−0.8, inside the unit circle. Use θ=1/1.25=0.8 with the noise variance multiplied by 1.252=1.5625. Both give ρ(1)=1.25/2.5625=0.8/1.64≈0.488.
Write the companion matrix of the AR(3) yt=0.5yt−1+0.2yt−2−0.1yt−3+εt.
How do you decide stationarity with it?AnswerA=0.5100.201−0.100. Compute its eigenvalues (for example with `np.linalg.eigvals`); the model is stationary if all have modulus below 1. Here the characteristic polynomial λ3−0.5λ2−0.2λ+0.1=(λ−0.5)(λ2−0.2) gives λ=0.5 and λ=±0.447: all inside the unit circle, so the model is stationary.
Why does the PACF of an AR(3) vanish at lag 5?AnswerThe PACF at lag 5 is the last coefficient of the best linear predictor of yt from five lags. For an AR(3) that predictor is the AR equation itself, with coefficients (ϕ1,ϕ2,ϕ3,0,0), because the error εt is uncorrelated with every past value. So the fifth coefficient is 0.
Recall cardsAnswer in your head first, then reveal. Add the cards to your review deck to see them again just before you would forget.
When is an AR(p) model stationary (and causal)?
When all roots of ϕ(z)=1−ϕ1z−⋯−ϕpzp lie outside the unit circle, equivalently when all eigenvalues of the companion matrix lie inside it.
How are the roots of ϕ(z) and the companion eigenvalues related?
They are reciprocals: λ is an eigenvalue exactly when z=1/λ is a root, because λpϕ(1/λ) is the characteristic polynomial.
When does an AR(2) have complex roots, and what does the path look like then?
When ϕ12+4ϕ2<0. The path shows a quasi-cycle with period 2π/ω,cosω=ϕ1/(2−ϕ2), and the ACF is a damped cosine.
State the Yule–Walker equations of an AR(p).
ρ(k)=ϕ1ρ(k−1)+⋯+ϕpρ(k−p) for k≥1; for k=1,…,p they form the Toeplitz system Rpϕ=rp.
What is ρ(1) of an MA(1), and what is its largest possible value?
ρ(1)=θ/(1+θ2); its absolute value is at most 0.5, reached at θ=±1.
Which model has an ACF that cuts off after lag q, and which has a PACF that cuts off after lag p?
MA(q) has the ACF cut-off; AR(p) has the PACF cut-off.
What does invertibility mean for an MA(1), and why do we require it?
∣θ∣<1 (root of θ(z) outside the unit circle). θ and 1/θ give the same ACF; the invertible one lets us recover the shocks from past data as εt=∑j(−θ)jyt−j.
What is the mean of a stationary AR(1) with c=2 and ϕ=0.8?
μ=c/(1−ϕ)=2/0.2=10.
What does AIC trade off?
Fit against complexity: AIC=−2logL^+2k. The first term falls with better fit, the second grows with the number of parameters k.
"How do you check that an AR model is stationary?" — Roots of ϕ(z) outside the unit circle,
or companion eigenvalues inside. For AR(2), the triangle. Coefficients below 1 are not enough.
"How do you choose p and q?" — Look at the ACF/PACF for a first guess (cut-offs), fit a small
grid, compare AICc on the same data, and check that the residuals are white noise (Ljung–Box).
Finally, compare forecasts with a backtest (lesson 03).
"What is the difference between an MA model and a moving-average smoother?" — The MA model is a
stochastic process built from past shocks; the smoother averages past observations.
"Why is an MA model not identifiable without invertibility?" — θ and 1/θ (with rescaled
noise variance) give the same autocovariances and, for Gaussian data, the same likelihood.
"How does an AR model relate to a linear RNN?" — An AR(p) in companion form is a linear RNN with a
fixed transition matrix; stability is the same eigenvalue condition.
Shumway and Stoffer, Time Series Analysis and Its Applications,
4th ed., Springer 2017, ch. 3.1–3.5: causality, invertibility, the ψ-weights, Yule–Walker and
the PACF, with proofs. R code for every example is on the authors' page.
G. U. Yule (1927), "On a method of investigating periodicities in disturbed series, with special
reference to Wolfer's sunspot numbers", Phil. Trans. R. Soc. A 226, 267–298
(doi:10.1098/rsta.1927.0007): the paper that introduced autoregression.
Code along in Colab
Runs in your browser with nothing to install. The notebook repeats the key demos and has exercises with checks; solutions are inside, folded.