Explanation 1
The live starter code is self-contained and uses only runner-compatible functions.
Loading
Lesson 21 of 22
Advanced Topic – Optional. Model joint dynamics while separating predictive content, shock identification, long-run relations, and causal claims.
Advanced Topic – Optional
This chapter extends the core pathway. Complete Chapters 1–14 first, then use this material when your question and data justify the added model complexity.
Motivation
Variables interact, but multivariate fit does not by itself identify interventions or structural shocks.
Why this matters
Model joint dynamics while separating predictive content, shock identification, long-run relations, and causal claims.
Packages and data
Base-R demonstrations; vars, urca, tsDyn, rmgarch, and MTS are optional.
Explanation 1
The live starter code is self-contained and uses only runner-compatible functions.
Explanation 2
Book-only outputs are labelled when the separate source dataset or advanced package was not supplied.
Explanation 3
R code, paths, function names, and formulas remain left-to-right in every locale.
Terminology
Every system variable depends on lags of all included variables.
Joint forecasting system
Incremental predictive content conditional on included history.
Not structural causation
A stationary linear combination of nonstationary variables.
Long-run equilibrium relation
Notation and formulas
yt = c + A1 y(t-1) + ... + Ap y(t-p) + error_t
Impulse responses require a specified shock-identification rule because innovations can be contemporaneously correlated.
Worked example
Scenario
Can a stationary spread be recovered from two simulated nonstationary levels?
R check
set.seed(2121)
x <- cumsum(rnorm(220,sd=.8))
spread <- arima.sim(list(ar=.55),n=220,sd=.5)
y <- 4+1.25*x+spread
fit <- lm(y~x)
print(coef(fit))
print(acf(residuals(fit),plot=FALSE)$acf[2])
plot(residuals(fit),type='l',ylab='Estimated spread')The controlled simulation illustrates cointegration; observed data need integration and residual-stationarity assessment. Limitation: A high R-squared between trending levels can be spurious, and VAR shock responses depend on identification assumptions.
Visual
The simulated cointegrating residual fluctuates around zero instead of drifting.
R connection
Run the self-contained starter code in the protected STATLAB R runner. The code prints an auditable result and avoids network or unrestricted file access.
Live R Lab
Run a self-contained example, verify its output, and explain one limitation for multivariate time series and cointegration.
Ready to run
Common mistake
Do not call Granger predictability causal impact or interpret trending-level OLS before checking cointegration.
STATLAB Tip
Label shock variable, size, identification rule, response unit, horizon, and uncertainty method on every impulse response.
Guided practice
Scenario
Reverse a Cholesky ordering and explain why the impulse response changes.
Compare your result with the definition, units, and model assumptions—not only with a target number.
Exercises
Complete these without looking at the selected solutions. More than one defensible program may exist.
Explanation 1
Compare VAR lag candidates.
Explanation 2
Compare stationarity of levels and residual spread.
Explanation 3
Explain when DCC is preferable to unrestricted covariance.
Selected solutions
These are compact solution routes. Confirm dimensions, units, and any changed modelling choices.
Explanation 1
Compare information criteria and residual serial correlation.
Explanation 2
Use plots plus ADF/KPSS with explicit deterministic terms.
Explanation 3
DCC offers parsimonious changing correlation when dimension makes free covariance dynamics impractical.
Chapter summary
Model joint dynamics while separating predictive content, shock identification, long-run relations, and causal claims.
Explanation 1
VAR models joint lag dynamics.
Explanation 2
Granger means prediction, not intervention.
Explanation 3
Impulse responses require identification.
Explanation 4
Cointegration creates stationary combinations.
Terminology
cross-correlation
Use in Multivariate Time Series and Cointegration.
vector autoregression
Use in Multivariate Time Series and Cointegration.
Granger test
Use in Multivariate Time Series and Cointegration.
cointegration
Use in Multivariate Time Series and Cointegration.
References and provenance
Engle & Granger (1987); Safavi (2026), Chapter 21. Student notes: Mohammad Safavi, Ph.D., STATLAB Academy, Version 1.0.
Resource
The authoritative 125-page English PDF accompanies this native lesson.
DownloadReflection
Name the assumption, evidence you would seek, and how the recommendation might change.
Exit check
Reach 70% to complete the chapter. Explanations appear after submission.
Checkpoint
Question 1 of 2. Answered 0/2. Passing score: 70%.