SchoolWork-LaTeX/数理统计/平时作业/第九周作业.tex
423A35C7 5906ac1efc 重构目录层次
0-课程笔记
1-平时作业
2-实验报告
3-期末大作业
2024-09-02 18:32:58 +08:00

297 lines
17 KiB
TeX
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

\documentclass[全部作业]{subfiles}
\input{mysubpreamble}
\begin{document}
\renewcommand{\bar}{\xoverline}
\renewcommand{\hat}{\xwidehat}
\setcounter{chapter}{6}
\setcounter{section}{4}
\begin{enumerate}
\questionandanswerSolution[11]{
$x_1,x_2, \cdots ,x_m \overset{\text{i.i.d.}}{\sim} N(a, \sigma^{2}), y_1,y_2, \cdots y_n\overset{\text{i.i.d.}}{\sim}N(a,2\sigma^{2})$,求$a$$\sigma^{2}$的UMVUE。
}{
根据贝叶斯估计的方法,$\hat{a}$$\widehat{\sigma^{2}}$应为两个信息源的加权平均,权重为方差的倒数,即
$$
\hat{a}= \frac{\frac{1}{m\sigma^{2}}}{\frac{1}{m\sigma^{2}}+\frac{1}{2n\sigma^{2}}} \bar{x} + \frac{\frac{1}{2n\sigma^{2}}}{\frac{1}{m\sigma^{2}}+\frac{1}{2n\sigma^{2}}} \bar{y} = \frac{2 \bar{x} n + \bar{y} m}{m + 2 n}
$$
$$
\widehat{\sigma^{2}}=\frac{\frac{1}{m\sigma^{2}}}{\frac{1}{m\sigma^{2}}+\frac{1}{2n\sigma^{2}}} s_{x}^{2} + \frac{\frac{1}{2n\sigma^{2}}}{\frac{1}{m\sigma^{2}}+\frac{1}{2n\sigma^{2}}} s_{y}^{2} = \frac{m s_{y}^{2} + 2 n s_{x}^{2}}{m + 2 n}
$$
$0$的任一无偏估计$\varphi(x_1,x_2, \cdots ,x_m,y_1,y_2, \cdots ,y_n)$$\operatorname{Cov}(\hat{a},\varphi)=0, \operatorname{Cov}(\widehat{\sigma^{2}},\varphi)=0$,所以$\hat{a}$$\widehat{\sigma^{2}}$是UMVUE。
}
\questionandanswerProof[12]{
$x_1,x_2, \cdots ,x_n\overset{\text{i.i.d.}}{\sim}N(\mu,1)$,求$\mu^{2}$的UMVUE。证明此UMVUE达不到C-R不等式的下界即它不是有效估计。
}{
直观上来看,$\mu^{2}$的UMVUE应该是$\bar{x}^{2}$。接下来计算C-R不等式的下界由于$I(\mu)=1$所以C-R不等式的下界为
$$
\frac{[g'(\mu)]^{2}}{n I(\mu)}=\frac{(2\mu)^{2}}{n} = \frac{4\mu^{2}}{n}
$$
由于$\bar{x}\sim N(\mu, \frac{1}{n})$,所以$(n(\bar{x}-\mu)) \sim \chi^{2}(1)$
$$
\operatorname{Var} \bar{x}^{2} = E \bar{x}^{4} - (E \bar{x}^{2})^{2} =\text{实在是不会算了} > \frac{4\mu^{2}}{n}
$$
所以此UMVUE达不到C-R不等式的下界即它不是有效估计。
}
\questionandanswer[14]{
$x_1,x_2, \cdots x_n$为独立同分布变量,$0<\theta<1$
$$
P(x_1=-1)=\frac{1-\theta}{2}, \quad P(x_1=0)=\frac{1}{2}, \quad P(x_1=1)=\frac{\theta}{2}
$$
}{}
\begin{enumerate}
\questionandanswerSolution[]{
$\theta$的MLE $\hat{\theta}_1$并问$\hat{\theta}_1$是否是无偏的;
}{
设在$x_1,x_2, \cdots ,x_n$中有$n_{-1}$$-1$$n_{0}$$0$$n_1$$1$,则对数极大似然函数为
$$
\begin{aligned}
\ln L(n_{-1},n_{0},n_1;\theta)&=\ln \left[ \left( \frac{1-\theta}{2} \right) ^{n_{-1}} \left( \frac{1}{2} \right) ^{n_0} \left( \frac{\theta}{2} \right) ^{n_1} \right] \\
&=n_{-1}\ln \left( \frac{1-\theta}{2} \right) +n_0 \ln \frac{1}{2}+n_1 \ln \frac{\theta}{2} \\
\end{aligned}
$$
$\theta$求偏导并令其为0
$$
\frac{\partial L}{\partial \theta}=-\frac{1}{2}\frac{2 n_{-1}}{1-\theta}+ \frac{1}{2}\frac{2n_1}{\theta} = \frac{n_1}{\theta}-\frac{n_{-1}}{1-\theta} = 0
$$
则最大似然估计为
$$
\hat{\theta}_1 = \frac{n_{1}}{n_{1} + n_{-1}}
$$
根据重期望公式,
$$
E \hat{\theta}_1 = E\left( E\left( \frac{n_1}{n_1+n_{-1}} \middle| n_1+n_{-1} \right) \right)
$$
其中
$$
E\left( \frac{n_1}{n_1+n_{-1}}\middle| n_1+n_{-1} \right) =E\left( \frac{n_1}{m}\middle| n_1+n_{-1}=m \right) = \frac{1}{m} \times m \frac{\frac{\theta}{2}}{\frac{1-\theta}{2}+\frac{\theta}{2}} = \theta
$$
所以$E \hat{\theta}_1 = E(\theta)= \theta$,即$\hat{\theta}_1$是无偏估计。
}
\questionandanswerSolution[]{
$\theta$的矩估计$\hat{\theta}_2$
}{
设总体为$X$,则
$$
EX = -1 \times \frac{1-\theta}{2}+0\times \frac{1}{2}+1\times \frac{\theta}{2} = \theta - \frac{1}{2}
$$
所以矩估计$\hat{\theta}_2 = \bar{x}+\frac{1}{2}$
}
\questionandanswerSolution[]{
计算$\theta$的无偏估计的方差的C-R下界。
}{
$$
p(x;\theta)=\begin{cases}
\frac{1-\theta}{2},\quad & x=-1 \\
\frac{1}{2},\quad & x=0 \\
\frac{\theta}{2},\quad & x=1 \\
0, \quad &\text{其他} \\
\end{cases}, \quad \ln p(x;\theta)=\begin{cases}
\ln (1-\theta)-\ln 2,\quad & x=-1 \\
-\ln 2,\quad & x=0 \\
\ln \theta-\ln 2,\quad & x=1 \\
0,\quad & \text{其他} \\
\end{cases},
$$
$$
\frac{\partial \ln p(x;\theta)}{\partial \theta}=\begin{cases}
-\frac{1}{1-\theta},\quad & x=-1 \\
0,\quad & x=0 \\
\frac{1}{\theta},\quad & x=1 \\
0,\quad & \text{其他} \\
\end{cases},\quad \left( \frac{\partial \ln p(x;\theta)}{\partial \theta} \right) ^{2} = \begin{cases}
\frac{1}{(1-\theta)^{2}},\quad & x=-1 \\
\frac{1}{\theta^{2}},\quad & x=1 \\
0,\quad & \text{其他} \\
\end{cases}
$$
所以
$$
I(\theta)=E\left( \frac{\partial \ln p(x;\theta)}{\partial \theta} \right) ^{2}=\frac{1}{(1-\theta)^{2}}\times \frac{1-\theta}{2}+\frac{1}{\theta^{2}}\times \frac{\theta}{2} = \frac{1}{2 \theta (1-\theta )}
$$
所以$\theta$的无偏估计的方差的C-R下界为
$$
\frac{1}{n I(\theta)}=\frac{2\theta(1-\theta)}{n}
$$
}
\end{enumerate}
\end{enumerate}
\section{贝叶斯估计}
\begin{enumerate}
\questionandanswerSolution[2]{
设总体为均匀分布$U(\theta,\theta+1)$$\theta$的先验分布是$U(10,16)$。现有三个观测值:$11.7, 12.1, 12.0$。求$\theta$的后验分布。
}{
$$
p(X|\theta)=\begin{cases}
1^{3},\quad & \theta\in [11.1,11.7] \\
0,\quad & \theta \not \in [11.1,11.7] \\
\end{cases}=1_{[11.1,11.7]}(\theta), \quad \pi(\theta)=\frac{1}{6}1_{[10,16]}(\theta)
$$
所以$h(X,\theta)=p(X|\theta)\pi(\theta)=\frac{1}{6} 1_{[11.1,11.7]}(\theta)$,\quad $m(X)=\int_{-\infty}^{+\infty} \frac{1}{6}1_{[11.1,11.7]}(\theta) \mathrm{d}\theta = \frac{1}{6}\times 0.7$
所以$\theta$的后验分布为
$$
\pi(\theta|X)=\frac{h(X,\theta)}{m(X)}=\frac{1}{0.7} 1_{[11.1,11.7]}(\theta) = \frac{10}{7} 1_{[11.1,11.7]}(\theta)
$$
}
\questionandanswer[3]{
$x_1,x_2, \cdots ,x_n$是来自几何分布的样本,总体分布列为
$$
P(X=k|\theta)=\theta(1-\theta)^{k}, \quad k=0,1,2, \cdots ,
$$
$\theta$的先验分布是均匀分布$U(0,1)$
}{}
\begin{enumerate}
\questionandanswerSolution[]{
$\theta$的后验分布;
}{
$$
p(\theta|x_1,x_2, \cdots ,x_n)=\frac{p(x_1,x_2, \cdots ,x_n|\theta)\pi(\theta)}{\int_{0}^{1} p(x_1,x_2, \cdots ,x_n|\theta)\pi(\theta) \mathrm{d}\theta} = \frac{\prod_{i=1}^{n} \left[ \theta(1-\theta)^{x_i} \right] 1_{[0,1]}(\theta)}{\int_{0}^{1} \prod_{i=1}^{n} \left[ \theta(1-\theta)^{x_i} \right] \mathrm{d}\theta}
$$
}
\questionandanswerSolution[]{
$4$次观测值为$4,3,1,6$,求$\theta$的贝叶斯估计。
}{
$$
E(\theta|4,3,1,6) = \int_{0}^{1} \theta p(\theta|4,3,1,6) \mathrm{d}\theta = \text{实在算不出来了}
$$
}
\end{enumerate}
\questionandanswerProof[5]{
验证:正态总体方差(均值已知)的共轭先验分布是倒伽马分布(称$X$服从倒伽马分布,如果$\frac{1}{X}$服从倒伽马分布。
}{
设总体$X\sim N(\mu,\sigma^{2})$,且$\sigma^{2}\sim \operatorname{IG}(\alpha,\gamma)$,则$\frac{1}{\sigma^{2}}\sim \operatorname{Ga}(\alpha,\lambda)$,所以
$$
h(X|\sigma^{2})=p(X|\sigma^{2})p(\sigma^{2})= \frac{1}{\sqrt{2\pi}\sigma} e^{-\frac{1}{2}\sum_{i=1}^{n} \left( \frac{x-\mu}{\sigma} \right) ^{2}} \cdot \frac{\lambda^{\alpha}}{\Gamma(\alpha)}\left( \frac{1}{\sigma^{2}} \right) ^{\alpha-1} e^{-\frac{1}{\sigma^{2}}}
$$
$$
p(\sigma^{2}|X)=\frac{p(X|\sigma^{2})p(\sigma^{2})}{\int_{0}^{+\infty} p(X|\sigma^{2})p(\sigma^{2}) \mathrm{d}\sigma^{2}} = \frac{\frac{1}{\sqrt{2\pi}\sigma} e^{-\frac{1}{2}\sum_{i=1}^{n} \left( \frac{x-\mu}{\sigma} \right) ^{2}} \cdot \frac{\lambda^{\alpha}}{\Gamma(\alpha)}\left( \frac{1}{\sigma^{2}} \right) ^{\alpha-1} e^{-\frac{1}{\sigma^{2}}}}{\int_{0}^{+\infty} \frac{1}{\sqrt{2\pi}\sigma} e^{-\frac{1}{2}\sum_{i=1}^{n} \left( \frac{x-\mu}{\sigma} \right) ^{2}} \cdot \frac{\lambda^{\alpha}}{\Gamma(\alpha)}\left( \frac{1}{\sigma^{2}} \right) ^{\alpha-1} e^{-\frac{1}{\sigma^{2}}} \mathrm{d}\sigma^{2}}
$$
计算可得$p(\sigma^{2}|X)$也是倒伽马分布的概率密度函数,因此$\sigma^{2}$的后验分布也是倒伽马分布,从而正态总体方差(均值已知)的共轭先验分布是倒伽马分布。
}
\questionandanswer[6]{
$x_1,x_2, \cdots ,x_n$是来自如下总体的一个样本
$$
p(x|\theta) = \frac{2x}{\theta^{2}}, \quad 0<x<\theta
$$
}{}
\begin{enumerate}
\questionandanswerSolution[]{
$\theta$的先验分布为均匀分布$U(0,1)$,求$\theta$的后验分布;
}{
$$
\begin{aligned}
&h(x_1,x_2, \cdots ,x_n,\theta)=P(x_1,x_2, \cdots ,x_n|\theta)\pi(\theta) \\
=&\prod_{i=1}^{n} \frac{2 x_i}{\theta^{2}} 1_{[0,\theta]}(x_i) 1_{[0,1]}(\theta) =1_{0<x_{(1)}}1_{x_{(n)}<\theta} \frac{1}{\theta^{2n}} \prod_{i=1}^{n} 2
x_i 1_{[0,1]}(\theta) \\
\end{aligned}
$$
$$
\begin{aligned}
&m(x_1,x_2, \cdots x_n)=\int_{0}^{1} h(x_1,x_2, \cdots ,x_n,\theta) \mathrm{d}\theta = 1_{0<x_{(1)}} \prod_{i=1}^{n} 2 x_i \int_{0}^{1} 1_{x_{(n)}<\theta} \frac{1}{\theta^{2n}} \mathrm{d}\theta \\
=&1_{0<x_{(1)}} \prod_{i=1}^{n} 2 x_i \int_{x_{(n)}}^{1} \frac{1}{\theta^{2n}} \mathrm{d}x = 1_{0<x_{(1)}} \left(-2n+1-(-2n+1)x_{(n)}^{-2n+1}\right) \prod_{i=1}^{n} 2 x_i \\
\end{aligned}
$$
所以$\theta$的后验分布为
$$
\pi(\theta|x_1, \cdots ,x_n)=\frac{h(x_1, \cdots ,x_n,\theta)}{m(x_1, \cdots ,x_n)} = \frac{1_{x_{(n)}<\theta} 1_{[0,1]}(\theta)}{\theta^{2n} \left(-2n+1-(-2n+1)x_{(n)}^{-2n+1}\right)}
$$
}
\questionandanswerSolution[]{
$\theta$的先验分布为$\pi(\theta)=3 \theta^{2}, 0<\theta<1$,求$\theta$的后验分布。
}{
$$
\begin{aligned}
&h(x_1,x_2, \cdots ,x_n,\theta)=P(x_1,x_2, \cdots ,x_n|\theta)\pi(\theta) \\
=&\prod_{i=1}^{n} \frac{2 x_i}{\theta^{2}} 1_{[0,\theta]}(x_i) 3\theta^{2}1_{[0,1]}(\theta) =1_{0<x_{(1)}}1_{x_{(n)}<\theta} \frac{3\theta^{2}}{\theta^{2n}} \left(\prod_{i=1}^{n} 2 x_i\right) 1_{[0,1]}(\theta) \\
\end{aligned}
$$
$$
\begin{aligned}
&m(x_1,x_2, \cdots x_n)=\int_{0}^{1} h(x_1,x_2, \cdots ,x_n,\theta) \mathrm{d}\theta = 1_{0<x_{(1)}} \prod_{i=1}^{n} 2 x_i \int_{0}^{1} 1_{x_{(n)}<\theta} \frac{3\theta^{2}}{\theta^{2n}} \mathrm{d}\theta \\
=&1_{0<x_{(1)}} \prod_{i=1}^{n} 2 x_i \int_{x_{(n)}}^{1} \frac{3\theta^{2}}{\theta^{2n}} \mathrm{d}x = 1_{0<x_{(1)}} \left(9-6n-(9-6n)x_{(n)}^{3-2n}\right) \prod_{i=1}^{n} 2 x_i \\
\end{aligned}
$$
所以$\theta$的后验分布为
$$
\pi(\theta|x_1, \cdots ,x_n)=\frac{h(x_1, \cdots ,x_n,\theta)}{m(x_1, \cdots ,x_n)} = \frac{1_{x_{(n)}<\theta} 1_{[0,1]}(\theta)}{\theta^{2n} \left(9-6n-(9-6n)x_{(n)}^{3-2n}\right)}
$$
}
\end{enumerate}
\questionandanswer[8]{
$x_1,x_2, \cdots ,x_n$是来自均匀分布$U(0,\theta)$的样本,$\theta$的先验分布是帕雷托分布,其密度函数为$\displaystyle \pi(\theta)=\frac{\beta\theta_0^{\beta}}{\theta^{\beta+1}}, \theta>\theta_0$,其中$\beta,\theta_0$是两个已知的常数。
}{}
\begin{enumerate}
\questionandanswerProof[]{
验证:帕雷托分布是$\theta$的共轭先验分布;
}{
$X=\{ x_1,x_2, \cdots ,x_n \}$,则 $P(X|\theta)=\prod_{i=1}^{n} \frac{1}{\theta} 1_{[0,\theta]}(x_i)=\frac{1}{\theta^{n}}1_{x_{(1)}\geqslant 0} 1_{x_{(n)}\leqslant \theta}$
$$
h(X,\theta)=P(X|\theta)\pi(\theta)=\frac{\beta \theta_0^{\beta}}{\theta^{\beta+1+n}} 1_{x_{(1)}\geqslant 0} 1_{x_{(n)}\leqslant \theta}
$$
$$
m(X)=\int_{x_{(n)}}^{+\infty} h(X,\theta) \mathrm{d}\theta= \beta \theta_0^{\beta} 1_{x_{(1)}\geqslant 0} \int_{x_{(n)}}^{+\infty} \theta^{-\beta-1-n} \mathrm{d}\theta = \frac{\beta \theta_0^{\beta} 1_{x_{(1)}\geqslant 0}}{\beta+n} x_{(n)}^{-\beta-n}
$$
% 所以
$$
P(\theta|X)=\frac{h(X,\theta)}{m(X)}=\frac{\frac{1_{x_{(n)}\leqslant \theta}}{\theta^{\beta+n+1}}}{\frac{x_{(n)}^{-\beta-n}}{\beta+n}} = \frac{(\beta+n)x_{(n)}^{\beta+n}}{\theta^{\beta+n-1}} 1_{x_{(n)}\leqslant \theta}
$$
所以$\theta$的后验分布为参数为$\beta+n$$x_{(n)}$的帕雷托分布,从而帕雷托分布是$\theta$的共轭先验分布。
}
\questionandanswerSolution[]{
$\theta$的贝叶斯估计。
}{
$\theta$的贝叶斯估计为
$$
\begin{aligned}
\hat{\theta} = \int_{x_{(n)}}^{+\infty} \theta p(\theta|X) \mathrm{d}\theta = \int_{x_{(n)}}^{+\infty} \frac{\theta (\beta+n) x_{(n)}^{\beta+n}}{\theta^{\beta+n+1}} \mathrm{d}\theta = \frac{\beta+n}{\beta+n-1} x_{(n)}
\end{aligned}
$$
}
\end{enumerate}
\questionandanswerProof[12]{
从正态总体$N(\theta,2^{2})$中随机抽取容量为$100$的样本,又设$\theta$的先验分布为正态分布,证明:不管先验分布的标准差为多少,后验分布的标准差一定小于$\frac{1}{5}$
}{
设样本为$X$$\theta$的先验分布为$N(\mu,\sigma^{2})$,则$\theta$的后验概率密度函数为
$$
\begin{aligned}
&\pi(\theta|X) = c f(X|\theta) f(\theta) \\
&=c \left( \prod_{i=1}^{n} \frac{1}{2\sqrt{2\pi}} e^{-\frac{1}{2} \left( \frac{x_i-\theta}{2} \right) ^{2}} \right) \cdot \frac{1}{\sqrt{2\pi} \sigma} e^{-\frac{1}{2} \left( \frac{\theta-\mu}{\sigma} \right) ^{2}} \\
&=c e^{-\frac{1}{2} \left( \frac{\theta-\mu}{\sigma} \right) ^{2} - \frac{1}{2} \sum_{i=1}^{n} \left( \frac{x_i-\theta}{2} \right) ^{2}} \\
&\geqslant ce^{-\frac{1}{2} \cdot 25 (\theta-\mu-\bar{x})^{2}} \\
\end{aligned}
$$
所以后验分布的标准差一定小于$\frac{1}{5}$
}
\questionandanswerProof[13]{
设随机变量$X$服从负二项分布,其概率分布为
$$
f(x|p)=\binom{x-1}{k-1} p^{k} (1-p)^{x-k}, \quad x=k,k+1, \cdots
$$
证明其成功概率$p$的共轭先验分布族为贝塔分布族。
}{
$X=\{ x_1,x_2, \cdots ,x_n \}$。设$p$的先验分布为贝塔分布$Be(a,b)$,则$\pi(p)=\frac{1}{B(a,b)} p^{a-1}(1-p)^{b-1}$,所以
$$
\begin{aligned}
P(p|X)&= c \cdot h(X,p)=c \cdot P(X|p)\pi(p) =c \left(\prod_{i=1}^{n} \mathrm{C}_{x_i-1}^{k-1} p^{k} (1-p)^{x_i-k}\right) \frac{1}{B(a,b)}p^{a-1} (1-p)^{b-1} \\
&=c p^{nk} (1-p)^{-nk} (1-p)^{\sum_{i=1}^{n} x_i} p^{a-1} (1-p)^{b-1} \\
&=c p^{nk+a-1} (1-p)^{\sum_{i=1}^{n} x_i-nk+b-1} \\
\end{aligned}
$$
其中$c$为与$p$无关的数。
所以$p$的后验分布为$\displaystyle Be(nk+a, \sum_{i=1}^{n} x_i -nk +b)$,从而$p$的共轭先验分布族为贝塔分布族。
}
\questionandanswerSolution[14]{
从一批产品中抽检$100$个,发现$3$个不合格,假定该产品不合格率$\theta$的先验分布为贝塔分布$Be(2,200)$,求$\theta$的后验分布。
}{
设总体为$X$,则$X\sim b(100, \theta)$,所以
$$
\begin{aligned}
P(\theta|X) &=c\cdot P(X|\theta) \pi(\theta) = c\cdot \mathrm{C}_{100}^{3} \theta^{3} (1-\theta)^{97} \frac{1}{B(2,200)} \theta^{1} (1-\theta)^{199} \\
&=c \cdot \theta^{4} (1-\theta)^{296} \\
\end{aligned}
$$
其中$c$为与$\theta$无关的数。
所以$\theta$的后验分布为$Be(5,297)$
}
\end{enumerate}
\end{document}