Skip to content

Commit 51980f6

Browse files
Tom's further edits from Jan 9
1 parent e3ea223 commit 51980f6

File tree

2 files changed

+37
-19
lines changed

2 files changed

+37
-19
lines changed

lectures/_static/quant-econ.bib

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,17 @@
33
Note: Extended Information (like abstracts, doi, url's etc.) can be found in quant-econ-extendedinfo.bib file in _static/
44
###
55
6+
@article{tu_Rowley,
7+
title={On dynamic mode decomposition: Theory and applications},
8+
author={Tu, J. H. and Rowley, C. W. and Luchtenburg, D. M. and Brunton, S. L. and Kutz, J. N.},
9+
journal={Journal of Computational Dynamics},
10+
volume={1},
11+
number={2},
12+
year = {2014},
13+
pages={391--421}
14+
}
15+
16+
617
@book{Knight:1921,
718
author = {Knight, Frank H.},
819
date-added = {2020-08-20 10:29:34 -0500},

lectures/svd_intro.md

Lines changed: 26 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ kernelspec:
1313

1414
# Singular Value Decomposition (SVD)
1515

16-
In addition to regular packages contained in Anaconda by default, this notebook also requires:
16+
In addition to regular packages contained in Anaconda by default, this lecture also requires:
1717

1818
```{code-cell} ipython3
1919
:tags: [hide-output]
@@ -46,7 +46,7 @@ This lecture describes the singular value decomposition and two of its uses:
4646

4747
Let $X$ be an $m \times n$ matrix of rank $r$.
4848

49-
In this notebook, we'll think of $X$ as a matrix of **data**.
49+
In this lecture, we'll think of $X$ as a matrix of **data**.
5050

5151
* each column is an **individual** -- a time period or person, depending on the application
5252

@@ -55,21 +55,24 @@ In this notebook, we'll think of $X$ as a matrix of **data**.
5555

5656
We'll be interested in two distinct cases
5757

58-
* The **short and fat** case in which $m << n$, so that there are many more columns than rows.
58+
* A **short and fat** case in which $m << n$, so that there are many more columns than rows.
5959

60-
* The **tall and skinny** case in which $m >> n$, so that there are many more rows than columns.
60+
* A **tall and skinny** case in which $m >> n$, so that there are many more rows than columns.
6161

6262

6363
We'll apply a **singular value decomposition** of $X$ in both situations.
6464

65-
In the first case in which there are many more observations $n$ than there are random variables $m$, we learn about the joint distribution of the random variables by taking averages across observations of functions of the observations. Here we'll look for **patterns** by using a **singular value decomosition** to do a **principal components analysis** (PCA).
65+
In the first case in which there are many more observations $n$ than random variables $m$, we learn about the joint distribution of the random variables by taking averages across observations of functions of the observations.
66+
67+
Here we'll look for **patterns** by using a **singular value decomosition** to do a **principal components analysis** (PCA).
6668

6769
In the second case in which there are many more random variables $m$ than observations $n$, we'll proceed in a different way.
70+
6871
We'll again use a **singular value decomposition**, but now to do a **dynamic mode decomposition** (DMD)
6972

7073
## Singular Value Decomposition
7174

72-
The **singular value decomposition** of an $m \times n$ matrix $X$ of rank $r \leq \min(m,n)$ is
75+
A **singular value decomposition** of an $m \times n$ matrix $X$ of rank $r \leq \min(m,n)$ is
7376

7477
$$
7578
X = U \Sigma V^T
@@ -93,15 +96,17 @@ where
9396
* The $r$ singular values are square roots of the eigenvalues of the $m \times m$ matrix $X X^T$ and the $n \times n$ matrix $X^T X$
9497

9598
* When $U$ is a complex valued matrix, $U^T$ denotes the **conjugate-transpose** or **Hermitian-transpose** of $U$, meaning that
96-
$U_{ij}^T$ is the complex conjugate of $U_{ji}$. Similarly, when $V$ is a complex valued matrix, $V^T$ denotes the **conjugate-transpose** or **Hermitian-transpose** of $V$
99+
$U_{ij}^T$ is the complex conjugate of $U_{ji}$.
100+
101+
* Similarly, when $V$ is a complex valued matrix, $V^T$ denotes the **conjugate-transpose** or **Hermitian-transpose** of $V$
97102

98103
The shapes of $U$, $\Sigma$, and $V$ are $\left(m, m\right)$, $\left(m, n\right)$, $\left(n, n\right)$, respectively.
99104

100105
Below, we shall assume these shapes.
101106

102-
However, there is an alternative shape convention that we could have used, though we chose not to.
107+
However, though we chose not to, there is an alternative shape convention that we could have used.
103108

104-
Thus, note that because we assume that $A$ has rank $r$, there are only $r $ nonzero singular values, where $r=rank(A)\leq\min\left(m, n\right)$.
109+
Thus, note that because we assume that $A$ has rank $r$, there are only $r $ nonzero singular values, where $r=\textrm{rank}(A)\leq\min\left(m, n\right)$.
105110

106111
Therefore, we could also write $U$, $\Sigma$, and $V$ as matrices with shapes $\left(m, r\right)$, $\left(r, r\right)$, $\left(r, n\right)$.
107112

@@ -124,11 +129,11 @@ Q & = U V^T
124129

125130
where $S$ is evidently a symmetric matrix and $Q$ is an orthogonal matrix.
126131

127-
## Principle Componenents Analysis (PCA)
132+
## Principle Components Analysis (PCA)
128133

129-
Let's begin with the case in which $n >> m$, so that we have many more observations $n$ than random variables $m$.
134+
Let's begin with a case in which $n >> m$, so that we have many more observations $n$ than random variables $m$.
130135

131-
The data matrix $X$ is **short and fat** in the $n >> m$ case as opposed to a **tall and skinny** case with $m > > n $ to be discussed later in this notebook.
136+
The data matrix $X$ is **short and fat** in an $n >> m$ case as opposed to a **tall and skinny** case with $m > > n $ to be discussed later in this lecture.
132137

133138
We regard $X$ as an $m \times n$ matrix of **data**:
134139

@@ -140,7 +145,7 @@ where for $j = 1, \ldots, n$ the column vector $X_j = \begin{bmatrix}X_{1j}\\X_{
140145

141146
In a **time series** setting, we would think of columns $j$ as indexing different __times__ at which random variables are observed, while rows index different random variables.
142147

143-
In a **cross section** setting, we would think of columns $j$ as indexing different __individuals__ for which random variables are observed, while rows index different random variables.
148+
In a **cross section** setting, we would think of columns $j$ as indexing different __individuals__ for which random variables are observed, while rows index different **random variables**.
144149

145150
The number of singular values equals the rank of matrix $X$.
146151

@@ -187,7 +192,7 @@ is a vector of loadings of variables $X_i$ on the $k$th principle component, $i
187192
188193
* $\sigma_k $ for each $k=1, \ldots, r$ is the strength of $k$th **principal component**
189194
190-
## Digression: Reduced (or Economy) Versus Full SVD
195+
## Reduced Versus Full SVD
191196
192197
You can read about reduced and full SVD here
193198
<https://numpy.org/doc/stable/reference/generated/numpy.linalg.svd.html>
@@ -282,10 +287,12 @@ which evidently implies that $\tilde{\epsilon}_j\tilde{\epsilon}_j^T=1$.
282287
283288
Therefore
284289
290+
$$
285291
\begin{aligned}
286292
X&=\sqrt{\lambda_1}P_1\tilde{\epsilon_1}+\sqrt{\lambda_2}P_2\tilde{\epsilon_2}+\ldots+\sqrt{\lambda_m}P_m\tilde{\epsilon_m}\\
287293
&=\sigma_1P_1\tilde{\epsilon_2}+\sigma_2P_2\tilde{\epsilon_2}+\ldots+\sigma_mP_m\tilde{\epsilon_m}
288294
\end{aligned}
295+
$$
289296
290297
which evidently agrees with
291298
@@ -308,7 +315,7 @@ In the following, we accomplish this by
308315
1. sorting eigenvalues and singular values in descending order
309316
2. imposing positive diagonals on $P$ and $U$ and adjusting signs in $V^T$ accordingly
310317
311-
## Summary of Connections
318+
## Connections
312319
313320
To pull things together, it is useful to assemble and compare some formulas presented above.
314321
@@ -540,7 +547,7 @@ In forming $\tilde X$ and $\tilde X'$, we have in each case dropped a column fr
540547
541548
Evidently, $\tilde X$ and $\tilde X'$ are both $m \times \tilde n$ matrices where $\tilde n = n - 1$.
542549
543-
We start with a system consisting of $m$ least squares regressions of *everything on everything*:
550+
We start with a system consisting of $m$ least squares regressions of **everything** on one lagged value of **everything**:
544551
545552
$$
546553
\tilde X' = A \tilde X + \epsilon
@@ -552,7 +559,7 @@ $$
552559
A = \tilde X' \tilde X^{+}
553560
$$
554561
555-
and where the (huge) $m \times m $ matrix $X^{+}$ is the Moore-Penrose generalize inverse of $X$ that we could compute
562+
and where the (huge) $m \times m $ matrix $X^{+}$ is the Moore-Penrose generalized inverse of $X$ that we could compute
556563
as
557564
558565
$$
@@ -563,7 +570,7 @@ where the matrix $\Sigma^{-1}$ is constructed by replacing each non-zero element
563570
564571
The idea behind **dynamic mode decomposition** is to construct an approximation that
565572
566-
* sidesteps computing $X^{+}$
573+
* sidesteps computing the generalized inverse $X^{+}$
567574
568575
* retains only the largest $\tilde r< < r$ eigenvalues and associated eigenvectors of $U$ and $V^T$
569576
@@ -609,7 +616,7 @@ To accomplish a DMD, we deploy the following steps:
609616
* At this point, in constructing $\tilde A$ according to the above formula,
610617
we take only the columns of $U$ corresponding to the $\tilde r$ largest singular values.
611618
612-
Tu et al. verify that eigenvalues and eigenvectors of $\tilde A$ equal the leading eigenvalues and associated eigenvectors of $A$.
619+
Tu et al. {cite}`tu_Rowley` verify that eigenvalues and eigenvectors of $\tilde A$ equal the leading eigenvalues and associated eigenvectors of $A$.
613620
614621
* Construct an eigencomposition of $\tilde A$ that satisfies
615622

0 commit comments

Comments
 (0)