Skip to content
This repository has been archived by the owner on Nov 1, 2024. It is now read-only.

Commit

Permalink
feat(typst): backup_slides
Browse files Browse the repository at this point in the history
  • Loading branch information
storopoli committed Dec 25, 2023
1 parent eb1f699 commit 8cc4855
Show file tree
Hide file tree
Showing 2 changed files with 65 additions and 0 deletions.
64 changes: 64 additions & 0 deletions slides/backup_slides.typ
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
#import "@preview/polylux:0.3.1": *
#import themes.clean: *
#import "utils.typ": *

#new-section-slide("Backup Slides")

#slide(
title: [How the Normal distribution arose
#footnote[Origins can be traced back to Abraham de Moivre in 1738. A better explanation
can be found by
#link(
"http://www.stat.yale.edu/~pollard/Courses/241.fall2014/notes2014/Bin.Normal.pdf",
)[clicking here].]],
)[
#text(
size: 16pt,
)[

$
"Binomial"(n, k) &= binom(n, k) p^k (1-p)^(n-k) \
n! &≈ sqrt(2 π n) (n / e)^n \
lim_(n → oo) binom(n, k) p^k (1-p)^(n-k) &=
1 / (sqrt(2 π n p q)) e^(-((k - n p)^2) / (2 n p q))
$

We know that in the binomial: $op("E") = n p$ and $op("Var") = n p q$; hence
replacing $op("E")$ by $μ$ and $op("Var")$ by $σ^2$:

$
lim_(n → oo) binom(n, k) p^k (1-p)^(n-k) = 1 / (σ sqrt(2 π)) e^(-((k - μ)^2) / (σ^2))
$
]
]

#slide(
title: [QR Decomposition],
)[
#text(
size: 13pt,
)[
In Linear Algebra 101, we learn that any matrix (even non-square ones) can be
decomposed into a product of two matrices:

- $bold(Q)$: an orthogonal matrix (its columns are orthogonal unit vectors, i.e. $bold(Q)^T = bold(Q)^(-1)$)
- $bold(R)$: an upper-triangular matrix

Now, we incorporate the QR decomposition into the linear regression model. Here,
I am going to use the "thin" QR instead of the "fat", which scales $bold(Q)$ and $bold(R)$ matrices
by a factor of
$sqrt(n - 1)$ where $n$ is the number of rows in $bold(X)$. In practice, it is
better to implement the thin QR, than the fat QR decomposition. It is more
numerical stable. Mathematically speaking, the thing QR decomposition is:

$
bold(X) &= bold(Q)^* bold(R)^* \
bold(Q)^* &= bold(Q) dot sqrt(n - 1) \
bold(R)^* &= 1 / (sqrt(n - 1)) dot bold(R) \
bold(μ) &= α + bold(X) dot bold(β) + σ \
&= α + bold(Q)^* dot bold(R)^* dot bold(β) + σ \
&= α + bold(Q)^* dot (bold(R)^* dot bold(β)) + σ \
&= α + bold(Q)^* dot tilde(bold(β)) + σ
$
]
]
1 change: 1 addition & 0 deletions slides/slides.typ
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@
// #include "11-hierarchical_models.typ"
// #include "12-mcmc.typ"
// #include "13-model_comparison.typ"
#include "backup_slides.typ"

#slide(title: "Bibliography")[
#bibliography(title: none, "references.yml")
Expand Down

0 comments on commit 8cc4855

Please sign in to comment.