From 6ce1db1f867c545ebdb1afb705580514b356f883 Mon Sep 17 00:00:00 2001
From: Holden Rohrer
Date: Wed, 5 Jan 2022 00:02:12 -0500
Subject: more math stuff
---
zhilova/final.tex | 179 +++++++++++++++++++++++++++++++++++++++++++++++++++
zhilova/midterm2.tex | 146 +++++++++++++++++++++++++++++++++++++++++
2 files changed, 325 insertions(+)
create mode 100644 zhilova/final.tex
create mode 100644 zhilova/midterm2.tex
(limited to 'zhilova')
diff --git a/zhilova/final.tex b/zhilova/final.tex
new file mode 100644
index 0000000..10b93f7
--- /dev/null
+++ b/zhilova/final.tex
@@ -0,0 +1,179 @@
+\newfam\rsfs
+\newfam\bbold
+\def\scr#1{{\fam\rsfs #1}}
+\def\bb#1{{\fam\bbold #1}}
+\let\oldcal\cal
+\def\cal#1{{\oldcal #1}}
+\font\rsfsten=rsfs10
+\font\rsfssev=rsfs7
+\font\rsfsfiv=rsfs5
+\textfont\rsfs=\rsfsten
+\scriptfont\rsfs=\rsfssev
+\scriptscriptfont\rsfs=\rsfsfiv
+\font\bbten=msbm10
+\font\bbsev=msbm7
+\font\bbfiv=msbm5
+\textfont\bbold=\bbten
+\scriptfont\bbold=\bbsev
+\scriptscriptfont\bbold=\bbfiv
+
+\def\E{\bb E}
+\def\P{\bb P}
+\newcount\qnum
+\def\fr#1#2{{#1\over #2}}
+\def\var{\mathop{\rm var}\nolimits}
+\def\cov{\mathop{\rm cov}\nolimits}
+\def\dd#1#2{\fr{\partial #1}{\partial #2}}
+\def\bmatrix#1{\left[\matrix{#1}\right]}
+
+\def\problem#1{\vskip0pt plus 2in\goodbreak
+\vskip0pt plus -2in\medskip\noindent{\bf #1)}\smallskip\penalty500}
+\def\part#1{\goodbreak\smallskip\noindent{\bf (#1)}\penalty500\par}
+
+\problem{1}
+\part{a}
+\let\truebeta\beta
+\def\beta{\hat\truebeta}
+$${\cal L}(\beta;X_1,\ldots,X_n) = \prod_{i=1}^{n} {1\over
+\Gamma(\alpha)\beta^\alpha}X_i^{\alpha-1}e^{-X_i/\beta}$$
+$$\ell(\beta) = \ln{\cal L}(\beta) = -n\ln(\Gamma(\alpha)) - \alpha n\ln\beta +
+ \sum_{i=1}^n [(\alpha-1)\ln(X_i) - X_i/\beta].$$
+$${d\ell(\beta)\over d\beta} = -{\alpha n\over\beta} + \sum_{i=1}^n
+{X_i\over\beta^2} = 0 \to \sum_{i=1}^n X_i = \beta \alpha n \to \beta
+= \overline X/\alpha = \overline X/4,$$
+where $\overline X = \fr1n \sum_{i=1}^n X_i.$
+
+\part{b}
+\let\beta\truebeta
+$$\E(\overline X) = \fr1n\sum_{i=1}^n \E X = \E X,$$
+so $\E\hat\beta = \E X / \alpha.$
+$$\E X = \int_0^\infty {x^\alpha e^{-x/\beta}\over\Gamma(\alpha)\beta^\alpha} dx
+= \alpha\beta\int_0^\infty {x^\alpha e^{-x/\beta}\over
+\Gamma(\alpha+1)\beta^{\alpha+1}} dx
+= \alpha\beta,$$
+because the integrand is the gamma distribution for $\alpha' =
+\alpha+1.$ Therefore, the estimator is unbiased because
+$\E\hat\beta = \alpha\beta/\alpha = \beta.$
+
+\part{c}
+By the central limit theorem, as $n\to\infty,$ $\hat\beta \sim
+{\cal N}(\E (\hat\beta), \var(\hat\beta)/n) = {\cal N}(\beta,
+\var(\hat\beta)/n),$ so if
+$\var \hat\beta<\infty,$ the estimator is consistent.
+
+The mgf of $X_k$ is $(1-\beta t)^\alpha,$ so the mgf of
+$Y = \sum_{i=1}^n X_i$ is $(1-\beta t)^{n\alpha}.$
+$$Y \sim \Gamma(\alpha n, \beta) \to \overline X \sim \Gamma(\alpha n,
+\beta/n) \to \hat\beta \sim \Gamma(\alpha n, \beta/n\alpha),$$
+by change of variable in the gamma distribution.%
+\footnote{*}{$X\sim \Gamma(\alpha, \beta)$ has pdf
+${1\over\Gamma(\alpha)\beta^\alpha}x^{\alpha-1}e^{-x\over\beta},$ so
+$kX$ has pdf
+${1\over\Gamma(\alpha)\beta^\alpha}(kx)^{\alpha-1}e^{-kx\over\beta},$
+giving $kX \sim \Gamma(\alpha, k\beta).$}
+The gamma function has variance $\alpha\beta^2,$ so the variance of
+$\hat\beta$ is $\beta^2/n\alpha,$ which is less than infinity, so the
+estimator is consistent (and it will tend to zero).
+% to prove, and to find variance. actually, we don't need to find
+% variance for this problem, but we do for (d). find the lecture!!
+
+\part{d}
+
+Since we've already proven $\E(\hat\beta) = \beta$ and obtained a value
+for $\var\hat\beta,$ we get the following result by the Central Limit
+Theorem,
+$\sqrt n(\hat\beta - \beta) \to {\cal N}(0, \var(\hat\beta)) =
+{\cal N}(0, \beta^2/n\alpha)$
+
+\problem{2}
+
+\part{a}
+
+With $\theta = 0,$ by Student's Theorem,
+$${\overline X\over S/\sqrt{n}} \sim t(n-1).$$
+Taking $t_{1-\alpha}(n-1)$ to be the $1-\alpha$ quantile of the
+t-distribution with $n-1$ degrees of freedom, we have a test ${\overline
+X\over S/\sqrt{n}} \geq t_{1-\alpha}(n-1).$
+
+Substituting in our given values ($\overline X = .8,$ $n = 25,$ $S^2 =
+2.56$),
+$${.8\over 1.6/\sqrt{25}} \geq 1.711 \to 2.5 \geq 1.711,$$
+so our data does pass the test.
+
+\part{b}
+
+\def\cdf{{\bf T}}
+Letting $\cdf$ be the cdf of a t-distribution with $n-1$ degrees of
+freedom, we use the following result of student's theorem
+$${\overline X - \theta\over S/\sqrt n} \sim t(n-1)$$
+to get the probability this static is in the critical set as
+$$\gamma_C(\theta) = \P({\overline X\over S/\sqrt n} > 1.711) =
+\P({\overline X-\theta\over S/\sqrt n} > 1.711-{\theta\over S/\sqrt n})
+$$$$
+= 1-\cdf(1.711-{\theta\over S/\sqrt n}) =
+1-\cdf(1.711-{\theta\over .32})
+= \cdf({25\theta\over8} - 1.711).
+$$
+
+\problem{3}
+
+\part{a}
+
+The cdf of $X_i$ on the support of its pdf $[0,1],$ is $x,$ (zero on
+$x<0$ and one on $x>1$)
+With $X_{(1)} = \min(X_1,\ldots,X_6)$ and $X_{(6)} =
+\max(X_1,\ldots,X_6),$
+$$\P(X_{(1)} \geq x) = \P(X_1 \geq x)\P(X_2 \geq x)\cdots\P(X_6 \geq x)
+= (1-x)^6 \to \P(X_{(1)} \leq x) = 1-(1-x)^6.$$
+$$\P(X_{(6)} \leq x) = \P(X_1 \leq x)\P(X_2 \leq x)\cdots\P(X_6 \leq x)
+= x^6.$$
+
+These give pdfs for $X_{(1)}$ and $X_{(6)},$ respectively, $6(1-x)^5$
+and $6x^5.$
+
+\part{b}
+
+$$\E(X_{(1)} + X_{(6)}) = \int_0^1 x(6(1-x)^5 + 6x^5) dx =$$$$
+\left[ x(-(1-x)^6 + x^6) \right]_0^1 - \int_0^1 -(1-x)^6 + x^6 dx =
+1 - \fr17\left[-(1-x)^7 + x^7\right]_0^1 = 1.
+$$
+
+This makes sense by symmetry. The maximum value of the set has the same
+pdf as the minimum value reflected about .5, so we expect $\E X_{(6)} =
+1 - \E X_{(1)}.$
+
+\problem{4}
+
+\part{a}
+
+$$Y := 2X_2 - X_1 = \pmatrix{-1&2&0}{\bf X} = t^T{\bf X}.$$
+$$\E Y = t^T\E{\bf X} = -1(-1) + 2(2) = 5.$$
+$$\var Y = \E(t^TXX^Tt) - \E(t^TX)\E(X^Tt) = t^T(\var X)t =
+\bmatrix{-1&2&0}\bmatrix{4&-1&0\cr-1&1&0\cr0&0&2}\bmatrix{-1\cr2\cr0} =
+12.
+$$
+
+\def\cdf{{\bf\Phi}}
+Where $\cdf$ is the cdf of the standard normal distribution, we
+normalize $2X_2-X_1,$ to reach the standard normal and get
+$$\P(2X_2 > X_1 + 3) = \P(2X_2 - X_1 - 5 > -2) = \P((2X_2 - X_1 -
+5)/\sqrt{12} > -2/\sqrt{12}) = 1-\cdf(-1/\sqrt{3}) \approx .793.$$
+
+\part{b}
+
+If $X,Y \sim {\cal N}(0,1)$ and $X\perp Y,$ $X^2 + Y^2 \sim \chi^2(2)$
+by the definition of $\chi^2.$
+
+For our problem, $Y^TY \sim \chi^2(2)$ if $Y$ is a multivariate normal
+with
+$$\E Y = \pmatrix{0\cr0} \qquad \var Y = \pmatrix{1&0\cr0&1}.$$
+
+$$\var (X_1,X_3)^T = \pmatrix{4&0\cr0&2} \to Y =
+\pmatrix{1/2&0\cr0&1/\sqrt2}(X_1,X_3)^T + \mu,$$
+$A$ given by $(\var (X_1,X_3)^T)^{-1/2},$ from $A = \Sigma^{-1/2}$
+(3.5.12) in the textbook.
+
+$$\E Y = \bmatrix{-1/2\cr\sqrt2} + \mu = 0 \to \mu =
+\bmatrix{1/2\cr -\sqrt2}\qquad A = \bmatrix{1/2&0\cr0&1/\sqrt2}$$
+
+\bye
diff --git a/zhilova/midterm2.tex b/zhilova/midterm2.tex
new file mode 100644
index 0000000..8e74cf8
--- /dev/null
+++ b/zhilova/midterm2.tex
@@ -0,0 +1,146 @@
+\def\problem#1{\goodbreak\bigskip\noindent{\bf #1)}\smallskip\penalty500}
+\newfam\rsfs
+\newfam\bbold
+\def\scr#1{{\fam\rsfs #1}}
+\def\bb#1{{\fam\bbold #1}}
+\let\oldcal\cal
+\def\cal#1{{\oldcal #1}}
+\font\rsfsten=rsfs10
+\font\rsfssev=rsfs7
+\font\rsfsfiv=rsfs5
+\textfont\rsfs=\rsfsten
+\scriptfont\rsfs=\rsfssev
+\scriptscriptfont\rsfs=\rsfsfiv
+\font\bbten=msbm10
+\font\bbsev=msbm7
+\font\bbfiv=msbm5
+\textfont\bbold=\bbten
+\scriptfont\bbold=\bbsev
+\scriptscriptfont\bbold=\bbfiv
+
+\def\E{\bb E}
+\def\P{\bb P}
+\newcount\qnum
+\def\fr#1#2{{#1\over #2}}
+\def\var{\mathop{\rm var}\nolimits}
+\def\cov{\mathop{\rm cov}\nolimits}
+\def\dd#1#2{\fr{\partial #1}{\partial #2}}
+
+\problem{1}
+\noindent{\bf (a)}
+$$\E(Z) = \pmatrix{1\cr0}\qquad \var(Z) = \pmatrix{2&c\cr c&4}$$
+
+\noindent{\bf (b)}
+Covariance is a bilinear function, and $\var (kX) = \cov(kX,kX) =
+k^2\var X.$ Also, $\cov(c, X) = 0,$ if $c$ is a constant, regardless of
+$X.$ (because $\cov(c, X) = \E(cX) - \E(c)\E(X) = c\E(X) - c\E(X) = 0.$)
+With linearity, this means $\cov(X+c, Y+b) = \cov(X, Y).$
+$$\rho(2X-1, 5-Y) =
+{\cov(2X-1, 5-Y)\over\sqrt{\var(2X-1)}\sqrt{\var(5-Y)}} =
+{\cov(2X, -Y)\over\sqrt{\var(2X)}\sqrt{\var(-Y)}} = $$$$
+{-2\cov(X, Y)\over2\sqrt{\var(X)}\sqrt{\var(Y)}} =
+-{.5\over\sqrt{2}\sqrt{4}} =
+-{\sqrt2\over8}.$$
+
+\noindent{\bf (c)}
+
+$X$ and $Y$ are not necessarily independent from each other, although
+independence would give a covariance of 0 ($p_XY(x,y) = p_X(x)p_Y(y)
+\to \E(XY) = \E(X)\E(Y).$)
+
+Let $W \sim \cal N(0, 1),$ and $Z \sim 2\cal B(.5) - 1$ (i.e. it has a
+.5 probability of being -1 or 1).
+$X := \sqrt2 W + 1$ and $Y := 2ZW.$
+These are strictly dependent because $Y = \sqrt2Z(X-1),$ so $Y$ has
+conditional distribution $\sqrt2(x-1)(2\cal B(.5) - 1),$ which is
+clearly not equal to its normal distribution (which can be fairly easily
+verified by symmetry of $W$).
+However, they have covariance 0:
+$$\E(XY) - \E X\E Y = \E((\sqrt2 W + 1)2ZW) - \E(\sqrt 2 W + 1)\E(2ZW)
+$$$$
+= \E(2\sqrt2 ZW^2) - \E(\sqrt 2 W)\E(2ZW)
+= 0 - 0\E(2ZW) = 0.
+$$
+
+% wikipedia says no
+
+\problem{2}
+\noindent{\bf (a)}
+
+\def\idd#1#2{\dd{#1}{#2}^{-1}}
+$Y_1 = 2X_2$ and $Y_2 = X_1 - X_2$ give us $X_2 = Y_1/2$ and
+$X_1 = Y_2 + Y_1/2.$ This lets us compute Jacobian
+$$J = \left|\matrix{\idd{x_1}{y_1} &\idd{x_1}{y_2}\cr
+ \idd{x_2}{y_1} &\idd{x_2}{y_2}}\right|
+ = \left|\matrix{2&1\cr2&0}\right| = -2.$$
+$$g(y_1, y_2) = \left\{\vcenter{\halign{\strut$#$,&\quad$#$\cr
+ |J|2e^{-(y_2+y_1/2)}e^{-y_1/2} & 0 < y_2+y_1/2 < y_1/2\cr
+ 0 & {\rm elsewhere}\cr
+ }}\right.$$
+$y_2+y_1/2 < y_1/2 \to y_2 < 0 \to -y_2 > 0.$
+And $0 < y_2 + y_1/2 \to y_1 > -2y_2 > 0.$
+$$ = \left\{\vcenter{\halign{\strut$#$,&\quad$#$\cr
+ 4e^{-y_2}e^{-y_1}&y_1 > -2y_2 > 0\cr
+ 0&{\rm elsewhere}\cr
+ }}\right.$$
+
+\noindent{\bf (b)}
+
+$$g(y_1) = \int_{-\infty}^\infty g(y_1,y_2)dy_2 =
+\bb I(y_1>0)\int_{-y_1/2}^0 4e^{-y_1}e^{-y_2} dy_2 =
+\bb I(y_1>0)4e^{-y_1}(1-e^{y_1/2}).$$
+$$g(y_2) = \int_{-\infty}^\infty g(y_1,y_2)dy_1 =
+\bb I(y_2<0)\int_{-2y_2}^\infty 4e^{-y_1}e^{-y_2} dy_1 =
+\bb I(y_2<0)4e^{-y_2}(-e^{2y_2})
+.$$
+
+\noindent{\bf (c)}
+
+They are independent iff $g(y_1,y_2) \bb I(y_1 > -2y_2 > 0)e^{-y_1-y_2}
+= g(y_1)g(y_2) = \bb I(y_1 > 0)\bb I(y_2 < 0) h(x),$
+where $h(x)$ is the strictly non-zero product of exponents that would
+result, showing that they are dependent (if $y_1 = -y_2 = 1,$ the right
+indicators are satisfied but not the left indicator, and since $h(x)$ is
+non-zero, we see a contradiction.)
+
+\problem{3}
+\noindent{\bf (a)}
+We start determining the mgf from the pdf of $X,$
+$p_X(x) =
+\fr1{\sqrt{2\pi}}e^{-\fr12x^2}.$
+$$\E(e^{tX}) =
+\int_{-\infty}^\infty e^{tx}\fr1{\sqrt{2\pi}}e^{-\fr12x^2} dx =
+\fr1{\sqrt{2\pi}} \int_{-\infty}^\infty e^{tx-\fr12x^2} dx = $$$$
+\fr1{\sqrt{2\pi}} \int_{-\infty}^\infty e^{tx-\fr12x^2-\fr12t^2 + \fr12t^2} dx =
+e^{\fr12t^2} \int_{-\infty}^\infty \fr1{\sqrt{2\pi}}e^{-\fr12(x-t)^2} dx
+= e^{\fr12t^2},
+$$
+by the final integrand being a normal pdf and therefore integrating to
+1.
+
+\noindent{\bf (b)}
+$$M_Y(t) = \E(e^{t(aX+b)}) = \E(e^{bt}e^{atX}) = e^{bt}\E(e^{atX}) =
+e^{bt}M_X(at) = e^{bt}e^{\fr12(at)^2}.$$
+
+\noindent{\bf (c)}
+
+Theorem 1.9.2 states that two probability distribution functions are
+alike if and only if their moment generating functions are equal in some
+vicinity of zero.
+The mgf of $Y$ corresponds to $\cal N(b, a^2),$ which has the following
+mgf (by computation from its pdf definition):
+$$\int_{-\infty}^\infty e^{tx}\fr1{a\sqrt{2\pi}}e^{-(x-b)^2\over
+2a^2} dx =
+\fr1{a\sqrt{2\pi}}\int_{-\infty}^\infty e^{2a^2tx - x^2 + 2bx - b^2\over
+2a^2} dx =$$$$
+\fr1{a\sqrt{2\pi}}\int_{-\infty}^\infty e^{-(b+a^2t)^2 +
+2(a^2t+b)x - x^2 - b^2 + (b+a^2t)^2\over 2a^2} dx =
+e^{(b+a^2t)^2-b^2\over 2a^2}\int_{-\infty}^\infty
+\fr1{a\sqrt{2\pi}}e^{-(b+a^2t+x)^2 \over 2a^2} dx =
+e^{bt}e^{(at)^2\over2},
+$$
+proving $Y \sim \cal N(b, a^2),$ because this function is convergent
+everywhere, and reusing the fact that the final integrand is a normal
+pdf, so it must integrate to 1.
+
+\bye
--
cgit