6. VARs and DMDs#
This lecture applies computational methods that we learned about in this lecture Singular Value Decomposition to
first-order vector autoregressions (VARs)
dynamic mode decompositions (DMDs)
connections between DMDs and first-order VARs
6.1. First-Order Vector Autoregressions#
We want to fit a first-order vector autoregression
where
and where
We want to fit equation (6.1).
Our data are organized in an
where for
Thus, we want to estimate a system (6.1) that consists of
The
We proceed as follows.
From
and
Here
We use
In forming
Evidently,
We denote the rank of
Two cases that interest us are
, so that we have many more time series observations than variables , so that we have many more variables than time series observations
At a general level that includes both of these special cases, a common formula describes the least squares estimator
But important details differ.
The common formula is
where
To read about the Moore-Penrose pseudo-inverse please see Moore-Penrose pseudo-inverse
Applicable formulas for the pseudo-inverse differ for our two cases.
Short-Fat Case:
When
Here
In this case, our formula (6.3) for the least-squares estimator of the population matrix of regression coefficients
This formula for least-squares regression coefficients is widely used in econometrics.
It is used to estimate vector autorgressions.
The right side of formula (6.4) is proportional to the empirical cross second moment matrix of
Tall-Skinny Case:
When
Here
In this case, our formula (6.3) for a least-squares estimator of
Please compare formulas (6.4) and (6.5) for
Here we are especially interested in formula (6.5).
The
If we use formula (6.5) to calculate
so that the regression equation fits perfectly.
This is a typical outcome in an underdetermined least-squares model.
To reiterate, in the tall-skinny case (described in Singular Value Decomposition) in which we have a number
We confront the facts that the least squares estimator is underdetermined and that the regression equation fits perfectly.
To proceed, we’ll want efficiently to calculate the pseudo-inverse
The pseudo-inverse
As our estimator
where
The Frobenius norm is defined as
The minimizer of the right side of equation (6.6) is
where the (possibly huge)
For some situations that we are interested in,
To acknowledge that possibility, we’ll use efficient algorithms to constructing
a reduced-rank approximation of
Such an approximation to our vector autoregression will no longer fit perfectly.
The
An efficient way to compute the pseudo-inverse
where we remind ourselves that for a reduced SVD,
We can efficiently construct the pertinent pseudo-inverse
(Since we are in the
Thus, we shall construct a pseudo-inverse
where the matrix
We can use formula (6.10) together with formula (6.7) to compute the matrix
Thus, our estimator
6.2. Dynamic Mode Decomposition (DMD)#
We turn to the
Here an
Dynamic mode decomposition was introduced by [Schmid, 2010],
You can read about Dynamic Mode Decomposition [Kutz et al., 2016] and [Brunton and Kutz, 2019] (section 7.2).
Dynamic Mode Decomposition (DMD) computes a rank
We’ll build up gradually to a formulation that is useful in applications.
We’ll do this by describing three alternative representations of our first-order linear dynamic system, i.e., our vector autoregression.
Guide to three representations: In practice, we’ll mainly be interested in Representation 3.
We use the first two representations to present some useful intermediate steps that help us to appreciate what is under the hood of Representation 3.
In applications, we’ll use only a small subset of DMD modes to approximate dynamics.
We use such a small subset of DMD modes to construct a reduced-rank approximation to
To do that, we’ll want to use the reduced SVD’s affiliated with representation 3, not the full SVD’s affiliated with representations 1 and 2.
Guide to impatient reader: In our applications, we’ll be using Representation 3.
You might want to skip the stage-setting representations 1 and 2 on first reading.
6.3. Representation 1#
In this representation, we shall use a full SVD of
We use the
The original data
(Here we use
Since we are now using a full SVD,
So it follows from equation (6.12) that we can reconstruct
In particular,
Equation (6.12) serves as an encoder that rotates the
vector to become an vectorEquation (6.13) serves as a decoder that reconstructs the
vector by rotating the vector
Define a transition matrix for an
We can recover
Dynamics of the
To construct forecasts
where we use
6.4. Representation 2#
This representation is related to one originally proposed by [Schmid, 2010].
It can be regarded as an intermediate step on the way to obtaining a related representation 3 to be presented later
As with Representation 1, we continue to
use a full SVD and not a reduced SVD
As we observed and illustrated in a lecture about the Singular Value Decomposition
(a) for a full SVD
and are both identity matrices(b) for a reduced SVD of
, is not an identity matrix.
As we shall see later, a full SVD is too confining for what we ultimately want to do, namely, cope with situations in which
But for now, let’s proceed under the assumption that we are using a full SVD so that requirements (a) and (b) are both satisfied.
Form an eigendecomposition of the
where
When
According to equation (6.16), the diagonal matrix
It follows that the systematic (i.e., not random) parts of the
Multiplying both sides of the above equation by
or
where our encoder is
and our decoder is
We can use this representation to construct a predictor
In effect,
[Schmid, 2010] defined an
and a generalized inverse
[Schmid, 2010] then represented equation (6.17) as
Components of the basis vector
DMD projected modes.
To understand why they are called projected modes, notice that
so that the
is a matrix of regression coefficients of the
We’ll say more about this interpretation in a related context when we discuss representation 3, which was suggested by Tu et al. [Tu et al., 2014].
It is more appropriate to use representation 3 when, as is often the case in practice, we want to use a reduced SVD.
6.5. Representation 3#
Departing from the procedures used to construct Representations 1 and 2, each of which deployed a full SVD, we now use a reduced SVD.
Again, we let
Construct a reduced SVD
where now
Our minimum-norm least-squares approximator of
Computing Dominant Eigenvectors of
We begin by paralleling a step used to construct Representation 1, define a transition matrix for a rotated
Interpretation as projection coefficients
[Brunton and Kutz, 2022] remark that
To verify this, first note that, because
Next, we’ll just compute the regression coefficients in a projection of
Thus, we have verified that
An Inverse Challenge
Because we are using a reduced SVD,
Consequently,
so we can’t simply recover
A Blind Alley
We can start by hoping for the best and proceeding to construct an eigendecomposition of the
where
Mimicking our procedure in Representation 2, we cross our fingers and compute an
that corresponds to (6.18) for a full SVD.
At this point, where
That
An Approach That Works
Continuing our quest for eigenvectors of
It turns out that columns of
This is a consequence of a result established by Tu et al. [Tu et al., 2014] that we now present.
Proposition The
Proof: From formula (6.26) we have
so that
Let
Equating the
This equation confirms that
This concludes the proof.
Also see [Brunton and Kutz, 2022] (p. 238)
6.5.1. Decoder of as a linear projection#
From eigendecomposition (6.27) we can represent
From formula (6.28) we can deduce dynamics of the
where
Since the
and so
The
is an
Variance Decomposition of
By virtue of the least-squares projection theory discussed in this quantecon lecture https://python-advanced.quantecon.org/orth_proj.html, we can represent
To verify this, note that the least squares projection
or
where
Rearranging the orthogonality conditions (6.33) gives
6.5.2. An Approximation#
We now describe a way to approximate the
In particular, the following argument adapted from [Brunton and Kutz, 2022] (page 240) provides a computationally efficient way to approximate
For convenience, we’ll apply the method at time
For
where
Recall from representation 1 above that
It then follows from equation (6.32) that
where
It follows that
Replacing the error term
Recall that from equation (6.23),
It then follows that
and therefore, by the eigendecomposition (6.24) of
Consequently,
or
which is a computationally efficient approximation to the following instance of equation (6.29) for the initial vector
(To highlight that (6.35) is an approximation, users of DMD sometimes call components of basis vector
Conditional on
or use compute a decoded
We can then use a decoded
6.5.3. Using Fewer Modes#
In applications, we’ll actually use only a few modes, often three or less.
Some of the preceding formulas assume that we have retained all
We can adjust our formulas to describe a situation in which we instead retain only
the
In that case, we simply replace
Counterparts of all of the salient formulas above then apply.
6.6. Source for Some Python Code#
You can find a Python implementation of DMD here: