Skip to content

Commit 09d9ea5

Browse files
aa
authored andcommitted
Add GPT-5.4 Codex experiment config and generated deliverables
1 parent 8519743 commit 09d9ea5

5 files changed

Lines changed: 646 additions & 4 deletions

File tree

Lines changed: 390 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,390 @@
1+
\documentclass[aspectratio=169]{beamer}
2+
\usetheme{Madrid}
3+
\usecolortheme{default}
4+
5+
\usepackage{amsmath,amssymb}
6+
\usepackage{bm}
7+
\usepackage{booktabs}
8+
\usepackage{tikz}
9+
\usetikzlibrary{arrows.meta,positioning,calc,fit,shapes.geometric}
10+
11+
\title{Bayesian Inference}
12+
\subtitle{A concise introduction for graduate students in quantitative fields}
13+
\author{Generated self-contained Beamer presentation}
14+
\date{\today}
15+
16+
\newcommand{\E}{\mathbb{E}}
17+
\newcommand{\Var}{\mathrm{Var}}
18+
\newcommand{\Prb}{\mathbb{P}}
19+
\newcommand{\Normal}{\mathcal{N}}
20+
\newcommand{\BetaD}{\mathrm{Beta}}
21+
\newcommand{\Binom}{\mathrm{Binomial}}
22+
\newcommand{\Bern}{\mathrm{Bernoulli}}
23+
\newcommand{\iid}{\stackrel{\mathrm{iid}}{\sim}}
24+
25+
\begin{document}
26+
27+
\begin{frame}
28+
\titlepage
29+
\end{frame}
30+
31+
\begin{frame}{Learning goals}
32+
\begin{itemize}
33+
\item Interpret Bayesian inference as coherent updating of uncertainty.
34+
\item Distinguish the roles of the prior, likelihood, posterior, and predictive distribution.
35+
\item Work through two conjugate examples: Beta--Binomial and Normal--Normal.
36+
\item Understand how Bayesian intervals, prediction, computation, and model checking differ from frequentist analogs.
37+
\end{itemize}
38+
\vspace{0.5em}
39+
\begin{block}{Core idea}
40+
Unknown quantities are treated as random variables, and observed data update beliefs through Bayes' rule.
41+
\end{block}
42+
\end{frame}
43+
44+
\begin{frame}{Why Bayesian inference?}
45+
\begin{columns}[T,onlytextwidth]
46+
\column{0.57\textwidth}
47+
\begin{itemize}
48+
\item Quantifies uncertainty directly about parameters of interest.
49+
\item Naturally combines prior knowledge with new evidence.
50+
\item Produces full distributions, not just point estimates.
51+
\item Handles prediction and sequential learning in a unified framework.
52+
\end{itemize}
53+
54+
\column{0.4\textwidth}
55+
\centering
56+
\begin{tikzpicture}[>=Latex, node distance=1.3cm]
57+
\tikzstyle{box}=[draw, rounded corners, align=center, minimum width=2.8cm, minimum height=0.9cm, fill=blue!8]
58+
\node[box] (prior) {Prior belief\\$p(\theta)$};
59+
\node[box, below=of prior, fill=green!8] (data) {Observed data\\$y$};
60+
\node[box, right=1.0cm of $(prior)!0.5!(data)$, fill=orange!12] (post) {Updated belief\\$p(\theta\mid y)$};
61+
\draw[->, thick] (prior.east) -- ++(0.45,0) |- (post.west);
62+
\draw[->, thick] (data.east) -- ++(0.45,0) |- (post.west);
63+
\end{tikzpicture}
64+
\end{columns}
65+
\end{frame}
66+
67+
\begin{frame}{Bayes' theorem}
68+
\begin{block}{Posterior distribution}
69+
\[
70+
p(\theta\mid y)=\frac{p(y\mid\theta)\,p(\theta)}{p(y)},
71+
\qquad
72+
p(y)=\int p(y\mid\theta)p(\theta)\,d\theta.
73+
\]
74+
\end{block}
75+
76+
\begin{columns}[T,onlytextwidth]
77+
\column{0.55\textwidth}
78+
\begin{itemize}
79+
\item $p(\theta)$: \alert{prior} encodes beliefs before data.
80+
\item $p(y\mid\theta)$: \alert{likelihood} measures compatibility of $\theta$ with the data.
81+
\item $p(y)$: \alert{evidence} normalizes the posterior.
82+
\item $p(\theta\mid y)$: \alert{posterior} combines prior information and data.
83+
\end{itemize}
84+
85+
\column{0.42\textwidth}
86+
\begin{block}{Working proportionality}
87+
In practice we often use
88+
\[
89+
p(\theta\mid y)\propto p(y\mid\theta)p(\theta),
90+
\]
91+
and ignore $p(y)$ until normalization or sampling.
92+
\end{block}
93+
\end{columns}
94+
\end{frame}
95+
96+
\begin{frame}{The Bayesian workflow}
97+
\centering
98+
\begin{tikzpicture}[>=Latex, node distance=1.35cm]
99+
\tikzstyle{stage}=[draw, rounded corners, align=center, minimum width=2.2cm, minimum height=1.0cm, fill=blue!7]
100+
\node[stage] (model) {Specify\\model};
101+
\node[stage, right=of model] (prior) {Choose\\prior};
102+
\node[stage, right=of prior] (update) {Update with\\data};
103+
\node[stage, right=of update] (summ) {Summarize\\posterior};
104+
\node[stage, below=1.3cm of update, fill=green!10] (check) {Check fit \\\& predict};
105+
106+
\draw[->, thick] (model) -- (prior);
107+
\draw[->, thick] (prior) -- (update);
108+
\draw[->, thick] (update) -- (summ);
109+
\draw[->, thick] (summ) |- (check);
110+
\draw[->, thick] (check.west) -| (model.south);
111+
\end{tikzpicture}
112+
113+
\vspace{0.8em}
114+
\begin{itemize}
115+
\item Bayesian analysis is iterative: model building and model checking form a loop.
116+
\item Posterior predictive checks often reveal misfit even when parameter estimates look reasonable.
117+
\end{itemize}
118+
\end{frame}
119+
120+
\begin{frame}{Example 1: Beta--Binomial model}
121+
Suppose $y$ successes are observed in $n$ Bernoulli trials with success probability $\theta$.
122+
\[
123+
y\mid\theta \sim \Binom(n,\theta),
124+
\qquad
125+
p(y\mid\theta)\propto \theta^y(1-\theta)^{n-y}.
126+
\]
127+
Choose a Beta prior:
128+
\[
129+
\theta \sim \BetaD(\alpha,\beta),
130+
\qquad
131+
p(\theta)\propto \theta^{\alpha-1}(1-\theta)^{\beta-1}.
132+
\]
133+
134+
\begin{block}{Conjugacy}
135+
The posterior is in the same family as the prior, which makes updating algebraically simple.
136+
\end{block}
137+
\end{frame}
138+
139+
\begin{frame}{Closed-form update and interpretation}
140+
Combining likelihood and prior gives
141+
\[
142+
p(\theta\mid y)\propto \theta^{y+\alpha-1}(1-\theta)^{n-y+\beta-1},
143+
\]
144+
so that
145+
\[
146+
\theta\mid y \sim \BetaD(\alpha+y,\beta+n-y).
147+
\]
148+
149+
\begin{columns}[T,onlytextwidth]
150+
\column{0.52\textwidth}
151+
\begin{block}{Posterior mean}
152+
\[
153+
\E[\theta\mid y]=\frac{\alpha+y}{\alpha+\beta+n}.
154+
\]
155+
It is a weighted average of the prior mean $\alpha/(\alpha+\beta)$ and the sample proportion $y/n$.
156+
\end{block}
157+
158+
\column{0.44\textwidth}
159+
\centering
160+
\vspace{-0.9em}
161+
\begin{tikzpicture}[>=Latex, node distance=0.58cm, scale=0.8, transform shape]
162+
\tikzstyle{mini}=[draw, rounded corners, align=center, minimum width=2.45cm, minimum height=0.62cm]
163+
\node[mini, fill=blue!8] (prior) {Prior pseudo-counts\\$\alpha-1,\ \beta-1$};
164+
\node[mini, below=of prior, fill=green!8] (data) {Observed counts\\$y,\ n-y$};
165+
\node[mini, below=of data, fill=orange!12] (post) {Posterior counts\\$\alpha+y,\ \beta+n-y$};
166+
\draw[->, thick] (prior) -- (data);
167+
\draw[->, thick] (data) -- (post);
168+
\end{tikzpicture}
169+
\end{columns}
170+
\end{frame}
171+
172+
\begin{frame}{Numerical update example}
173+
Assume a prior centered at $0.50$ with moderate strength:
174+
\[
175+
\theta \sim \BetaD(4,4).
176+
\]
177+
Observe $y=16$ successes in $n=20$ trials. Then
178+
\[
179+
\theta\mid y \sim \BetaD(20,8).
180+
\]
181+
182+
\begin{columns}[T,onlytextwidth]
183+
\column{0.55\textwidth}
184+
\begin{itemize}
185+
\item Prior mean: $4/(4+4)=0.50$.
186+
\item Sample proportion: $16/20=0.80$.
187+
\item Posterior mean: $20/28\approx 0.714$.
188+
\item The posterior shrinks the raw sample proportion toward the prior mean.
189+
\end{itemize}
190+
191+
\column{0.4\textwidth}
192+
\begin{block}{Interpretation}
193+
The prior acts like extra observations, so Bayesian estimates often stabilize noisy small-sample problems.
194+
\end{block}
195+
\end{columns}
196+
\end{frame}
197+
198+
\begin{frame}{Example 2: Normal mean with known variance}
199+
Suppose
200+
\[
201+
y_i \mid \theta \iid \Normal(\theta,\sigma^2),
202+
\qquad
203+
\theta \sim \Normal(\mu_0,\tau_0^2),
204+
\]
205+
with known sampling variance $\sigma^2$.
206+
207+
\begin{block}{Posterior distribution}
208+
\[
209+
\theta\mid y \sim \Normal(\mu_n,\tau_n^2),
210+
\]
211+
where
212+
\[
213+
\tau_n^2=\left(\frac{1}{\tau_0^2}+\frac{n}{\sigma^2}\right)^{-1},
214+
\qquad
215+
\mu_n=\tau_n^2\left(\frac{\mu_0}{\tau_0^2}+\frac{n\bar y}{\sigma^2}\right).
216+
\]
217+
\end{block}
218+
The posterior mean is a precision-weighted average of the prior mean and sample mean.
219+
\end{frame}
220+
221+
\begin{frame}{Posterior summaries and interval estimates}
222+
Once we have $p(\theta\mid y)$, common summaries include:
223+
\[
224+
\text{posterior mean }\E[\theta\mid y],
225+
\qquad
226+
\text{MAP }\arg\max_{\theta} p(\theta\mid y),
227+
\qquad
228+
\text{posterior variance }\Var(\theta\mid y).
229+
\]
230+
231+
\begin{columns}[T,onlytextwidth]
232+
\column{0.5\textwidth}
233+
\begin{block}{Credible interval}
234+
A $95\%$ credible interval $[a,b]$ satisfies
235+
\[
236+
\Prb(\theta\in[a,b]\mid y)=0.95.
237+
\]
238+
This is a probability statement about the parameter given the observed data.
239+
\end{block}
240+
241+
\column{0.47\textwidth}
242+
\begin{block}{Frequentist confidence interval}
243+
A $95\%$ confidence interval is a procedure whose long-run coverage is $95\%$ over repeated samples.
244+
\end{block}
245+
\end{columns}
246+
\end{frame}
247+
248+
\begin{frame}{Posterior predictive distribution}
249+
Prediction integrates over parameter uncertainty:
250+
\[
251+
p(\tilde y\mid y)=\int p(\tilde y\mid\theta)p(\theta\mid y)\,d\theta.
252+
\]
253+
254+
\begin{columns}[T,onlytextwidth]
255+
\column{0.56\textwidth}
256+
\begin{itemize}
257+
\item This is crucial: predictions should reflect uncertainty in both noise and parameters.
258+
\item In the Beta--Binomial model, the predictive probability of success on the next trial is
259+
\[
260+
\Prb(\tilde y=1\mid y)=\E[\theta\mid y]=\frac{\alpha+y}{\alpha+\beta+n}.
261+
\]
262+
\item Posterior predictive checks compare replicated data $\tilde y$ with observed data $y$.
263+
\end{itemize}
264+
265+
\column{0.38\textwidth}
266+
\centering
267+
\begin{tikzpicture}[>=Latex, node distance=1.0cm]
268+
\tikzstyle{box}=[draw, rounded corners, align=center, minimum width=2.6cm, minimum height=0.85cm]
269+
\node[box, fill=orange!12] (post) {Posterior\\$p(\theta\mid y)$};
270+
\node[box, below=of post, fill=green!10] (pred) {Predict new data\\$p(\tilde y\mid y)$};
271+
\draw[->, thick] (post) -- (pred);
272+
\end{tikzpicture}
273+
\end{columns}
274+
\end{frame}
275+
276+
\begin{frame}{Hierarchical models and partial pooling}
277+
Bayesian models scale naturally to grouped data. For groups $j=1,\dots,J$:
278+
\[
279+
y_{ij}\mid\theta_j \sim p(y_{ij}\mid\theta_j),
280+
\qquad
281+
\theta_j\mid\mu,\tau^2 \sim \Normal(\mu,\tau^2).
282+
\]
283+
284+
\begin{columns}[T,onlytextwidth]
285+
\column{0.52\textwidth}
286+
\begin{itemize}
287+
\item Group-specific parameters borrow strength from one another.
288+
\item Small groups are shrunk more strongly toward the population mean.
289+
\item This often improves estimation and prediction relative to no pooling or complete pooling.
290+
\end{itemize}
291+
292+
\column{0.42\textwidth}
293+
\centering
294+
\begin{tikzpicture}[>=Latex]
295+
\node[draw, circle, fill=blue!8] (mu) at (0,1.8) {$\mu,\tau^2$};
296+
\node[draw, circle, fill=green!10] (t1) at (-1.4,0.5) {$\theta_1$};
297+
\node[draw, circle, fill=green!10] (t2) at (0,0.5) {$\theta_2$};
298+
\node[draw, circle, fill=green!10] (t3) at (1.4,0.5) {$\theta_J$};
299+
\node[draw, circle, fill=orange!10] (y1) at (-1.4,-0.8) {$y_{i1}$};
300+
\node[draw, circle, fill=orange!10] (y2) at (0,-0.8) {$y_{i2}$};
301+
\node[draw, circle, fill=orange!10] (y3) at (1.4,-0.8) {$y_{iJ}$};
302+
\draw[->, thick] (mu) -- (t1);
303+
\draw[->, thick] (mu) -- (t2);
304+
\draw[->, thick] (mu) -- (t3);
305+
\draw[->, thick] (t1) -- (y1);
306+
\draw[->, thick] (t2) -- (y2);
307+
\draw[->, thick] (t3) -- (y3);
308+
\draw[rounded corners] (-2.1,-1.35) rectangle (2.1,0.95);
309+
\node at (1.75,-1.15) {$j=1,\dots,J$};
310+
\end{tikzpicture}
311+
\end{columns}
312+
\end{frame}
313+
314+
\begin{frame}{When closed forms fail: computation}
315+
Many useful posteriors are not analytically tractable.
316+
317+
\begin{block}{Common computational strategies}
318+
\begin{itemize}
319+
\item \textbf{MCMC}: constructs a Markov chain whose stationary distribution is the posterior.
320+
\item \textbf{Hamiltonian Monte Carlo}: efficient for high-dimensional continuous parameters.
321+
\item \textbf{Variational inference}: turns inference into optimization for faster approximations.
322+
\end{itemize}
323+
\end{block}
324+
325+
\begin{block}{Diagnostics matter}
326+
Check convergence, effective sample size, Monte Carlo standard errors, and sensitivity to priors.
327+
\end{block}
328+
\end{frame}
329+
330+
\begin{frame}{Model checking and sensitivity analysis}
331+
\begin{columns}[T,onlytextwidth]
332+
\column{0.58\textwidth}
333+
\begin{itemize}
334+
\item \textbf{Posterior predictive checks}: compare observed summaries $T(y)$ to replicated summaries $T(\tilde y)$.
335+
\item \textbf{Residual structure}: look for patterns left unexplained by the model.
336+
\item \textbf{Prior sensitivity}: ask whether substantive conclusions change under reasonable alternative priors.
337+
\item \textbf{Decision relevance}: assess whether posterior uncertainty is small enough for the scientific or policy question.
338+
\end{itemize}
339+
340+
\column{0.37\textwidth}
341+
\centering
342+
\begin{tikzpicture}[>=Latex, node distance=0.95cm]
343+
\tikzstyle{box}=[draw, rounded corners, align=center, minimum width=2.6cm, minimum height=0.85cm]
344+
\node[box, fill=blue!8] (fit) {Fit model};
345+
\node[box, below=of fit, fill=green!8] (rep) {Simulate\\replicated data};
346+
\node[box, below=of rep, fill=orange!12] (cmp) {Compare\\$y$ and $\tilde y$};
347+
\node[box, below=of cmp, fill=red!10] (rev) {Revise if needed};
348+
\draw[->, thick] (fit) -- (rep);
349+
\draw[->, thick] (rep) -- (cmp);
350+
\draw[->, thick] (cmp) -- (rev);
351+
\draw[->, thick] (rev.west) -| ++(-1.0,0) |- (fit.west);
352+
\end{tikzpicture}
353+
\end{columns}
354+
\end{frame}
355+
356+
\begin{frame}{Bayesian linear regression in one line}
357+
For the Gaussian linear model
358+
\[
359+
\bm y\mid\bm\beta,\sigma^2 \sim \Normal(X\bm\beta,\sigma^2 I),
360+
\]
361+
with Gaussian prior $\bm\beta\sim\Normal(\bm\beta_0,V_0)$, the posterior is also Gaussian:
362+
\[
363+
V_n=(V_0^{-1}+X^TX/\sigma^2)^{-1},
364+
\qquad
365+
\bm\beta_n=V_n\left(V_0^{-1}\bm\beta_0+X^T\bm y/\sigma^2\right).
366+
\]
367+
368+
\begin{block}{Why this matters}
369+
This reveals a general pattern: regularization methods such as ridge regression can often be interpreted as Bayesian estimation with specific priors.
370+
\end{block}
371+
\end{frame}
372+
373+
\begin{frame}{Takeaways}
374+
\begin{enumerate}
375+
\item Bayesian inference updates uncertainty via
376+
\[
377+
\text{posterior} \propto \text{likelihood} \times \text{prior}.
378+
\]
379+
\item Conjugate models build intuition; modern computation handles richer models.
380+
\item Credible intervals and predictive distributions are direct, interpretable posterior summaries.
381+
\item Good Bayesian practice includes prior choice, computation, model checking, and sensitivity analysis.
382+
\end{enumerate}
383+
384+
\vspace{0.5em}
385+
\begin{block}{Final message}
386+
Bayesian inference is not only a formula; it is a workflow for learning from data under uncertainty.
387+
\end{block}
388+
\end{frame}
389+
390+
\end{document}

0 commit comments

Comments
 (0)