Skip to content

Commit 60fbd63

Browse files
Tom's Feb 21 edit of svd lecture
1 parent 4592fa8 commit 60fbd63

File tree

1 file changed

+153
-3
lines changed

1 file changed

+153
-3
lines changed

lectures/svd_intro.md

Lines changed: 153 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -216,9 +216,12 @@ rr = np.linalg.matrix_rank(X)
216216
rr
217217
```
218218
219-
```{todo}
220-
Add some words about the "economy SVD" and add an example here
221-
```
219+
**Remark:** The cells above illustrate application of the `fullmatrices=True` and `full-matrices=False` options.
220+
Using `full-matrices=False` returns a reduced singular value decomposition. This option implements
221+
an optimal reduced rank approximation of a matrix, in the sense of minimizing the Frobenius
222+
norm of the discrepancy between the approximating matrix and the matrix being approximated.
223+
Optimality in this sense is established in the celebrated Eckart–Young theorem. See <https://en.wikipedia.org/wiki/Low-rank_approximation>.
224+
222225
223226
## PCA with Eigenvalues and Eigenvectors
224227
@@ -672,6 +675,153 @@ $$
672675
\check X_{t+j} = \Phi \Lambda^j \Phi^{+} X_t
673676
$$
674677
678+
679+
## Reduced-order VAR
680+
681+
Consider a **vector autoregression**
682+
683+
$$
684+
X_{t+1} = \check A X_t + C \epsilon_{t+1}
685+
$$ (eq:VARred)
686+
687+
where
688+
689+
* $X_t$ is an $m \times 1$ vector
690+
* $\check A$ is an $m \times m$ matrix of rank $r$
691+
* $\epsilon_{t+1} \sim {\mathcal N}(0, I)$ is an $m \times 1$ vector of i.i.d. shocks
692+
* $E \epsilon_{t+1} X_t = 0$, so that the shocks are orthogonal to the regressors
693+
694+
To link this model to a dynamic mode decomposition (DMD), again take
695+
696+
$$
697+
X = [ X_1 \mid X_2 \mid \cdots \mid X_{n-1} ]
698+
$$
699+
700+
$$
701+
X' = [ X_2 \mid X_3 \mid \cdots \mid X_n ]
702+
$$
703+
704+
so that according to model {eq}`eq:VARred`
705+
706+
707+
$$
708+
X' = [\check A X_1 + C \epsilon_2 \mid \check A X_2 + C \epsilon_3 \mid \cdots \mid \check A X_{n-1} C
709+
\epsilon_n ]
710+
$$
711+
712+
To illustrate some useful calculations, assume that $n =3 $ and form
713+
714+
$$
715+
X' X^T = [\check A X_1 + C \epsilon_2 \mid \check A X_2 + C \epsilon_3 ]
716+
\begin{bmatrix} X_1^T \cr X_2^T \end{bmatrix}
717+
$$
718+
719+
or
720+
721+
$$
722+
X' X^T = \check A ( X_1 X_1^T + X_2 X_2^T) + C( \epsilon_2 X_1^T + \epsilon_3 X_2^T)
723+
$$
724+
725+
but because
726+
727+
$$
728+
E C( \epsilon_2 X_1^T + \epsilon_3 X_2^T) = 0
729+
$$
730+
731+
we have
732+
733+
$$
734+
X' X^T = \check A ( X_1 X_1^T + X_2 X_2^T)
735+
$$
736+
737+
Evidently,
738+
739+
$$
740+
X X^T = ( X_1 X_1^T + X_2 X_2^T)
741+
$$
742+
743+
so that our matrix $\check A$ of least squares regression coefficients is
744+
745+
$$
746+
\check A = (X' X^T) (X X^T)^+
747+
$$
748+
749+
Our **assumption** that $\check A$ is a matrix of rank $r$ leads us to represent it as
750+
751+
$$
752+
\check A = \Phi \Lambda \Phi^{+}
753+
$$
754+
755+
where $\Phi$ and $\Lambda$ are computed with the DMD algorithm described above.
756+
757+
Associated with the VAR representation {eq}`eq:VARred`
758+
is the usual moving average representation
759+
760+
$$
761+
X_{t+j} = \check A^j X_t + C \epsilon_{t+j} + \check A C \epsilon_{t+j-1} + \cdots \check A^{j-1} \epsilon_{t+1}
762+
$$
763+
764+
After computing $\check A$, we can construct sample versions
765+
of
766+
767+
$$
768+
C \epsilon_{t+1} = X_{t+1} - \check A X_t , \quad t =1, \ldots, n-1
769+
$$
770+
771+
and check whether they are serially uncorrelated as assumed.
772+
773+
For example, we can compute spectra and cross-spectra of components of $C \epsilon_{t+1}$
774+
775+
We can also estimate the covariance matrix of $C \epsilon_{t+1}$
776+
from
777+
778+
$$
779+
\frac{1}{n} \sum_{j=1}^{n-1} (C \epsilon_{t+1} )( C \epsilon_{t+1})^T
780+
$$
781+
782+
It can be useful to transform variables in our reduced order VAR
783+
784+
785+
$$
786+
X_{t+1} = \Phi \Lambda \Phi^{+} X_t + C \epsilon_{t+1}
787+
$$
788+
789+
according to
790+
791+
$$
792+
\Phi^+ X_{t+1} = \Lambda \Phi^{+} X_t + \Phi^+ C \epsilon_{t+1}
793+
$$
794+
795+
or
796+
797+
$$
798+
\tilde X_{t+1} = \Lambda \tilde X_t + \tilde \epsilon_{t+1}
799+
$$
800+
801+
where $\tilde X_t $ is an $r \times 1$ **mode** and $\tilde \epsilon_{t+1}$ is an $r \times 1$
802+
shock.
803+
804+
805+
**Remark:** It is permissible for $X_t$ to contain lagged values of observables. For example:
806+
807+
$$
808+
X_t = \begin{bmatrix}
809+
y_{1t} \cr
810+
y_{1,t-1} \cr
811+
\vdots \cr
812+
y_{1, t-k}\cr
813+
y_{2,t} \cr
814+
y_{2, t-1} \cr
815+
\vdots
816+
\end{bmatrix}
817+
$$
818+
819+
820+
821+
822+
823+
824+
675825
+++
676826
677827
## Source for Some Python Code

0 commit comments

Comments
 (0)