目录 / Table of Contents
假设一对夫妻打算生孩子。他们采取的剩余策略是,除非连续生出3个女孩,否则一直生新的小孩。那么,现在的问题是,当这对夫妻停止生育时,他们已生下的小孩有多少个?
为了回答这个问题,可以直接考虑不同小孩数量的概率。假设每次生育时,生出女孩的概率为$p$,生出男孩的概率为$q :=1-p$。那么,在这题里:
- 样本空间中的样本点 $\omega_i$ 是长度为 i 的已被生下来的小孩的性别序列。例如,$w_2 = BG$ 表示一共生了两个小孩,第一个是男孩,第二个是女孩;
- 我们设定一个随机变量 $\text{X}(\omega): \Omega \rightarrow \mathbb R$ 。这个随机变量需要输入一个样本点,即上文提到的性别序列,并输出所输入序列的长度值;
- 概率测度 $\text P(x) = \text P(\text{X}=x)$表示「这对夫妻停止生育时,他们已生下的小孩有 x 个」的概率。
不难求出以下递归形式, $$ \begin{align} \text P(1)&=0 \\ \text P(2)&=0 \\ \text P(3)&=p^3 \\ \text P(4)&=qp^3=q\text P(3) \\ \text P(5)&=q^2\text P(3)+qp\text P(3)=q\text P(4)+qp\text P(3) \\ \text P(6)&=q\text P(5)+qp\text P(4)+qp^2\text P(3) \\ \cdots \\ \text P(n)&=q\text P(n-1)+qp\text P(n-2)+qp^2\text P(n-3) \end{align} $$
取$p=0.5$,可得:
p=0.5;
q=1-p;
f=zeros(60,1);
f(3)=p^3;
for i=4:60
f(i)=q*f(i-1)+q*p*f(i-2)+q*p^2*f(i-3);
end
bar(f)
Mathematical Statistics and Data Analysis (3rd Edition)
(C1-11) Consider the binomial distribution with $n$ trials and probability $p$ of success on each trial. For what value of $k$ is $P(X=k)$ maximized? This value is called the mode of the distribution. (Hint: Consider the ratio of successive terms.)
$$ \begin{aligned} \frac{P(X=k+1)}{P(X=k)} & =\frac{C^{k+1}_n p^{k+1}(1-p)^{n-k-1}}{C^{k}_n p^k(1-p)^{n-k}}\\\ &=\frac{p}{1-p} \cdot \frac{n-k}{k+1} .\end{aligned} $$随着k取值的增加,以上表达式中的比值会经历大于1(可能还会等于1)以及小于1的变化。我们希望找到能让上式小于1(即$\frac{p}{1-p} \cdot \frac{n-k}{k+1}<1$)的最小的k。易得: $$ n p-k p<k-k p+1-p \Longleftrightarrow k>p \cdot(n+1)-1 $$
最后可得$k =\lfloor p \cdot(n+1)\rfloor$。
(C2-70) Let $U$ be a uniform random variable. Find the density function of $V=U^{-\alpha}, \alpha>0$. Compare the rates of decrease of the tails of the densities as a function of $\alpha$. Does the comparison make sense intuitively?
$$ f_V(x)=F_V^{\prime}(x)=\left(1-x^{-\frac{1}{\alpha}}\right)^{\prime}=-\left(-\frac{1}{\alpha}\right) \cdot x^{-\frac{1}{\alpha}-1}=\frac{1}{\alpha} \cdot x^{-\left(1+\frac{1}{\alpha}\right)}, \quad x \in[1,+\infty\rangle . $$(C2-71) This problem shows one way to generate discrete random variables from a uniform random number generator. Suppose that $F$ is the cdf of an integer-valued random variable; let $\text{U}$ be uniform on $[0,1]$. Define a random variable $Y=k$, if $F(k-1)<\text{U}\leq F(k)$. Show that $Y$ has cdf $F$. Apply this result to show how to generate geometric random variables from uniform random variables.
这题一共两问。第一问要求证明题中构造的随机变量$Y$的分布函数与目标分布的函数相等,即$F_Y=F_{服从目标分布的随机变量}$。第二问要求用第一问的结论,构造一个服从几何分布的随机变量。第一小问只需直接计算$Y$的分布函数即可得证。这里只做第二小问。
注:这题给出了一种基于 服从均匀分布的随机变量 生成 服从指定分布的随机变量 的方法,可与讲义上的 Proposition 相照应。
Proposition C
Let $X$ be a continuous random variable and define $Z:=F(X)$, where $F$ is the c.d.f. of $X$ and assumed to be invertible on supp $(X)$. Then $Z \sim U[0,1]$. Proof $$ P(Z \leq z)=P(F(X) \leq z)=P\left(X \leq F^{-1}(z)\right)=F\left(F^{-1}(z)\right)=z $$ Proposition D
Assume $U \sim U[0,1]$ and let $X:=F^{-1}(U)$, where $F$ is an arbitrary function that satisfies all the properties of a c.d.f. and in addition is assumed to be invertible. Then the c.d.f. of $X$ is $F$. Proof $$ P(X \leq x)=P\left(F^{-1}(U) \leq x\right)=P(U \leq F(x))=F(x) $$
(C3-8) 下面这题的题目详情不重要了,主要是我积分积错了,记在这里提醒一下自己。
$$ \begin{aligned} P(X+Y \leq 1)= & P(X \leq 1-Y)=\int_0^1 \int_0^{1-y} \frac{6}{7}(x+y)^2 d x d y \\ = & \left.\int_0^1\left(\frac{2}{7}(x+y)^3\right)\right|_0 ^{1-y} d y \\ & =\int_0^1-\frac{2}{7} y^3+\frac{2}{7} d y \\ & =\left.\left(-\frac{1}{14} y^4+\frac{2}{7} y\right)\right|_0 ^1 \\ & =\frac{3}{14} \approx 0.2143 \end{aligned} $$(C3-11) Let $U_1, U_2$, and $U_3$ be independent random variables uniform on $[0,1]$. Find the probability that the roots of the quadratic $U_1 x^2+U_2 x+U_3$ are real.
-
计算 $X=U_1U_3$ 的分布函数 $$ \begin{aligned} F_{U_1 \cdot U_3}(x) & =P\left(U_1 \cdot U_3 \leq x\right)=\iint_{u_1 \cdot u_3 \leq x} f_{U_1, U_3}\left(u_1, u_3\right) d u_1 d u_3 \\ & =\iint_{u_1 \cdot u_3 \leq x} f_{U_1}\left(u_1\right) \cdot f_{U_3}\left(u_3\right) d u_1 d u_3 \\ & =\int_0^x \int_0^1 d u_3 d u_1+\int_x^1 \int_0^{\frac{x}{u_1}} d u_3 d u_1=\int_0^x d u_1+\int_x^1 \frac{x}{u_1} d u_1 \\ & =x+\left.x \cdot \ln u_1\right|_x ^1=x+x \cdot(0-\ln x) \\ & =x-x \ln x . \end{aligned} $$
-
使用上一部分求出的分布函数求解 $P[U_1U_3 \leq \frac {U^2_2}{4} ]$ $$ \begin{aligned} P\left(X \leq \frac{U_2^2}{4}\right) & =\iint_{x \leq \frac{u_2^2}{4}} f_{X, U_2}\left(x, u_2\right) d x d u_2=\iint_{x \leq \frac{u_2^2}{4}} f_X(x) \cdot f_{U_2}\left(u_2\right) d x d u_2 \\ & =\int_0^1\left(\int_0^{\frac{u_2^2}{4}}-\ln x \cdot 1 d x\right) d u_2=\int_0^1-\left.(x \cdot(\ln x-1))\right|_0 ^{\frac{u_2^2}{4}} d u_2 \\ & =\int_0^1 \frac{u_2^2}{4} \cdot\left(1-\ln \left(\frac{u_2^2}{4}\right)\right) d u_2=\left|\begin{array}{ll} u=\ln \left(\frac{u_2^2}{4}\right) & d v=\frac{u_2^2}{4} d u_2 \\ d u=\frac{2}{u_2} d u_2 & v=\frac{u_2^3}{12} \end{array}\right| \\ & =\left.\frac{u_2^3}{12}\right|_0 ^1-\left.\frac{u_2^3}{12} \cdot \ln \left(\frac{u_2^2}{4}\right)\right|_0 ^1+\int_0^1 \frac{u_2^2}{6} d u_2=\frac{1}{12}-\frac{1}{12} \cdot \ln \left(\frac{1}{4}\right)+\left.\frac{u_2^3}{18}\right|_0 ^1 \\ & =\frac{1}{12}+\frac{1}{12} \cdot \ln 4+\frac{1}{18} \\ & =\frac{5+3 \cdot \ln 4}{36} . \end{aligned} $$