{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Exercises ##"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"**1.** Let $X_i$, $i = 1,2$ be independent random variables such that $X_i$ has the exponential $(\\lambda_i)$ distribution. Suppose $\\lambda_1 \\ne \\lambda_2$.\n",
"\n",
"(a) Use the convolution formula to find the density of the sum $S = X_1 + X_2$.\n",
"\n",
"(b) Show by algebra that the expression you got for the density in Part (a) is non-negative for all positive $\\lambda_1 \\ne \\lambda_2$.\n",
"\n",
"(c) For $i=1, 2$, let $f_i$ denote the exponential density of $X_i$. Show that the density you got in part (a) is equal to $c_1f_1 + c_2f_2$ for two constants $c_1$ and $c_2$ such that $c_1+c_2 = 1$. Are $c_1$ and $c_2$ both positive?"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"**2.** A coin lands heads with probability $p$. Let $X$ be the number of tosses till the first head appears and let $Y$ be the number of tails before the first head.\n",
"\n",
"(a) Find the moment generating function of $X$.\n",
"\n",
"(b) Use the answer to (a) to find $E(X)$. Note that by now you have found $E(X)$ in several ways: by the tail sum formula, by conditioning on the first toss, by the pgf, and now by the mgf.\n",
"\n",
"(c) Use the answer to (a) to find the moment generating function of $Y$."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"**3.** Recognizing distributions saves a lot of work. See if you can do the following without explicit integration or differentation.\n",
"\n",
"(a) $W$ is a normal $(0, \\sigma^2)$ random variable. For $n = 0, 1, 2, 3$, and $4$, find $E(W^n)$. \n",
"\n",
"(b) $X$ and $Y$ are i.i.d. with moment generating function $M(t) = e^{t + t^2}$, $-\\infty < t < \\infty$. What is the distribution of $(X-Y)^2$?\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"**4.** **Markov and Chebyshev Bounds on the Poisson-Binomial Upper Tail** \n",
"\n",
"For $j \\ge 1$ let $I_j$ be independent indicators such that $P(I_j = 1) = p_j$. Let $X = I_1 + I_2 + \\ldots + I_n$. Then $X$ is the number of successes in $n$ independent trials that are not necessarily identically distributed.\n",
"\n",
"We say that $X$ has the Poisson-binomial distribution with parameters $p_1, p_2, \\ldots, p_n$. As you saw in lab, the binomial is the special case when all the $p_j$'s are equal.\n",
"\n",
"These distributions arise in statistical learning theory, the theory of randomized algorithms, and other areas.\n",
"\n",
"Let $E(X) = \\mu$. For $c > 0$, you are going to find an upper bound on $P(X \\ge (1+c)\\mu)$. That's the chance that $X$ exceeds its mean by some percent. \n",
"\n",
"In the special case of the binomial, $\\mu = np$ and so $P(X \\ge (1+c)\\mu)$ can be rewritten as $P(\\frac{X}{n} - p \\ge cp)$. That's the chance that the sample proportion exceeds $p$ by some percent.\n",
"\n",
"(a) Find $\\mu = E(X)$ and $\\sigma^2 = Var(X)$ in terms of $p_1, p_2, \\ldots, p_n$.\n",
"\n",
"(b) Find Markov's bound on $P(X \\ge (1+c)\\mu)$.\n",
"\n",
"(c) Find Chebyshev's bound on $P(X \\ge (1+c)\\mu)$ in terms of $\\mu$ and $\\sigma$.\n",
"\n",
"(d) If all the $p_j$'s are equal to $p$, what is the value of the bound in (c)?"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"**5.** **Chernoff Bound on Poisson-Binomial Upper Tail**\n",
"\n",
"This exercise continues the previous one and uses the same notation.\n",
"\n",
"(a) Show that the mgf of $I_j$ is given by $M_{I_j}(t) = 1 + p_j(e^t - 1)$ for all $t$.\n",
"\n",
"(b) Use (a) to derive an expression for $M_X(t)$, the mgf of $X$ evaluated at $t$.\n",
"\n",
"(c) An useful exponential bound is that $e^x \\ge 1 + x$ for all $x$. You don't have to show it but please look at the [graphs](http://prob140.org/resources/exponential_approximations/). Use the fact to show that $M_X(t) \\le \\exp\\big{(}\\mu(e^t -1)\\big{)}$ for all $t$. Notice that the right hand side is the mgf of a Poisson random variable that has the same mean as $X$.\n",
"\n",
"(d) Use Chernoff's method and the bound in (c) to show that \n",
"\n",
"$$\n",
"P\\big{(}X \\ge (1+c)\\mu\\big{)} \n",
"~ \\le ~ \n",
"\\Big{(} \\frac{\\exp(c)}{ (1+c)^{1+c}} \\Big{)}^\\mu\n",
"$$\n",
"\n",
"Remember that $\\mu = np$ when all the $p_j$'s are equal. If $g(c) = \\exp(c)/(1+c)^{1+c}$ is small then the bound above will decrease exponentially as $n$ gets large. That is the focus of the next exercise."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"**6.** **Simplified Chernoff Bounds on Poisson-Binomial Upper Tail**\n",
"\n",
"The bound in the previous exercise is a bit complicated. Often, simpler versions are used because they are good enough even though they are weaker.\n",
"\n",
"(a) It is not hard to show that $\\log(1+c) \\ge \\frac{2c}{2+c}$ for $c > 0$. You don't have to show it but please look at the [graphs](http://prob140.org/resources/exponential_approximations/).\n",
"Use the fact to show that $c - (1+c)\\log(1+c) \\le -\\frac{c^2}{2+c}$ for $c > 0$. \n",
"\n",
"(b) Show that if $X$ has a Poisson-binomial distribution with mean $\\mu$ then\n",
"\n",
"$$\n",
"P\\big{(} X \\ge (1+c)\\mu\\big{)} ~ \\le ~ \\exp\\big{(}-\\frac{c^2}{2+c}\\mu\\big{)}, ~~~~ c > 0\n",
"$$\n",
"\n",
"(c) A simpler but weaker version of the bound in (b) is also often used. Show that\n",
"\n",
"$$\n",
"P\\big{(} X \\ge (1+c)\\mu\\big{)} ~ \\le ~ \\exp\\big{(}-\\frac{c^2}{3}\\mu\\big{)}, ~~~~ c \\in (0, 1)\n",
"$$"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"**7.** Let $N$ be a non-negative integer valued random variable, and let $X, X_1, X_2, \\ldots $ be i.i.d. and independent of $N$. As before, define the *random sum* $S$ by\n",
"\n",
"$$\n",
"\\begin{align*}\n",
"S ~~&=~~0~~ \\mbox{if}~N=0 \\\\\n",
"&=~~ X_1 + X_2 + \\cdots + X_n ~~ \\mbox{if}~N = n > 0 \n",
"\\end{align*}\n",
"$$\n",
"\n",
"(a) Let $M$ be our usual notation for moment generating functions.\n",
"By conditioning on $N$, show that\n",
"\n",
"$$\n",
"M_S(t) ~~=~~ M_N\\big{(}\\log M_X(t) \\big{)}\n",
"$$\n",
"\n",
"You can assume that all the quantities above are well defined. \n",
"\n",
"(b) Let $N$ have the geometric $(p)$ distribution on $\\{1, 2, 3, \\ldots \\}$. Find the mgf of $N$. This doesn't use Part (a).\n",
"\n",
"(c) Let $X_1, X_2, \\ldots $ be i.i.d. exponential $(\\lambda)$ variables and let $N$ be geometric as in Part (b). Use the results of Parts (a) and (b) to identify the distribution of $S$."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"**8.** Let $U_1, U_2, \\ldots $ be i.i.d. uniform on $(0, 1)$. For $n \\ge 1$, let $S_n = \\sum_{i=1}^n U_i$. \n",
"\n",
"Let $f_{S_n}$ be the density of $S_n$. The formula for $f_{S_n}$ is piecewise polynomial on the possible values $(0, n)$. In this problem we will just focus on the density on the interval $(0, 1)$ and discover a nice consequence.\n",
"\n",
"(a) For $0 < x < 1$, find $f_{S_2}(x)$. \n",
"\n",
"(b) Use Part (a) and the convolution formula to find $f_{S_3}(x)$ for $0 < x < 1$.\n",
"\n",
"(c) Guess a formula for $f_{S_n}(x)$ for $0 < x < 1$ and prove it by induction.\n",
"\n",
"(d) Use Part (c) to find $P(S_n < 1)$.\n",
"\n",
"(e) Let $N = \\min\\{n: S_n > 1\\}$. Use Part (d) to find $E(N)$."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.3"
}
},
"nbformat": 4,
"nbformat_minor": 2
}