From 5c3f8dcea2cbba4866d493eca8c4a704b70553ce Mon Sep 17 00:00:00 2001 From: ChengruiMa Date: Mon, 24 Nov 2025 00:20:18 -0500 Subject: [PATCH] added practices for chpt 2 and 5 --- public/latex_notes/unit2/unit2.tex | 94 ++++++++++++++++++++++++++++++ public/latex_notes/unit5/unit5.tex | 36 ++++++++++++ 2 files changed, 130 insertions(+) diff --git a/public/latex_notes/unit2/unit2.tex b/public/latex_notes/unit2/unit2.tex index 87c1bff..a32aecf 100644 --- a/public/latex_notes/unit2/unit2.tex +++ b/public/latex_notes/unit2/unit2.tex @@ -1427,12 +1427,106 @@ \section*{Exercises} \end{enumerate} \end{exercise} +\begin{exercise}[Linear combinations of independent normal variables \ding{111}] +Let $X$ and $Y$ be independent with +\[ +X \sim \mathrm{Normal}(2,\,9), \qquad +Y \sim \mathrm{Normal}(-1,\,4). +\] +Define +\[ +U = 3X - 2Y + 5, \qquad +V = X + Y. +\] +\begin{enumerate}[label=(\alph*)] + \item Find $E[X]$, $\operatorname{Var}(X)$, $E[Y]$, and $\operatorname{Var}(Y)$. + + \item Using linearity of expectation, compute $E[U]$ and $E[V]$. + + \item Using independence and variance rules, compute $\operatorname{Var}(U)$ and $\operatorname{Var}(V)$. + + \item State the distributions + \[ + U \sim \mathrm{Normal}(\mu_U,\,\sigma_U^2), + \qquad + V \sim \mathrm{Normal}(\mu_V,\,\sigma_V^2). + \] + + \item Compute $E[XY]$. +\end{enumerate} +\end{exercise} +\begin{exercise}[Central Limit Theorem application \ding{111}] +A fair six-sided die has outcomes $\{1,2,3,4,5,6\}$, each with probability $1/6$. +Let $X_1, \dots, X_n$ be i.i.d., and define +\[ +S_n = \sum_{i=1}^n X_i, \qquad n = 200. +\] + +\begin{enumerate}[label=(\alph*)] + \item Compute the mean and variance of one roll: + \[ + \mu = E[X_1], \qquad + \sigma^2 = \operatorname{Var}(X_1). + \] + + \item Compute $E[S_n]$ and $\operatorname{Var}(S_n)$. + + \item Use the Central Limit Theorem to give an approximate distribution for $S_{200}$. + + \item Use this approximation to estimate + \[ + \mathbb{P}(S_{200} > 750), + \] + showing the standardization step explicitly. +\end{enumerate} \end{exercise} +\begin{exercise}[Interpreting coefficients in a linear regression with a binary predictor \ding{111}] +Consider the model: +\[ +X \sim \mathrm{Bernoulli}\left(\tfrac{1}{2}\right), +\qquad +Y \mid X \sim \mathrm{Normal}(\beta_0 + \beta_1 X,\ \sigma^2), +\] +equivalently, +\[ +Y = \beta_0 + \beta_1 X + \varepsilon, +\qquad +\varepsilon \mid X \sim \mathrm{Normal}(0,\sigma^2), +\] +with $\varepsilon$ independent of $X$. + +\begin{enumerate}[label=(\alph*)] + \item Compute: + \[ + E[Y \mid X = 0], \qquad + E[Y \mid X = 1]. + \] + + \item Show that + \[ + E[Y \mid X = 1] - E[Y \mid X = 0] = \beta_1, + \] + and briefly interpret $\beta_1$. + + \item Suppose we observe i.i.d.\ pairs $(X_i, Y_i)$ for $i=1,\dots,N$. + Define + \[ + \bar Y_1 = \frac{1}{N_1}\!\!\sum_{i : X_i = 1} Y_i, + \qquad + \bar Y_0 = \frac{1}{N_0}\!\!\sum_{i : X_i = 0} Y_i, + \] + and the estimator + \[ + \hat{\beta}_1 = \bar Y_1 - \bar Y_0. + \] + Explain why this is a natural estimator for $\beta_1$. +\end{enumerate} +\end{exercise} diff --git a/public/latex_notes/unit5/unit5.tex b/public/latex_notes/unit5/unit5.tex index 94aa80a..3383a44 100644 --- a/public/latex_notes/unit5/unit5.tex +++ b/public/latex_notes/unit5/unit5.tex @@ -706,6 +706,42 @@ \section*{Exercises} \end{exercise} +\begin{exercise}[Nonlinear basis functions] +A physical system is modeled as +\[ +f(x) = \theta_0 + \theta_1 e^{x} + \theta_2 \sin(3x). +\] +You want to fit this model using linear regression. + +\begin{enumerate} + \item Define basis functions $\phi_1(x), \phi_2(x), \phi_3(x)$ such that + \[ + f(x) = \sum_{i=1}^3 \beta_i \,\phi_i(x) + \] + becomes a linear-in-parameters model. + + \item Write the design matrix for data points $x_1, \dots, x_n$. + + \item State whether this model is nonlinear or linear from the perspective of regression, and explain why. +\end{enumerate} +\end{exercise} + +\begin{exercise}[Bias-Variance Tradeoff Conceptual Questions] +Consider two models for predicting $Y$ based on $X$: +\begin{itemize} + \item Model A: linear model with 2 parameters. + \item Model B: polynomial model with 30 parameters. +\end{itemize} + +\noindent Answer the following questions: +\begin{enumerate} + \item Which model has higher variance? Why? + \item Which model likely has higher bias? Why? + \item Give a real-world example where a high-bias model might be better. + \item Describe what happens to bias and variance as you increase model complexity. +\end{enumerate} +\end{exercise} +