{
"cells": [
{
"cell_type": "code",
"execution_count": 40,
"metadata": {
"tags": [
"remove_cell"
]
},
"outputs": [],
"source": [
"# HIDDEN\n",
"import warnings\n",
"warnings.filterwarnings('ignore')\n",
"from datascience import *\n",
"from prob140 import *\n",
"import numpy as np\n",
"import matplotlib.pyplot as plt\n",
"plt.style.use('fivethirtyeight')\n",
"%matplotlib inline"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Prediction and Estimation ##"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"One way to think about the SD is in terms of errors in prediction. Suppose I am going to generate a value of the random variable $X$, and I ask you to predict the value I am going to get. What should you use as your predictor?\n",
"\n",
"A natural choice is $\\mu_X$, the expectation of $X$. But you could choose any number $c$. The error that you will make is $X - c$. About how big is that? For most reasonable choices of $c$, the error will sometimes be positive and sometimes negative. To find the rough size of this error, we will avoid cancellation as before, and start by calculating the *mean squared error* of the predictor $c$:\n",
"\n",
"$$\n",
"MSE(c) ~ = ~ E[(X-c)^2]\n",
"$$\n",
"\n",
"Notice that by definition, the variance of $X$ is the mean squared error of using $\\mu_X$ as the predictor.\n",
"\n",
"$$\n",
"MSE(\\mu_X) ~ = ~ E[(X-\\mu_X)^2] ~ = ~ \\sigma_X^2\n",
"$$"
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"tags": [
"remove-input",
"hide-output"
]
},
"outputs": [
{
"data": {
"text/html": [
"\n",
" VIDEO"
]
},
"execution_count": 1,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# VIDEO: Least Squares Constant Predictor\n",
"from IPython.display import YouTubeVideo\n",
"\n",
"YouTubeVideo('hnm1Ht5DiWk')"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"We will now show that $\\mu_X$ is the *least squares* constant predictor, that is, it has the smallest mean squared error among all constant predictors. Since we have guessed that $\\mu_X$ is the best choice, we will organize the algebra around that value. \n",
"\n",
"$$\n",
"\\begin{align*}\n",
"MSE(c) ~ = ~ E\\big{[}(X - c)^2\\big{]} &= E\\big{[} \\big{(} (X - \\mu_X) + (\\mu_X - c) \\big{)}^2 \\big{]} \\\\\n",
"&= E\\big{[} (X - \\mu_X)^2 \\big{]} +2(\\mu_X - c)E\\big{[} (X-\\mu_X) \\big{]} + (\\mu_X -c)^2 \\\\\n",
"&= \\sigma_X^2 + 0 + (\\mu_X -c)^2 \\\\\n",
"&\\ge \\sigma_X^2 \\\\\n",
"&= MSE(\\mu_X)\n",
"\\end{align*}\n",
"$$\n",
"\n",
"with equality if and only if $c = \\mu_X$."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### The Mean as a Least Squares Predictor ###\n",
"What we have shown is the predictor $\\mu_X$ has the smallest mean squared error among all choices $c$. That smallest mean squared error is the variance of $X$, and hence the smallest root mean squared error is the SD $\\sigma_X$.\n",
"\n",
"This is why a common approach to prediction is, \"My guess is the mean, and I'll be off by about an SD.\" "
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"```{admonition} Quick Check\n",
"Your friend has a random dollar amount $X$ in their wallet. Suppose you know that $E(X) = 16$ dollars and $SD(X) = 3$ dollars. In all your answers below, please include units of measurement.\n",
"\n",
"(a) What is the least squares constant predictor of $X$?\n",
"\n",
"(b) What is the mean squared error of this predictor?\n",
"\n",
"(c) What is the root mean squared error of this predictor?\n",
"\n",
"```"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"```{admonition} Answer\n",
":class: dropdown\n",
"(a) $16$ dollars\n",
"\n",
"(b) $9$ squared dollars\n",
"\n",
"(c) $3$ dollars\n",
"\n",
"```"
]
},
{
"cell_type": "markdown",
"metadata": {
"collapsed": true
},
"source": [
"### German Tanks, Revisited ###\n",
"\n",
"Recall the [German tanks](http://prob140.org/textbook/content/Chapter_08/04_Additivity.html#first-unbiased-estimator-of-a-maximum-possible-value) problem in which we have a sample $X_1, X_2, \\ldots , X_n$ drawn at random without replacement from $1, 2, \\ldots , N$ for some fixed $N$, and we are trying to estimate $N$. \n",
"\n",
"We came up with two unbiased estimators of $N$:\n",
"\n",
"- An estimator based on the sample mean: $T_1 = 2\\bar{X}_n - 1$ where $\\bar{X}_n$ is the sample average $\\frac{1}{n}\\sum_{i=1}^n X_i$\n",
"- An estimator based on the sample maximum: $T_2 = M\\cdot\\frac{n+1}{n} - 1$ where $M = \\max(X_1, X_2, \\ldots, X_n)$.\n",
"\n",
"Here are simulated distributions of $T_1$ and $T_2$ in the case $N = 300$ and $n = 30$, based on 5000 repetitions."
]
},
{
"cell_type": "code",
"execution_count": 42,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAk4AAAEICAYAAACpsHsZAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4yLjIsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy+WH4yJAAAgAElEQVR4nO3deZxU1Zn/8c9T1StNA80igoAsoixqFMQNt2hi1ERxxmhGfxhjiBNiHE3cImoS14wxoxkzY4JGiEZjNC7RjMY14hbZBDc2aUCQbrZeoPfq6qo6vz+qGouil9t0dXV19ff9et0XXeeee+9z+tLw9DnnnmvOOURERESkfb7uDkBERESkp1DiJCIiIuKREicRERERj5Q4iYiIiHikxElERETEIyVOIiIiIh4pcRIRERHxSImTiIiIiEdKnES6kJn1NbNSM5vW3bFkAjN72MxeT1a9ZDKzB8zsv1J5TRFJPSVOacrMnjIzZ2a3JZQPj5V/NYnXutjMlpnZTjNrMLPVZnaNmVlCvbPM7EMzazSzjWZ2dQvnardOOklm21vxE+B959zSuHPdEruHidtBHb1mJt6TZmb2upk9nFB8FXB+O3X2qpcitwE/MLOxKb6uiKRQVncHIK06CtgCfAv4WVx5c8/F+0m81g7gduBToBE4EfgtEALuAzCzo4DngXuAC4FjgLlmVu+cm+u1ThpKSttbYmZ5wA+Ab7eweyNwXEJZWdyxSfl+J+uemFmOcy7otX5Xcc5VJbNeM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Wz5gxo3L27NmjmusddNBBjZWVlVnl5eX+p556auD5559f2bzvo48+ynv++ecHvvnmm2uWLl26yu/3u/nz5w8C+MUvflG6aNGi1UuXLl25ePHiwvfffz+/+bhBgwaFlixZsvriiy8u+/Wvfz20K74v6UBDdSIiImlm1qxZlbNmzapsv+YXqqurfTNnzhx3yy23bC4qKooUFRVF5s+fv2nu3LmDTjnllNrE851xxhk7H3vssYEfffRRwe9///vdvVGvv/564apVq/pMnz59IkBjY6OvuYfs8ccfH/inP/1pcDgctvLy8uwVK1bkHXXUUQ0A559//k6AqVOn1v/9738v6uz3IF0pcRIREUkz8+bNGzh37tz9E8tHjRoVeOaZZzYklgeDQbvgggvGnXvuuZUXXXTRrvh9s2fPrmjpGhdddNHOU089deKMGTMq/H7/7nLnnJ177rkV99xzT2l8/bVr1+Y8+OCDQ996663VgwcPDl988cWjA4HA7pGr3NxcB+D3+104HDaAM844Y3xFRUX2oYceWveHP/xhExlAiZOIiEia6UiPUyQS4dJLLz1w3LhxgTlz5rQ6KT3RuHHjgtdcc03p6aefXhNf/pWvfKV65syZB11zzTXbhw8fHiorK/NXVVX5q6qq/Pn5+ZGioqJwaWlp1rvvvtt/+vTpNa2dH+Dll18u9hpPT6HESUREMsqQIfnBO+88NqnLESTrXADf+ta3xrz//vuFu3btyho/fvzhP/rRj7b88Ic/LN/X8y1YsKDviy++OGjcuHEN06ZNmwQwZ86c0n/913+tau/YK6+8cq/rHnHEEYHrrruudMaMGQdHIhGysrLc3Xff/fnJJ59cN3HixPopU6ZMHjFiROMRRxxR29FYf/WrX+334IMP7l9RUZE9ffr0SSeddFJVT+uJMudc+7W6WFVVVVKCKC4uZvz48ck4VdpSGzOHp3ZGdpFT/xjBvlekJqgk6w33Um30rn///klbIiDe2rVrHx06dGiLr8cQ2Vfbt29fffDBB1+cWK6n6kREREQ80lCdiIhIksWvJh7vxRdf/HS//fYLd0dMkhxKnERERJIsfjVxySwaqhMRERHxSImTiIiIiEdKnEREREQ8UuIkIiIi4pEmh4uISEax8NaRFi5L2gKYzj8k6PzDNre2P/4JuoqKimyfz+eKiopCAO+8887qvLy83WsVbtiwIfuyyy4bU15enu3z+bjwwgvLrr/++h3JiPPPf/7zgB/84Afj3n777ZWHH354IBnnTKYlS5bkl5SU5HhZmDPeqaeeesjtt9++efr06fWJ5SUlJTlr1qz5xOeL9gPNmDFj3JIlS/pt3br1gySGvgclTiIiklEsXJaTX3NT0hbbbCi8M8f5h7W6P/4JuhtvvHF4QUFB+Kabbmrx1SfZ2dnccccdJccdd1z9rl27fCeeeOKk008/vfqII47odKLzzDPPDPzSl75U+8QTTww8/PDDt3T2fMm2fPnyPh9++GFBRxOnthQWFoYXLFjQ97TTTqutqKjwl5WVZSfr3K3RUJ1ImrHQOiy0vrvDEJEuMHLkyKbjjjuuHmDAgAGRMWPGNJSUlHS6d6y6utr34Ycf9r3//vs3vvDCC0XN5a+88krhN77xjYOaP8+ePXvU3LlzBwE8++yz/Q8//PDJJ5988iGXX375yOZ6N9544/CZM2eO/trXvjZ+woQJhz3++OMDfvzjH4+YMmXKpDPPPHN8MBg0gPfee6/Pl7/85UOOOeaYiWecccb4zZs3Z0O0J+jqq68+4Pjjj5942GGHHfr666/3DQQCdu+99w5/6aWXiqZNmzbpkUceKaqpqfFdcsklo4877riJRx999KQnn3xyAEBdXZ1dcMEFY6dOnTrp/PPPHxsIBFpNgs8+++zKp556aiDAk08+OeCMM87Y/YLj6upq31e+8pWDjz766IlTpkzZff533323z9SpUyfV19dbTU2N78gjj5y8fPnyPK/fayVOImnGIjWYa/O9mSKSAYqLi3PWrFnTZ/r06Xu9823evHkDp02bNilxO++888a2dK6//OUvA0444YSqQw89tLF///7hhQsX9mnr2vX19XbDDTcc+PTTTxe/9dZbn1ZUVOwxArV58+bc//u//1v36KOPrvvxj3885qSTTqpevnz5qtzc3Mizzz7bPxgM2k9+8pNRjz/++PrFixevvvDCC8tvvvnmA5qPD4VC9t57762+9dZbN//yl78cnpeX566++uotZ5555s6lS5euuuSSS3beeuutw0488cTqhQsXrn7ppZc+veOOO0bU1NT4fvOb3+yXn58fWbZs2aqf/OQnW9esWVPQWjtOPfXUmqVLl/YNhUI8//zzAy+88MLdL0bOz8+PPPXUU+uWLFmy+u9///va2267bUQkEuGEE06oP+2003bNmTPngGuvvXbEjBkzKqZMmeK5x09DdSIiIilWXV3tmzlz5rhbbrllc1FRUSRx/6xZsypnzZpV2dKxLfnrX/868Ac/+MEOgHPOOafyySefHNjcs9WSFStW5B1wwAGNBx98cBDgvPPOq/zjH/84pHn/KaecUpWTk+OmTJnSEIlEbMaMGdUAEyZMaNi0aVPOihUrctevX59/zjnnHAwQDocZMmRIU/Px55577k6AY445pu6nP/1piz1q7777br833nhjwAMPPLA/QGNjo23YsCFn0aJFfWfPnr0D4Kijjmo46KCDWm2H3+93U6dOrf3jH/84MBAI+MaPH7/7hczOOZszZ86IpUuX9vX5fJSVleVs2bIla8SIEaHbbrtt6wknnDAxJycncv/993/u5XvcTImTSBqycAXm24Yzz73HItJDBINBu+CCC8ade+65lRdddNGulurMmzdv4Ny5c/dPLB81alTgmWee2RBftmPHDv/SpUv7rVu3Lv/aa68lEokY4O69996SrKwsF4l8kZc1NjYagHOOtuTk5DgAv99PVlaWa5587fP5CIVC5pyzsWPHNrz77rtrWjo+Nzd39/HhcLjFoTbnHI888si6ww47rDFxn5n3KWrnn39+5axZsw668sor95jXNX/+/IEVFRVZCxcuXJ2Tk+MmTJhwWENDgw+gvLzcX19f7wuFQtbQ0OArLCzcK3ltjYbqRNJQbv2D+ELrujsMEUmySCTCpZdeeuC4ceMCc+bMaXECOUR7nJYuXboqcUtMmgCeeOKJorPPPrvi008//WTNmjWfrF279uMDDjgg+MYbb/QdM2ZM44YNG/IbGhqssrLSv2jRon4Ahx56aKC0tDS3uLg4B6I9Vh1px+TJkwM7d+7MevPNNwsgmgx+8MEHbf6mV1hYGK6trd2dd5x44onV999//9DmxG7x4sX5AMcee2ztk08+ORBg+fLleevWrWtz2PG0006r/f73v7915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DxS4iQiIiLikRInEREREY+UOImIiIh49P8BEbQsdcsBTWMAAAAASUVORK5CYII=\n",
"text/plain": [
""
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
}
],
"source": [
"def simulate_T1_T2(N, n):\n",
" \"\"\"Returns one pair of simulated values of T_1 and T_2\n",
" based on the same simple random sample\"\"\"\n",
" tanks = np.arange(1, N+1)\n",
" sample = np.random.choice(tanks, size=n, replace=False)\n",
" t1 = 2*np.mean(sample) - 1\n",
" t2 = max(sample)*(n+1)/n - 1\n",
" return [t1, t2]\n",
"\n",
"def compare_T1_T2(N, n, repetitions):\n",
" \"\"\"Returns a table of simulated values of T_1 and T_2, \n",
" with the number of rows = repetitions\n",
" and each row containing the two estimates based on the same simple random sample\"\"\"\n",
" tbl = Table(['T_1 = 2*Mean-1', 'T_2 = Augmented Max'])\n",
" for i in range(repetitions):\n",
" tbl.append(simulate_T1_T2(N, n))\n",
" return tbl\n",
"\n",
"N = 300\n",
"n = 30\n",
"repetitions = 5000\n",
"comparison = compare_T1_T2(N, n, 5000) \n",
"comparison.hist(bins=np.arange(N/2, 3*N/2))\n",
"plt.title('$N =$'+str(N)+', $n =$'+str(n)+' ('+str(repetitions)+' repetitions)');"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"We know that both estimators are unbiased: $E(T_1) = N = E(T_2)$. But is clear from the simulation that $SD(T_1) > SD(T_2)$ and hence $T_2$ is a better estimator than $T_1$.\n",
"\n",
"The empirical values of the two means and standard deviations based on this simulation are calculated below."
]
},
{
"cell_type": "code",
"execution_count": 43,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"(299.95684000000006, 29.99859216498445)"
]
},
"execution_count": 43,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"t1 = comparison.column(0)\n",
"np.mean(t1), np.std(t1)"
]
},
{
"cell_type": "code",
"execution_count": 44,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"(299.9418, 9.258092549164154)"
]
},
"execution_count": 44,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"t2 = comparison.column(1)\n",
"np.mean(t2), np.std(t2)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"These standard deviations are calculated based on empirical data given a specified value of the parameter $N = 300$ and a specified sample size $n = 30$. In the next chapter we will develop properties of the SD that will allow us to obtain algebraic expressions for $SD(T_1)$ and $SD(T_2)$ for all $N$ and $n$."
]
}
],
"metadata": {
"anaconda-cloud": {},
"celltoolbar": "Tags",
"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.7.3"
}
},
"nbformat": 4,
"nbformat_minor": 1
}