{ "cells": [ { "cell_type": "code", "execution_count": 1, "metadata": { "tags": [ "remove_input" ] }, "outputs": [], "source": [ "path_data = '../../data/'\n", "\n", "import numpy as np\n", "import pandas as pd\n", "\n", "%matplotlib inline\n", "import matplotlib.pyplot as plt\n", "plt.style.use('fivethirtyeight')\n", "\n", "import warnings\n", "warnings.filterwarnings('ignore')" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# Choosing a Sample Size\n", "Candidate A is contesting an election. A polling organization wants to estimate the proportion of voters who will vote for her. Let's suppose that they plan to take a simple random sample of voters, though in reality their method of sampling would be more complex. How can they decide how large their sample should be, to get a desired level of accuracy?\n", "\n", "We are now in a position to answer this question, after making a few assumptions:\n", "- The population of voters is very large and that therefore we can just as well assume that the random sample will be drawn with replacement.\n", "- The polling organization will make its estimate by constructing an approximate 95% confidence interval for the percent of voters who will vote for Candidate A.\n", "- The desired level of accuracy is that the width of the interval should be no more than 1%. That's pretty accurate! For example, the confidence interval (33.2%, 34%) would be fine but (33.2%, 35%) would not.\n", "\n", "We will work with the sample proportion of voters for Candidate A. Recall that a proportion is a mean, when the values in the population are only 0 (the type of individual you are not counting) or 1 (the type of individual you are counting)." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Width of Confidence Interval\n", "If we had a random sample, we could go about using the bootstrap to construct a confidence interval for the percent of voters for Candidate A. But we don't have a sample yet – we are trying to find out how big the sample has to be so that our confidence interval is as narrow as we want it to be.\n", "\n", "In situations like this, it helps to see what theory predicts.\n", "\n", "The Central Limit Theorem says that the probabilities for the sample proportion are roughly normally distributed, centered at the population proportion of 1's, with an SD equal to the SD of the population of 0's and 1's divided by the square root of the sample size.\n", "\n", "So the confidence interval will still be the \"middle 95%\" of a normal distribution, even though we can't pick off the ends as the 2.5th and 97.5th percentiles of bootstrapped proportions. \n", "\n", "Is there another way to find how wide the interval would be? Yes, because we know that for normally distributed variables, the interval \"center $\\pm$ 2 SDs\" contains 95% of the data.\n", "\n", "The confidence interval will stretch for 2 SDs of the sample proportion, on either side of the center. So the width of the interval will be 4 SDs of the sample proportion.\n", "\n", "We are willing to tolerate a width of 1% = 0.01. So, using the formula developed in the last section, \n", "\n", "$$\n", "4 \\times \\frac{\\mbox{SD of the 0-1 population}}{\\sqrt{\\mbox{sample size}}}\n", "~ \\le ~ 0.01\n", "$$\n", "\n", "So\n", "\n", "$$\n", "\\sqrt{\\mbox{sample size}} ~ \\ge ~ 4 \\times \\frac{\\mbox{SD of the 0-1 population}}{0.01}\n", "$$" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### The SD of a collection of 0's and 1's ###\n", "If we knew the SD of the population, we'd be done. We could calculate the square root of the sample size, and then take the square to get the sample size. But we don't know the SD of the population. The population consists of 1 for each voter for Candidate A, and 0 for all other voters, and *we don't know what proportion of each kind there are.* That's what we're trying to estimate.\n", "\n", "So are we stuck? No, because we can *bound* the SD of the population. Here are histograms of two such distributions, one for an equal proportion of 1's and 0's, and one with 90% 1's and 10% 0's. Which one has the bigger SD? " ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [ { "data": { "image/png": "iVBORw0KGgoAAAANSUhEUgAAAxcAAAFJCAYAAADpO9CSAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjMuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8vihELAAAACXBIWXMAAAsTAAALEwEAmpwYAABAsElEQVR4nO3deXhMd///8dcIIiJEc2dBLBWpWEqUStGi/FpFQ9XO3cVasdxVtaXtXdXSoJrW1tCvutFGi1RbShet1BrLrTRpkcYSu6SiiS0Jkvn94Wu+RhYTzkgmeT6uy3WZcz7nzPs9xxl55Wym1NRUswAAAADgLpUq7AIAAAAAFA+ECwAAAACGIFwAAAAAMAThAgAAAIAhCBcAAAAADEG4AAAAAGAIwgUAAAAAQxRquNi6dav69OmjevXqyd3dXZGRkVbzzWazwsLCFBAQIB8fH3Xu3Fn79++3GpOZmalx48apdu3aqlq1qvr06aOTJ0/eyzYAA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1dbVXmXclMjJS48eP18mTJ62mf/bZZ/neoeheSU1N1dixYzV16lR17dpVFSpUyHXc4sWLFRUVpdjYWJ0/f16//fabatasaTXG3d091+l345tvvtG7776rI0eO6P7779cbb7xh9cDq3Li7u+eYFh4eroEDB95RDYW/lQAAABzQyZOXNHbspnv2fjNnti5QuJCktm3basGCBbp69apiYmL0r3/9S5cvX1Z4eHiOsdeuXZOTk1OhXV9y9erVPOdVrlz5HlaSt2PHjunatWvq0KGDfHx88hx3+fJltWvXTp06ddJrr712T2rbuXOnBg4cqNDQUAUHB2vNmjV68cUX9cMPP6hZs2b5Ljt79mx16NDB8rpixYp3XAenRQEAABRTzs7O8vb2lq+vr3r27KmePXtq7dq1kqSwsDC1aNFCkZGRCgwMlJeXly5duqTjx4+rf//+8vX1la+vr/75z39aHUm4sdzSpUvVsGFD+fj4qF+/fkpJSbGMyc7O1owZM9SgQQN5eXmpZcuWlveVpKNHj8rd3V1RUVEKDg6Wj4+P/vOf/2jEiBGWu3O5u7tbTju69bSo1NRUDRs2TDVr1pSPj4+6du2q/fv3W+ZHRkaqWrVq2rhxo1q0aKGqVavq6aefVmJiYr6fV369R0ZGqnXr1pKkwMBAubu76+jRo7muZ/jw4RozZoxatGhhy2bS1atXNX78eAUEBMjLy0sNGjTQW2+9ZdOyN0REROixxx7T2LFjVbduXY0dO1aPPvqoIiIibrtspUqV5O3tbfnj4uJSoPe+GeECAACghChXrpzVEYKjR48qKipKixcv1pYtW+Ts7Kz+/fvrr7/+0urVq7VmzRqdOXNG/fv3l9lstix37NgxLV++XJGRkfr66691+PBhjRgxwjI/IiJCc+bM0VtvvaVt27apc+fOeu655xQbG2tVz+TJkzV48GBt375dHTt2VFhYmMqXL6/4+HjFx8dr1KhRufYREhKi3bt3a9myZfr555/l4uKiHj16KD093TImMzNT4eHhmjt3rn788UelpaVpzJgxeX42ZrM5396fffZZffnll5KkDRs2KD4+Xr6+vgXbAHmYP3++1q5dq08++US7d+/WokWLVKdOHcv8sLCwX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HH3xQUVFRat++fa7LRUZGavz48fn+9r99+/Zq0KCBZs+ebZn20EMPqWvXrpo0aZKxjeTjTnu8ldlsVt26dfXqq6/qpZdeknT9t6yrV6/OcUTD3gr62X7yySd666239Oeff1r+03zvvfe0aNEi7du3TyaTSZMmTdKaNWv066+/WpYbNWqUDhw4oPXr19u/qVsY8e/nxRdfVFZWluU3pps3b1ZwcLAOHTokDw8Pu9RdEAXt8ejRo2rcuLGio6PVpEmTXNdZ3LbjiRMn1KhRIy1YsEA9e/aUVPS2482qVaumGTNmqH///nmOccT98Wa29Jibor4/3syWHh1xfwRw9zhycRt79+7V1atX1a5dO8s0X19f1a1bVzt27Mh32fT0dDVs2FD169dX79699dtvv1nmXblyRXv37rVaryS1a9futus12t30eLMrV64oIyND7u7uVtMTExNVr149NWrUSAMHDlRiYqJBleddR0E/2507d6pFixZWv41r3769Tp8+raNHj1rG3LrO9u3ba8+ePbp69arBXeTPqH8/Fy5cyLG9JKlt27aqW7euunTpok2bNt1tuXfkbnp87rnnVKdOHXXo0CHHb0CL23b89NNPValSJXXp0iXHvKKwHe+Eo+2PRinK++PdcJT9EYAxCBe3kZycLCcnpxy/NfL09FRycnKey/n7+2vu3LlatmyZFi5cKGdnZz311FOWU4ZSUlKUlZWV4zSG263XHu60x1tNmTJFFSpUUMeOHS3TmjVrpo8++kgrV67U7NmzlZSUpCeffFLnzp0zrP5b3clnm5ycnOv4G/PyG3Pt2jWlpKQYVb5NjPj38/3332vjxo168cUXLdN8fHwUHh6uTz/9VJ9++qn8/f3VtWtXbd261cjybXInPVaoUEHvvPOO/vOf/2jlypVq3bq1BgwYoOXLl1vGFKftmJ2drcjISPXp00fOzs6W6UVpO94JR9sfjVDU98c74Wj7IwBjlC7sAgrLlClTNHPmzHzHrFmzJs95ZrNZJpMpz/nNmzdX8+bNLa+DgoL02GOPacGCBZoxY4Zl+q3ruN16C8LePd4sIiJCixcv1tdff62KFStapj/xxBNW45o1a6bAwEAtW7ZMI0eOtGndd6qgn21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Fx8crISFBc+bM0cKFCzV06FDLGEffjjd89tlncnV1Vbdu3XLMK2rb8eLFi4qNjVVsbKyys7N14sQJxcbGWm63Wxz2x4L26Ij7Y0F7dMT9EcDdK7GnRRXEu+++KycnJw0YMEAZGRlq3bq15s+fLycnJ8uYI0eOqFq1apbXaWlpevnll5WcnKyKFSuqUaNGWrdundVpQ88++6zOnTun9957T0lJSapXr55WrFihGjVq3NP+pDvr8X/+53909erVHGGob9++ioiIkCSdOnVKgwcPtpxy1axZM61fv97uPd7usz1z5oyOHDliGV+pUiV99dVXGjt2rB5//HG5u7trxIgRVv/B1apVSytWrNBrr72mRYsWycfHR9OnT1fXrl3t2kteCtrjsmXLdPnyZc2ZM0dz5syxTK9evbri4uIkSVevXtW///1vnT59WuXKlbOs88knn7y3zf2vgvYoSTNnztTx48fl5OQkPz8/zZ071+r8bkffjtL1I6GffvqpevbsqfLly+dYZ1Hbjnv27FFwcLDldVhYmMLCwizfFcVhfyxoj464Pxa0R8nx9kcAd4/nXAAAAAAwBKdFAQAAADAE4QIAAACAIQgXAAAAAAxBuAAAAABgCMIFAAAAAEMQLgAAAAAYgnABAAAAwBCECwAAAACGIFwAAAAAMMT/BwVHXaS67dCxAAAAAElFTkSuQmCC\n", "text/plain": [ "
" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "# HIDDEN \n", "pop_50 = np.array([1, 1, 1, 1, 1, 0, 0, 0, 0, 0])\n", "pop_90 = np.array([1, 1, 1, 1, 1, 1, 1, 1, 1, 0])\n", "\n", "coins = pd.DataFrame(\n", " {\"Proportion of 1's: 0.5\":pop_50,\n", " \"Proportion of 1's: 0.9\":pop_90}\n", ")\n", "\n", "unit = ''\n", "\n", "ylim= -0.05, 1\n", "\n", "fig, ax = plt.subplots(figsize=(8,5))\n", "\n", "ax.hist(coins[\"Proportion of 1's: 0.5\"], bins=np.arange(-0.5, 1.6, 1), \n", " density=True, label=\"Proportion of 1's: 0.5\", color='darkblue', alpha=0.8, ec='white', zorder=5)\n", "\n", "ax.hist(coins[\"Proportion of 1's: 0.9\"], bins=np.arange(-0.5, 1.6, 1), \n", " density=True, label=\"Proportion of 1's: 0.9\", color='gold', alpha=0.8, ec='white', zorder=5)\n", "\n", "ax.scatter(0.5, -0.02, marker='^', color='darkblue', s=60, zorder=15).set_clip_on(False)\n", "\n", "ax.scatter(0.9, -0.02, marker='^', color='gold', s=60, zorder=15).set_clip_on(False)\n", "\n", "y_label = 'Percent per ' + (unit if unit else 'unit')\n", "\n", "x_label = ''\n", "\n", "#plt.xlim(xlim)\n", "\n", "plt.ylim(ylim)\n", "\n", "y_vals = ax.get_yticks()\n", "\n", "ax.set_yticklabels(['{:g}'.format(x * 100) for x in y_vals])\n", "\n", "plt.ylabel(y_label)\n", "\n", "plt.xlabel(x_label)\n", "\n", "ax.legend(bbox_to_anchor=(1.04,1), loc=\"upper left\")\n", "\n", "plt.show()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Remember that the possible values in the population are only 0 and 1.\n", "\n", "The blue histogram (50% 1's and 50% 0's) has more spread than the gold. The mean is 0.5. Half the deviations from mean are equal to 0.5 and the other half equal to -0.5, so the SD is 0.5.\n", "\n", "In the gold histogram, all of the area is being squished up around 1, leading to less spread. 90% of the deviations are small: 0.1. The other 10% are -0.9 which is large, but overall the spread is smaller than in the blue histogram.\n", "\n", "The same observation would hold if we varied the proportion of 1's or let the proportion of 0's be larger than the proportion of 1's. Let's check this by calculating the SDs of populations of 10 elements that only consist of 0's and 1's, in varying proportions. The function `np.ones` is useful for this. It takes a positive integer as its argument and returns an array consisting of that many 1's." ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
Population Proportion of 1'sPopulation SD
00.10.300000
10.20.400000
20.30.458258
30.40.489898
40.50.500000
50.60.489898
60.70.458258
70.80.400000
80.90.300000
\n", "
" ], "text/plain": [ " Population Proportion of 1's Population SD\n", "0 0.1 0.300000\n", "1 0.2 0.400000\n", "2 0.3 0.458258\n", "3 0.4 0.489898\n", "4 0.5 0.500000\n", "5 0.6 0.489898\n", "6 0.7 0.458258\n", "7 0.8 0.400000\n", "8 0.9 0.300000" ] }, "execution_count": 3, "metadata": {}, "output_type": "execute_result" } ], "source": [ "sd = np.array([])\n", "for i in np.arange(1, 10, 1):\n", " # Create an array of i 1's and (10-i) 0's\n", " population = np.append(np.ones(i), 1-np.ones(10-i))\n", " sd = np.append(sd, np.std(population))\n", " \n", "zero_one_sds = pd.DataFrame(\n", " {\"Population Proportion of 1's\":np.arange(0.1, 1, 0.1),\n", " \"Population SD\":sd})\n", "\n", "zero_one_sds" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Not surprisingly, the SD of a population with 10% 1's and 90% 0's is the same as that of a population with 90% 1's and 10% 0's. That's because you switch the bars of one histogram to get the other; there is no change in spread.\n", "\n", "More importantly for our purposes, the SD increases as the proportion of 1's increases, until the proportion of 1's is 0.5; then it starts to decrease symmetrically." ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [ { "data": { "image/png": "iVBORw0KGgoAAAANSUhEUgAAAagAAAEJCAYAAADB8rOLAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjMuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8vihELAAAACXBIWXMAAAsTAAALEwEAmpwYAAAbCElEQVR4nO3df0xV9/3H8RfyQ9tJ1nmHF1tFS8somgFCBatJ6TDTLOvEmOCqyaLX/rApURdNLHWtVufSkTtNW38kTnbdNLMVN6ambUpSdturojhR+r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KSpLU+eH9V38DPXTokG7evKmdO3dq586dXeNTpkzRxYsXw16/qfrbV/Stvz0dM2aMDh8+rBdffFE//OEPNW7cOH3ve9/TL37xC40Zw+/Cd/S3r3l5eSotLdUbb7yhnTt3aty4cXr00Uf1hz/8Qd/4xjeGaxlhwf+DAgAYiV9rAABGIqAAAEYioAAARiKgAABGIqAAAEYioAAARiKgAABGIqAAAEYioAAARvpf6ZIGYNmH1RkAAAAASUVORK5CYII=\n", "text/plain": [ "
" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "plt.scatter(zero_one_sds[\"Population Proportion of 1's\"], zero_one_sds['Population SD'])\n", "\n", "plt.show()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "**Summary:** The SD of a population of 1's and 0's is at most 0.5. That's the value of the SD when 50% of the population is coded 1 and the other 50% are coded 0." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## The Sample Size\n", "We know that \n", "$$\n", "\\sqrt{\\mbox{sample size}} ~ \\ge ~ 4 \\times \\frac{\\mbox{SD of the 0-1 population}}{0.01}\n", "$$\n", "and that the SD of the 0-1 population is at most 0.5, regardless of the proportion of 1's in the population. So it is safe to take\n", "\n", "$$\n", "\\sqrt{\\mbox{sample size}} ~ \\ge ~ 4 \\times \\frac{0.5}{0.01} ~=~ 200\n", "$$\n", "\n", "So the sample size should be at least $200^2 = 40,000$. That's an enormous sample! But that's what you need if you want to guarantee great accuracy with high confidence no matter what the population looks like." ] } ], "metadata": { "anaconda-cloud": {}, "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.5" } }, "nbformat": 4, "nbformat_minor": 1 }