{ "cells": [ { "cell_type": "code", "execution_count": 52, "id": "initial_id", "metadata": { "collapsed": true, "ExecuteTime": { "end_time": "2024-01-09T23:29:26.707212Z", "start_time": "2024-01-09T23:29:26.670908300Z" } }, "outputs": [ { "data": { "text/plain": " Age Attrition BusinessTravel DailyRate Department \\\n0 21 0.0 Travel_Rarely 391 Research_Development \n1 19 1.0 Travel_Rarely 528 Sales \n2 18 1.0 Travel_Rarely 230 Research_Development \n3 18 0.0 Travel_Rarely 812 Sales \n4 18 1.0 Travel_Frequently 1306 Sales \n\n DistanceFromHome Education EducationField EnvironmentSatisfaction \\\n0 15 College Life_Sciences High \n1 22 Below_College Marketing Very_High \n2 3 Bachelor Life_Sciences High \n3 10 Bachelor Medical Very_High \n4 5 Bachelor Marketing Medium \n\n Gender ... PerformanceRating RelationshipSatisfaction StockOptionLevel \\\n0 Male ... Excellent Very_High 0 \n1 Male ... Excellent Very_High 0 \n2 Male ... Excellent High 0 \n3 Female ... Excellent Low 0 \n4 Male ... Excellent Very_High 0 \n\n TotalWorkingYears TrainingTimesLastYear WorkLifeBalance YearsAtCompany \\\n0 0 6 Better 0 \n1 0 2 Good 0 \n2 0 2 Better 0 \n3 0 2 Better 0 \n4 0 3 Better 0 \n\n YearsInCurrentRole YearsSinceLastPromotion YearsWithCurrManager \n0 0 0 0 \n1 0 0 0 \n2 0 0 0 \n3 0 0 0 \n4 0 0 0 \n\n[5 rows x 31 columns]", "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 \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 \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
AgeAttritionBusinessTravelDailyRateDepartmentDistanceFromHomeEducationEducationFieldEnvironmentSatisfactionGender...PerformanceRatingRelationshipSatisfactionStockOptionLevelTotalWorkingYearsTrainingTimesLastYearWorkLifeBalanceYearsAtCompanyYearsInCurrentRoleYearsSinceLastPromotionYearsWithCurrManager
0210.0Travel_Rarely391Research_Development15CollegeLife_SciencesHighMale...ExcellentVery_High006Better0000
1191.0Travel_Rarely528Sales22Below_CollegeMarketingVery_HighMale...ExcellentVery_High002Good0000
2181.0Travel_Rarely230Research_Development3BachelorLife_SciencesHighMale...ExcellentHigh002Better0000
3180.0Travel_Rarely812Sales10BachelorMedicalVery_HighFemale...ExcellentLow002Better0000
4181.0Travel_Frequently1306Sales5BachelorMarketingMediumMale...ExcellentVery_High003Better0000
\n

5 rows × 31 columns

\n
" }, "execution_count": 52, "metadata": {}, "output_type": "execute_result" } ], "source": [ "import pandas as pd\n", "import numpy as np\n", "import random as rd\n", "import seaborn as sns\n", "rd.seed(42)\n", "df = pd.read_feather(\"../datasets/attrition.feather\")\n", "df.head()" ] }, { "cell_type": "code", "execution_count": 28, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "(1470, 31)\n" ] }, { "data": { "text/plain": "" }, "execution_count": 28, "metadata": {}, "output_type": "execute_result" }, { "data": { "text/plain": "
", "image/png": "iVBORw0KGgoAAAANSUhEUgAAAiQAAAGdCAYAAAAi3mhQAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjguMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8g+/7EAAAACXBIWXMAAA9hAAAPYQGoP6dpAAAiNElEQVR4nO3de1TUdf7H8dcMHEaUCEVgFTu63q+NBIvtqnlZPGp1Tga2x9pOa1a0J4zOyTXDspsaJ8kL5iVZbfOEiSll17O71elYZl4WBY+aLWAXWryAKxqJzMZ8f3+4zvnNasXowGe+8HycM3/M9zvM9z19ZObZzDDjsCzLEgAA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461sqwyspK9erV66LtrFdoKSkpUVRUlFJTU33bMjMzlZuba3ytCJIrFB0drdGjR/vOe71eFRYW6vrrr1dNTY3i4+P9Lh8bG6tjx4619pj4H+PHj9cdd9yhpKQkTZw4kbUKQZ999pn+8Y9/6IEHHvDbzlqFHsuy9OWXX2r79u2aOHGi0tLS9Pzzz8vj8bBeIaaqqkqJiYnaunWrJk2apN/+9rdauXKlvF6v8bUKb5WjtCN5eXk6dOiQtmzZopdfflkRERF++yMiIi761mO0vuXLl6u2tlZPPfWUcnNz1dDQwFqFkMbGRj355JN64oknLvo2cNYq9FRXV/vWZdmyZfr222+1YMECnTt3jvUKMWfPntXXX3+toqIi5ebmqqamRk888YQiIyONrxVBEkR5eXlav369li5dqv79+8vlcqmurs7vMh6P56I7WLS+YcOGSTr/wPenP/1JGRkZamho8LsMa2XOihUrNHToUL9nHy9wuVwX3UGyVmYlJiZq165duvrqq+VwODRo0CB5vV7Nnj1bqamprFcICQ8PV319vRYvXqzExERJ54Ny48aN6tmzp9G1IkiCZP78+dq4caPy8vI0ceJESVJCQoIqKir8LldbW3vRU2JoHbW1tSotLVVaWppvW9++ffWf//xHcXFxOnLkyEWXZ63MePfdd1VbW6ukpCRJ8t1J/u1vf9PNN9+s2tpav8uzVubFxMT4ne/Tp48aGxsVFxfHeoWQuLg4uVwuX4xI0i9/+UsdPXpUqampRteK95AEwYoVK1RUVKQlS5bopptu8m13u906ePCgzp0759tWUlIit9ttYsx279tvv9XMmTN1/Phx37YDBw6oS5cuSk5OZq1CyCuvvKK3335bW7du1datWzV+/HiNHz9eW7duldvt1r59+3yfm2BZlvbu3ctaGfTJJ59oxIgRfs8yfv7554qJiVFycjLrFULcbrcaGxv15Zdf+rYdOXJEiYmJxn+3CJIrVFlZqVWrVum+++5TcnKyampqfKfU1FR169ZNOTk5Ki8vV0FBgfbv36+pU6eaHrtdGjZsmIYMGaK5c+eqoqJC27ZtU15env74xz+yViEmMTFRPXv29J06deqkTp06qWfPnpo0aZLOnDmjhQsXqqKiQgsXLlRDQ4MmT55seux2KykpSS6XS48//riOHDmibdu2adGiRbr33ntZrxDTu3dvjR07Vjk5OTp8+LA++eQTFRQU6Pbbbze/Vq3yx8Vt2Jo1a6z+/ftf8mRZlvXVV19Zv//9762hQ4daN910k/Xpp58anrh9O3bsmJWVlWVdd9111siRI63Vq1f7/uaetQpdc+bM8X0OiWVZVllZmTVlyhRr2LBh1tSpU62DBw8anA6WZVn//Oc/renTp1vDhw+3Ro4cab3wwgu+3y3WK7ScOXPGmj17tjV8+HDr17/+dcislcOy/vvcDAAAgCG8ZAMAAIwjSAAAgHEECQAAMI4gAQAAxhEkAADAOIIEAAAYR5AAAADjCBIAAGAcQQIAAIwjSAAAgHEECQAAMI4gAQAAxv0fnI9dsdpMxSUAAAAASUVORK5CYII=" }, "metadata": {}, "output_type": "display_data" } ], "source": [ "print(df.shape)\n", "df[\"Age\"].hist()" ], "metadata": { "collapsed": false, "ExecuteTime": { "end_time": "2024-01-09T18:17:35.462202600Z", "start_time": "2024-01-09T18:17:35.288372100Z" } }, "id": "6bc0db10e43f819" }, { "cell_type": "markdown", "source": [ "# Simple sampling" ], "metadata": { "collapsed": false }, "id": "a1c5e970018f62d9" }, { "cell_type": "code", "execution_count": 29, "outputs": [ { "data": { "text/plain": "" }, "execution_count": 29, "metadata": {}, "output_type": "execute_result" }, { "data": { "text/plain": "
", "image/png": "iVBORw0KGgoAAAANSUhEUgAAAh0AAAGdCAYAAAC2OMGiAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjguMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8g+/7EAAAACXBIWXMAAA9hAAAPYQGoP6dpAAAgk0lEQVR4nO3dfXBU1f3H8c9uIiESYiAJtGAHCog8CjE2+EAcZLA4ik+IFbG0VNs4CAYFFXUU6MQOSnxCraBFCwVKVBBGijOItTLaIigEHGLFLBHERklgAAlCItnz+4NftoSHNEvOns29eb9mGM3Z3XO/3z03dz+5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GWO0ceNGffzxx8rJyfHtOjfUs1/Xuc4TTzyh66+/Xj169IiMbdmyRdnZ2Qr8/1dbBgIBXXjhhZ5f5zqn6rmsrEyBQEA/+clP4lhZbGzfvv2U+6+f1/l0Pft5nev4JnSkpqYqNzc38nM4HNaiRYt08cUXq7KyUh06dKh3/fT0dH377beuy7SqoZ63b9+uQCCguXPn6vLLL9d1112n5cuXx7Fa+4YOHaoxY8YoKytLw4cP9+06H+/Env28zuvWrdMnn3yiu+66q964n9f5dD2XlZUpJSVFDzzwgAYPHqxRo0Zp7dq1carSHmOMvvzyS3344YcaPny4hg0bpieffFI1NTW+XeeGevbrOh/PN6/pOFFhYaE+++wzLV26VPPnz1erVq3qXd6qVauTvhXX647vuaSkRIFAQN26ddMvf/lLffzxx3r00UeVkpKiK6+8Mt6lWvHcc89pz549mjFjhmbOnKnDhw/7fp1P7Llv376+XOfq6mpNnz5d06ZNO+lbqv26zg31XFZWpiNHjmjw4MHKy8vTmjVrNH78eL322mvq379/nCpuuvLy8sh6Pvvss/r666/12GOP6ciRI75d54Z6TktL8+U6H8+XoaOwsFALFizQM888o549eyopKUn79++vd52ampqTfrG97MSezzvvPF1xxRVKS0uTJPXq1Us7duzQkiVLPP1gdLy6X8Lq6mrdd999uummm3T48OF61/HbOp/Y86ZNm3y5zi+88IL69etX70xenaSkpJMeePywzg31fNddd2ns2LGRFxT26tVLJSUlev311z39YNS5c2etX79e55xzjgKBgHr37q1wOKz7779fOTk5vlznhnouLi725Tofz3eho6CgQEuWLFFhYaGGDx8uSerYsaNCoVC96+3Zs+ekU3dedaqeA4FA5IGoTrdu3fTRRx/FoUJ79uzZo82bN2vYsGGRsR49euiHH35QZmamysrKTrq+19e5oZ6rqqrUvn37etf3wzqvWrVKe/bsUVZWliRFHnxWr16tESNGaM+ePfWu74d1bqjn4uLik97B0K1bt5OOa1504nGqe/fuqq6uVmZmpi/XWTp9zwcOHDjl77Mf1rmOb17TIR37S6GoqEhPP/20rrnmmsj4gAEDVFJSoiNHjkTGNm7cqAEDBsSjTKtO1/Ps2bNP+rK9zz//XN26dXNcoV1ff/21Jk6cqN27d0fGtm7dqvbt2ys7O9uX69xQzwsXLvTlOi9cuFArV67UihUrtGLFCg0dOlRDhw7VihUrNGDAABUXF8v8/9dGGWO0adMmz69zQz0/+OCDeuihh+pd3w/r/MEHH2jQoEH1zlD++9//VlpamrKzs325zg31PGvWLF+ucz3xe+OMXaFQyPTu3ds888wzpqKiot6/o0ePmquvvtrcc8895osvvjAvvfSSGThwoPnPf/4T77KbpKGet2zZYvr06WPmzZtndu7caRYvXmz69etnNm3aFO+ym+To0aNm5MiR5vbbbzelpaXm/fffN5deeqmZP3++b9e5oZ79us4nmjp1auTtowcPHjQXX3yxKSgoMKWlpaagoMBcdtll9d4q7QfH97x69WrTt29fs3z5crNjxw7z/PPPmwsuuMDs2rUrzlU2zcGDB01ubq6ZPHmy2b59u3n//ffN4MGDzcsvv+zbdW6oZ7+u8/F8Ezpeeukl07Nnz1P+M8aYHTt2mNtuu83069fPXHPNNeaf//xnnCtuuv/V85o1a8y1115r+vfvb6666iqzevXqOFdsx7fffmsmTJhgLrzwQnPZZZeZOXPmRN7L78d1Nqbhnv26zsc7/gHYGGO2bNlibrjhBtO/f38zatQoU1JSEsfqYuPEnl9//XXz85//3PTr18/ceOONZsOGDXGszp4vvvjCjBs3zgwcONBcdtll5vnnn4/s235d54Z69us61+Gr7QEAgBO+ek0HAABovggdAADACUIHAABwgtABAACcIHQAAAAnCB0AAMAJQgcAAHCC0AEAAJwgdAAAACcIHQAAwAlCBwAAcILQAQAAnPg/E+KV8gDmKQ8AAAAASUVORK5CYII=" }, "metadata": {}, "output_type": "display_data" } ], "source": [ "df_simple_samp = df.sample(n=70, random_state=42)\n", "df_simple_samp[\"Age\"].hist()" ], "metadata": { "collapsed": false, "ExecuteTime": { "end_time": "2024-01-09T18:17:35.583059900Z", "start_time": "2024-01-09T18:17:35.419232300Z" } }, "id": "15798369a2dca49e" }, { "cell_type": "markdown", "source": [ "# Systematic sampling\n", "Systematic sampling has a problem: if the data has been sorted, or there is some sort of pattern or meaning behind the row order, then the resulting sample may not be representative of the whole population. The problem can be solved by shuffling the rows, but then systematic sampling is equivalent to simple random sampling." ], "metadata": { "collapsed": false }, "id": "c4414501ea754011" }, { "cell_type": "code", "execution_count": 30, "outputs": [ { "data": { "text/plain": "" }, "execution_count": 30, "metadata": {}, "output_type": "execute_result" }, { "data": { "text/plain": "
", "image/png": "iVBORw0KGgoAAAANSUhEUgAAAh0AAAGdCAYAAAC2OMGiAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjguMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8g+/7EAAAACXBIWXMAAA9hAAAPYQGoP6dpAAAg10lEQVR4nO3de3CU1f3H8c9uIiEQYkISaMEOFBDlJkRs8EIcZLA4ijfEilhaqm0cBIOCijoKdGIHJd5QK2jRQoESFYSR4gxirYy2CAoBh1gxSwSxURIYQIKQSPb8/qDZH+GSZsnZ8+zl/ZphNGc353y/Oc+z+8nuZtdnjDECAACIML/XBQAAgMRA6AAAAE4QOgAAgBOEDgAA4AShAwAAOEHoAAAAThA6AACAE4QOAADgBKEDAAA4QegAAABOJHtdwIn27j0or9+Y3eeTsrLaRUUtrtF74vWeqH1Lidt7ovYt0Xskem+YtzmiLnQYo6g5EKKpFtfo3esq3EvUvqXE7T1R+5bo3aveeXoFAAA4QegAAABOEDoAAIAThA4AAOAEoQMAADhB6AAAAE4QOgAAgBOEDgAA4AShAwAAOHHGoaOurk4jRozQ+vXrT7rs4MGDys/P15tvvtmi4gAAQPw4o9BRW1uryZMnq7y8/JSXFxcXq6qqqkWFAQCA+BJ26AgEAvrFL36hr7766pSXf/LJJ/roo4+Uk5PT4uIAAED8CDt0bNiwQYMGDdJrr7120mV1dXV69NFHNW3aNLVq1cpKgQAAID6E/SmzY8aMOe1lc+fOVe/evTV48OAzLsjnO+NvtaahhmioxTV6j43e/X6ffJYKbZgm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rx4vjey8rK5PP51K1bN/3yl7/Uxx9/rEcffVRpaWm68sorvS7Vmueee0579uzRjBkzNHPmTB0+fDhh9vzE3vv06RO3e15bW6vp06dr2rRpJ33idbzveVO9V1RU6MiRIxo8eLAKCgq0Zs0ajR8/Xq+99pr69evnUcX2VFZWhvb32Wef1ddff63HHntMR44cift9b6r3jIwMT/ed0PFfxcXFWrBggZ555hn17NlTKSkp2r9/f6Pr1NXVnXTixoMTez/33HN1xRVXKCMjQ5J0/vnna8eOHVqyZEnM3wEdr+EEq62t1X333aebbrpJhw8fbnSdeN3zE3vftGlT3O75Cy+8oL59+zZ6ZK9BSkrKSXc08bTnTfV+1113aezYsaEXEJ5//vkqKyvT66+/Hheho3Pnzlq/fr3OPvts+Xw+9erVS8FgUPfff7/y8vLiet+b6r20tNTTfSd0SCoqKtKSJUtUXFys4cOHS5I6duyoQCDQ6Hp79uw56SG5WHeq3n0+X+jOp0G3bt300UcfeVChXXv27NHmzZs1bNiw0FiPHj30ww8/KCcnRxUVFSddP172vKnea2pq1L59+0bXj5c9X7Vqlfbs2aPc3FxJCt3ZrF69WiNGjNCePXsaXT+e9ryp3ktLS0/6i4Vu3bqddLsXy068Hevevbtqa2uVk5MT1/sunb73AwcOnPJcd7XvCf2aDunYbwIlJSV6+umndc0114TG+/fvr7KyMh05ciQ0tnHjRvXv39+LMiPidL3Pnj37pA/q+/zzz9WtWzfHFdr39ddfa+LEidq9e3dobOvWrWrfvr0GDhwY13veVO8LFy6M2z1fuHChVq5cqRUrVmjFihUaOnSohg4dqhUrVqh///4qLS2V+e9HUBljtGnTprjZ86Z6f/DBB/XQQw81un687LkkffDBBxo0aFCjRy///e9/KyMjQwMHDozrfW+q91mzZnm77578zUyUCAQCplevXuaZZ54xVVVVjf4dPXrUXH311eaee+4xX3zxhXnppZfMgAEDzH/+8x+vy7aiqd63bNlievfubebNm2d27txpFi9ebPr27Ws2bdrkddktdvToUTNy5Ehz++23m/LycvP++++bSy+91MyfPz/u97yp3uN5z080derU0J+NHjx40Fx88cWmqKjIlJeXm6KiInPZZZc1+rPpeHJ876tXrzZ9+vQxy5cvNzt27DDPP/+8ueCCC8yuXbs8rtKOgwcPmvz8fDN58mSzfft28/7775vBgwebl19+Oe73vanevd73hA4dL730kunZs+cp/xljzI4dO8xtt91m+vbta6655hrzz3/+0+OK7flfva9Zs8Zce+21pl+/fuaqq64yq1ev9rhie7799lszYcIEc+GFF5rLLrvMzJkzJ/T3+vG858Y03Xs87/nxjr/jNcaYLVu2mBtuuMH069fPjBo1ypSVlXlYXWSd2Pvrr79ufv7zn5u+ffuaG2+80WzYsMHD6uz74osvzLhx48yAAQPMZZddZp5//vnQ8R7v+95U717uOx9tDwAAnEj413QAAAA3CB0AAMAJQgcAAHCC0AEAAJwgdAAAACcIHQAAwAlCBwAAcILQAQAAnCB0AAAAJwgdAADACUIHAABwgtABAACc+D+SEYaACDVg0AAAAABJRU5ErkJggg==" }, "metadata": {}, "output_type": "display_data" } ], "source": [ "sample_size = 70\n", "pop_size = len(df)\n", "interval = pop_size // sample_size\n", "df_sys_samp = df.iloc[::interval]\n", "df_sys_samp[\"Age\"].hist()" ], "metadata": { "collapsed": false, "ExecuteTime": { "end_time": "2024-01-09T18:17:35.828413100Z", "start_time": "2024-01-09T18:17:35.578496200Z" } }, "id": "f9d422e5ed6431b3" }, { "cell_type": "markdown", "source": [ "# Proportional stratified sampling\n", "\n", "* Split the population into subgroups\n", "* Use simple random sampling on every subgroup\n", "\n", "The proportions of each category or subgroup will be similar between the population and sampling data." ], "metadata": { "collapsed": false }, "id": "75658aae51baf9e8" }, { "cell_type": "code", "execution_count": 31, "outputs": [ { "data": { "text/plain": "" }, "execution_count": 31, "metadata": {}, "output_type": "execute_result" }, { "data": { "text/plain": "
", "image/png": "iVBORw0KGgoAAAANSUhEUgAAAh0AAAGdCAYAAAC2OMGiAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjguMiwgaHR0cHM6Ly9tYXRwbG90b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KikpOQbbx81apSqqqpsGQoAAAw8fOEbAAAwgugAAABGEB0AAMAIogMAABhBdAAAACOIDgAAYATRAQAAjCA6AACAEUQHAAAwgugAAABGEB0AAMAIogMAABhBdAAAACOIDgAAYATRAQAAjCA6AACAEUQHAAAwgugAAABGEB0AAMAIogMAABhBdAAAACOIDgAAYATRAQAAjCA6AACAEUQHAAAwgugAAABGEB0AAMAIogMAABhBdAAAACOIDgAAYATRAQAAjCA6AACAEUQHAAAwgugAAABGEB0AAMAIogMAABhBdAAAACOIDgAAYATRAQAAjCA6AACAEUQHAAAwgugAAABGEB0AAMCIi46O3t5ezZ49W7t37w5uW7FihcaPHx9yqaqqsmVQAADgbjEX84d6enq0cOFCNTY2hmxvamrSwoULdcsttwS3JSYmXtqEAABgQIj4lQ6/36+f/exn+vzzz8+7rampSdnZ2UpPTw9e4uPjbRkUAAC4W8TR8eGHH2ry5Ml6+eWXQ7Z3dXWpra1No0ePtms2AAAwgET89srtt99+we1NTU3yeDx69tln9c477yg5OVl33XVXyFst4fB4Ip3IGefmdMu8AC4ev+cXxnHQXfprvSLZ30V9puNCmpub5fF4lJWVpTvuuEN79uzRY489psTERN10001h7yc19TK7RjLCbfMCiExKylCnR4h6HAfdxcn1si06br75ZhUWFio5OVmSdOWVV+rTTz/Vtm3bIoqOY8e+kGXZNVX/8XjOLpxb5jXB5/NygMaA09n5pfr6Ak6PEZU4DrpLf63Xuf2Gw7bo8Hg8weA4JysrSx988EFE+7EsueqH123zAogcv+PfjuOguzi5XradHKyiokLFxcUh2w4ePKisrCy7HgIAALiYbdFRWFioPXv2aPPmzfr888/10ksvqba2VnfffbddDwEAAFzMtuj4wQ9+oIqKCv3tb3/T7Nmz9eKLL2rlypXKy8uz6yEAAICLXdJnOg4dOhRyvaioSEVFRZc0EAAAGJj4wjcAAGAE0QEAAIwgOgAAgBFEBwAAMILoAAAARhAdAADACKIDAAAYQXQAAAAjiA4AAGAE0QEAAIwgOgAAgBFEBwAAMILoAAAARhAdAADACK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f/9+B6eDJL355psaP358yKW0tFQS6xVtent79eSTT+qHP/yhfvSjH2nVqlU69/FNp9eK6PgOlmWptLRU3d3d2rp1q1avXq23335ba9askWVZmj9/vtLS0lRTU6M5c+ZowYIFam1tdXrsQSkQCKikpEQpKSl67bXX9OSTT6qyslLbt29nraLYG2+8oR07dgSvnzp1SiUlJbrmmmv017/+VXl5efrNb36jU6dOOTgl/H6/CgsLtXPnzuBlxYoVrFcUWrFihd5//31t3rxZK1eu1F/+8he9/PLL0bFWFr6V3++3xo0bZ7W3twe3bd++3brhhhus999/38rNzbW+/PLL4G2//vWvrbVr1zox6qDX1tZmPfjgg9YXX3wR3DZ//nzriSeeYK2iVGdnp3XjjTdac+fOtRYvXmxZlmW98sor1rRp06xAIGBZlmUFAgHrpptusmpqapwcddBbuHChtXLlyvO2s17RpbOz08rOzrZ2794d3Pbcc89ZDz/8cFSsFa90fIf09HRt2rRJaWlpIdu7urq0d+9eZWdnKyEhIbg9Pz8/5KysMCcjI0Nr1qxRYmKiLMtSXV2d9uzZo4KCAtYqSv3+97/XnDlzNHbs2OC2vXv3Kj8/X57/++pKj8ejq6++mrVyWFNTk0aPHn3edtYrutTV1SkxMVEFBQXBbSUlJSorK4uKtSI6vkNSUpKmTJkSvB4IBFRVVaVrr71W7e3tysjICLl/amqqjhw5YnpMfM20adN0++23Ky8vT9OnT2etotCuXbv073//W7/97W9DtrNW0ceyLH3yySfauXOnpk+frqKiIv3hD39Qb28v6xVlWlpalJmZqdraWs2YMUM//vGPtX79egUCgahYqxhjjzRAlJeX68CBA3r11Vf1wgsvKDY2NuT22NjY875tF+atXbtWHR0dWrZsmcrKytTd3c1aRZGenh498cQTevzxx8/7FmrWKvq0trYG12XNmjU6fPiwVqxYodOnT7NeUebUqVP67LPPVF1drbKyMrW3t+vxxx9XfHx8VKwV0RGB8vJybdmyRatXr9a4ceMUFxen48ePh9ynt7f3vIMozJs0aZKks09uDz30kObOnavu7u6Q+7BWzlm3bp2uuuqqkFcRz4mLizvvIMhaOSszM1O7d+/W5ZdfLo/HowkTJigQCGjRokUqKChgvaJITEyMurq6tHLlSmVmZko6G43btm3TqFGjHF8roiNMy5cv17Zt21ReXq7p06dLkoYPHy6/3x9yv46OjvNevoIZHR0dqq+vV1FRUXDb2LFj9dVXXyk9PV3Nzc3n3Z+1csYbb7yhjo4O5eXlSVLwQPiPf/xDs2fPVkdHR8j9WSvnJScnh1wfM2aMenp6lJ6eznpFkfT0dMXFxQWDQ5K+//3v63//+58KCgocXys+0xGGdevWqbq6WqtWrdKsWbOC23NyctTQ0KDTp08Ht9XV1SknJ8eJMQe9w4cPa8GCBWprawtu279/v4YNG6b8/HzWKoq8+OKL2r59u2pra1VbW6tp06Zp2rRpqq2tVU5Ojj766KPgeQUsy9J//vMf1spB7777riZPnhzyauHHH3+s5ORk5efns15RJCcnRz09Pfrkk0+C25qbm5WZmRkVv1tEx3doamrShg0bdN999yk/P1/t7e3BS0FBgUaMGKElS5aosbFRGzdu1L59+zRv3jynxx6UJk2apIkTJ2rp0qXy+/3asWOHysvLdf/997NWUSYzM1OjRo0KXoYOHaqhQ4dq1KhRmjFjhk6ePKmnnnpKfr9fTz31lLq7u/WTn/zE6bEHrby8PMXFxenRRx9Vc3OzduzYoWeeeUb33nsv6xVlsrKyNHXqVC1ZskQHDx7Uu+++q40bN+oXv/hFdKyVsX+c61LPPfecNW7cuAteLMuyPv30U+uXv/ylddVVV1mzZs2y3nvvPYcnHtyOHDlizZ8/37r66qut66+/3qqsrAz+m3TWKnotXrw4eJ4Oy7KsvXv3WjfffLM1adIka968eVZDQ4OD08GyLOu///2vVVxcbOXm5lrXX3+99cc//jH4u8V6RZeTJ09aixYtsnJzc63rrrsuqtaKr7YHAABG8PYKAAAwgugAAABGEB0AAMAIogMAABhBdAAAACOIDgAAYATRAQAAjCA6AACAEUQHAAAwgugAAABGEB0AAMAIogMAABjx/wAerWdICHvT6gAAAABJRU5ErkJggg==" }, "metadata": {}, "output_type": "display_data" } ], "source": [ "df_strat_samp = df.groupby(\"Department\", observed=False).sample(frac=0.1, random_state=42)\n", "df_strat_samp[\"Age\"].hist()" ], "metadata": { "collapsed": false, "ExecuteTime": { "end_time": "2024-01-09T18:17:35.995234500Z", "start_time": "2024-01-09T18:17:35.823517300Z" } }, "id": "359d88c37f86ab5a" }, { "cell_type": "code", "execution_count": 32, "outputs": [ { "data": { "text/plain": "Department\nResearch_Development 0.653741\nSales 0.303401\nHuman_Resources 0.042857\nName: proportion, dtype: float64" }, "execution_count": 32, "metadata": {}, "output_type": "execute_result" } ], "source": [ "df[\"Department\"].value_counts(normalize=True)" ], "metadata": { "collapsed": false, "ExecuteTime": { "end_time": "2024-01-09T18:17:35.997690300Z", "start_time": "2024-01-09T18:17:35.988534100Z" } }, "id": "bdb40c09cedb8939" }, { "cell_type": "code", "execution_count": 33, "outputs": [ { "data": { "text/plain": "Department\nResearch_Development 0.653061\nSales 0.306122\nHuman_Resources 0.040816\nName: proportion, dtype: float64" }, "execution_count": 33, "metadata": {}, "output_type": "execute_result" } ], "source": [ "df_strat_samp[\"Department\"].value_counts(normalize=True)" ], "metadata": { "collapsed": false, "ExecuteTime": { "end_time": "2024-01-09T18:17:36.008678100Z", "start_time": "2024-01-09T18:17:35.997690300Z" } }, "id": "5a04b4bfebc60408" }, { "cell_type": "markdown", "source": [ "# Equal counts stratified sampling\n", "The sampling will extract n rows of each category" ], "metadata": { "collapsed": false }, "id": "a8e08efe798af0d5" }, { "cell_type": "code", "execution_count": 34, "outputs": [ { "data": { "text/plain": "" }, "execution_count": 34, "metadata": {}, "output_type": "execute_result" }, { "data": { "text/plain": "
", "image/png": "iVBORw0KGgoAAAANSUhEUgAAAh0AAAGdCAYAAAC2OMGiAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjguMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8g+/7EAAAACXBIWXMAAA9hAAAPYQGoP6dpAAAfUklEQVR4nO3de2zV9f3H8dc5rbSFUilQ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j06Dhw4oLvvvltbt27VH/7wB2VkZLTqz+/evV/HfLmIuVDom0OJh71YC9rsKSlh7x+8rezZc0ANDZFTXidoZ360oM4e1LklZm+L2RvXbQmv0VFbW6uf//zn+ve//6158+apV69erV7DOcXNAyGe9mItyLMnEp9nFOQzD+rsQZ1bYvZYze4tOiKRiMaPH6/PP/9c8+fPV58+fXwtDQAAkoC36FiyZInWrVunmTNnKisrS9XV1ZKk0047TZ06dfJ1GwAAkKC8RceqVasUiUR01113NbleWFio+fPn+7oNAABIUKcUHZ988kn0f7/88sunvBkAAJC8+IFvAADABNEBAABMEB0AAMAE0QEAAEwQHQAAwATRAQAATBAdAADABNEBAABMEB0AAMAE0QEAAEwQHQAAwATRAQAATBAdAADABNEBAABMEB0AAMAE0QEAAEwQHQAAwATRAQAATBAdAADABNEBAABMEB0AAMAE0QEAAEwQHQAAwATRAQAATBAdAADABNEBAABMEB0AAMAE0QEAAEwQHQAAwATRAQAATBAdAADABNEBAABMEB0AAMAE0QEAAEwQHQAAwATRAQAATBAdAADABNEBAABMEB0AAMAE0QEAAEwQHQAAwATRAQAATJx0dNTX12vkyJFat25d9Nr27ds1ZswYDR48WFdeeaXeeecdL5sEAACJ76Sio66uThMnTlR5eXn0mnNO48aNU9euXbV06VJde+21Gj9+vHbs2OFtswAAIHGltvYPVFRUaNKkSXLONbn+7rvvavv27Vq8eLHat2+vPn36aO3atVq6dKnuuecebxsGAACJqdXPdLz33nu64IIL9Oqrrza5XlZWpgEDBqh9+/bRawUFBdq0adMpbxIAACS+Vj/Tceutt57wenV1tbp169bkWpcuXfTll1+e3M4AAEBSaXV0fJtDhw6pXbt2Ta61a9dO9fX1rVonFPK1o5PXuId42Iu1IM+eiHycU5DPPKizB3VuidmP/tX3ui3hLTrS0tK0d+/eJtfq6+uVnp7eqnW6dOnoa0unLJ72Yi3IsyeK7OwOXtcL8pkHdfagzi0xe6x4i47u3buroqKiybWamprjPuXyv+zevV/HfI2quVDom0OJh71YC9rsKSlh7x+8rezZc0ANDZFTXidoZ360oM4e1LklZm+L2RvXbQlv0ZGXl6fZs2fr8OHD0Wc31q9fr4KCglat45zi5oEQT3uxFuTZE4nPMwrymQd19qDOLTF7rGb39i+SFhYW6rvf/a4efvhhlZeXa/bs2frwww81atQoX7cAAAAJzFt0pKSk6MUXX1R1dbVuuOEG/fGPf9Rvf/tb9ejRw9ctAABAAjulT6988sknTV4+88wztWDBglPaEAAASE78wDcAAGCC6AAAACaIDgAAYILoAAAAJogOAABggugAAAAmiA4AAGCC6AAAACaIDgAAYILoAAAAJogOAABggugAAAAmiA4AAGCC6AAAACaIDgAAYILoAAAAJogOAABggugAAAAmiA4AAGCC6AAAACaIDgAAYILoAAAAJogOAABggugAAAAmiA4AAGCC6AAAACaIDgAAYILoAAAAJogOAABggugAAAAmiA4AAGCC6AAAACaIDgAAYILoAAAAJogOAABggugAAAAmiA4AAGCC6AAAACaIDgAAYILoAAAAJogOAABggugAAAAmvEbHF198obvuukvnnXeehg0bprlz5/pcHgAAJLBUn4vdd9996tGjh9544w1VVFTogQceUM+ePXX55Zf7vA0AAEhA3p7p2LdvnzZt2qSxY8eqV69eGj58uIqKirR27VpftwAAAAnMW3Skp6crIyNDb7zxhr7++mtVVVVpw4YN6t+/v69bAACABOYtOtLS0jRlyhS9+uqrysvL049+9CNdeumluummm3zdAgAAJDCvX9NRWVmpyy67TD/72c9UXl6ukpISXXTRRbrmmmtavEYo5HNHJ6dxD/GwF2tBnj3RpKT4+TtD41mnpoblnJclT8g5p0ikDW9wEoL6eA/q3BKzH/2r73Vbwlt0rF27VkuWLNGaNWuUnp6u3Nxc7dy5UzNnzmxVdHTp0tHXlk5ZPO3FWpBnj3c5mWlqiDhlZWV4XbdTpw5e1ztWQ8QpJRyf7+mD+ngP6twSs8eKt+jYvHmzzjzzTKWnp0evDRgwQLNmzWrVOrt372/Tv221RCj0zaHEw16sBW32lJSwsrPb9oOtb1kZqUoJh3Tv4o2q2FUb6+20SN9umZoxOl979hxQQ0Mk1tu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Ofe3OyxPvdAf03HsUpLS/XRRx9pyZIlmjt3rtq1a9fk99u1a3fcT9JNFkfPvmXLFoVCIfXu3Vs//vGP9f777+vXv/61MjMzdfnll8d6q94899xzqqmp0dSpUzVt2jQdOnQoMGd+7OwDBw5M2jOvq6vTo48+qilTphz3E6+T/cybm72qqkqHDx/WkCFDVFxcrNWrV2vs2LF69dVXlZubG6Md+7Njx47o+T777LP6/PPP9dhjj+nw4cNJf+7Nzd6pU6eYnjvR8V+lpaWaN2+ennnmGfXr109paWnau3dvk9epr68/7g03GRw7+1lnnaXLLrtMnTp1kiSdc8452rp1qxYtWpTwH4CO1vgGVldXpwceeEA33nijDh061OR1kvXMj519w4YNSXvmL7zwggYNGtTkmb1GaWlpx32gSaYzb272u+++W7fffnv0CwjPOeccbdmyRa+99lpSREfPnj21bt06nX766QqFQurfv78ikYh++ctfqrCwMKnPvbnZN27cGNNzJzoklZSUaNGiRSotLdWIESMkSd27d1dFRUWT16upqTnuKblEd6LZQ6FQ9INPo969e+vdd9+NwQ79qqmp0aZNmzR8+PDotb59++rrr79WTk6Oqqqqjnv9ZDnz5mavra1V586dm7x+spz5ypUrVVNTo/z8fEmKfrBZtWqVRo4cqZqamiavn0xn3tzsGzduPO47Fnr37n3c+71Eduz7sT59+qiurk45OTlJfe7St8++b9++E76tW517oL+mQ/rmbwKLFy/W008/rauuuip6PS8vT1u2bNHhw4ej19avX6+8vLxYbLNNfNvsM2bMOO4H9X388cfq3bu38Q79+/zzzzV+/Hjt3Lkzem3z5s3q3LmzCgoKkvrMm5t9/vz5SXvm8+fP14oVK7R8+XItX75cw4YN07Bhw7R8+XLl5eVp48aNcv/9EVTOOW3YsCFpzry52R966CE9/PDDTV4/Wc5ckt5++21dcMEFTZ69/Ne//qVOnTqpoKAgqc+9udmnT58e23OPyffMxImKigrXv39/98wzz7hdu3Y1+e/IkSPuyiuvdPfdd5/79NNP3UsvveQGDx7s/vOf/8R62140N3tZWZkbMGCAmzNnjtu2bZtbuHChGzRokNuwYUOst33Kjhw54m644QZ3xx13uPLycvfWW2+5iy++2M2dOzfpz7y52ZP5zI81efLk6LeN7t+/31144YWupKTElZeXu5KSEnfJJZc0+bbpZHL07KtWrXIDBw50y5Ytc1u3bnXPP/+8O/fcc9327dtjvEs/9u/f74qKitzEiRNdZWWle+utt9yQIUPc7Nmzk/7cm5s91uce6Oh46aWXXL9+/U74n3PObd261d12221u0KBB7qqrrnL/+Mc/Yrxjf/7X7KtXr3ZXX321y83NdVdccYVbtWpVjHfsz5dffunGjRvnzjvvPHfJJZe4mTNnRr9fP5nP3LnmZ0/mMz/a0R94nXOurKzMXXfddS43N9eNGjXKbdmyJYa7a1vHzv7aa6+5H/7wh27QoEHu+uuvd++9914Md+ffp59+6saMGeMGDx7sLrnkEvf8889HH+/Jfu7NzR7Lc+dH2wMAABOB/5oOAABgg+gAAAAmiA4AAGCC6AAAACaIDgAAYILoAAAAJogOAABggugAAAAmiA4AAGCC6AAAACaIDgAAYILoAAAAJv4fyL4YvVIWWG4AAAAASUVORK5CYII=" }, "metadata": {}, "output_type": "display_data" } ], "source": [ "df_eq_strat_samp = df.groupby(\"Department\", observed=False).sample(n=15, random_state=42)\n", "df_eq_strat_samp[\"Age\"].hist()" ], "metadata": { "collapsed": false, "ExecuteTime": { "end_time": "2024-01-09T18:17:36.195207100Z", "start_time": "2024-01-09T18:17:36.007290100Z" } }, "id": "8fabd3002b70ea61" }, { "cell_type": "code", "execution_count": 35, "outputs": [ { "data": { "text/plain": "Department\nResearch_Development 0.653741\nSales 0.303401\nHuman_Resources 0.042857\nName: proportion, dtype: float64" }, "execution_count": 35, "metadata": {}, "output_type": "execute_result" } ], "source": [ "df[\"Department\"].value_counts(normalize=True)" ], "metadata": { "collapsed": false, "ExecuteTime": { "end_time": "2024-01-09T18:17:36.196275400Z", "start_time": "2024-01-09T18:17:36.189687100Z" } }, "id": "4faaeaee6597546d" }, { "cell_type": "code", "execution_count": 36, "outputs": [ { "data": { "text/plain": "Department\nHuman_Resources 0.333333\nResearch_Development 0.333333\nSales 0.333333\nName: proportion, dtype: float64" }, "execution_count": 36, "metadata": {}, "output_type": "execute_result" } ], "source": [ "df_eq_strat_samp[\"Department\"].value_counts(normalize=True)" ], "metadata": { "collapsed": false, "ExecuteTime": { "end_time": "2024-01-09T18:17:36.207147600Z", "start_time": "2024-01-09T18:17:36.196275400Z" } }, "id": "f8d7b48586a49856" }, { "cell_type": "markdown", "source": [ "# Weighted random sampling\n", "Specify weights to adjust the relative probability of a row being sampled." ], "metadata": { "collapsed": false }, "id": "1cfc1ca86ba620d3" }, { "cell_type": "code", "execution_count": 37, "outputs": [ { "data": { "text/plain": "" }, "execution_count": 37, "metadata": {}, "output_type": "execute_result" }, { "data": { "text/plain": "
", "image/png": "iVBORw0KGgoAAAANSUhEUgAAAh0AAAGdCAYAAAC2OMGiAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjguMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8g+/7EAAAACXBIWXMAAA9hAAAPYQGoP6dpAAAhUklEQVR4nO3de3BU9f3/8dfZZBICMYRLoMp0oOF+M8TYQIU4QkEYwHqBWsfaNt7SUTR2pBSxonZgSjXlEi/cilbGYOKFES/9w1LHGypIEeIYBEkCik0JgQEkXJKS/fz+4Jv9uVzibjj72ZyT52NmZ9hPTs55v/ezu+fFOZs9jjHGCAAAIMYC8S4AAAC0D4QOAABgBaEDAABYQegAAABWEDoAAIAVhA4AAGAFoQMAAFhB6AAAAFYQOgAAgBWEDgAAYEVivAs408GDRxXPL2Z3HKlbt4viXkes+L0/yf890p/3+b1Hv/cn+b/HaPprXjYSbS50GKM2MYFtpY5Y8Xt/kv97pD/v83uPfu9P8n+PbvfH6RUAAGAFoQMAAFhB6AAAAFYQOgAAgBWEDgAAYAWhAwAAWEHoAAAAVhA6AACAFYQOAABgBaEDAABYQegAAABWEDoAAIAVhA4AAGBFm7vKLLwtEHAUCDjxLkOSlJAQWaYOBo2CQR9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nnn9cbb7yhdevWad26dRo3bpzGjRundevWKSsrS1u3bg19V4AxRp9++qmn5q+l/h544AHNmTMnbHmvzZ8kffDBBxo5cmTYUcUvvvhC6enpysnJ8fwcSi33+Pjjj3t+HrOystTQ0KDdu3eHxqqrq9WrV6/YvA5b/XcvHldZWWkGDx5sFi9eHPb31fv37zenTp0ykydPNr/73e/Ml19+aVasWGFGjBjhqe94aKm/8vJyM2TIELNq1Srz1VdfmTVr1phhw4aZTz/9NN5lR+XUqVPmhhtuMLfddpvZtWuXeffdd80VV1xhnnvuOV/MYUv9+WUOv2v27NmhPyk9evSoGTVqlJk3b57ZtWuXmTdvnhk9erQnv+Oh2Xf7e+utt8zQoUPNq6++avbs2WOefPJJc+mll5q9e/fGucroHD161OTl5Zn777/fVFVVmXfffdeMGTPGrFy50jdz2FKPfpnHgoIC84tf/MJ88cUX5v333zejRo0yq1evjskcttvQsWLFCjNgwIBz3owxZs+ePeaXv/ylGTZsmJkyZYr58MMP41xxdL6vv/Xr15trrrnGDB8+3EyaNMm89dZbca64dfbt22dmzJhhLrvsMjN69GizbNmy0N+Ue30OjWm5P7/MYbPv7pSNMaa8vNxcd911Zvjw4Wb69OmmoqIijtVduDP7e+mll8zVV19thg0bZq6//nrzySefxLG61vvyyy9Nfn6+GTFihBk9erR58sknQ89Rv8xhSz36YR6//fZbM2vWLDNixAjzk5/8JKZzyKXtAQCAFe36Mx0AAMAeQgcAALCC0AEAAKwgdAAAACsIHQAAwApCBwAAsILQAQAArCB0AAAAKwgdAADACkIHAACwgtABAACsIHQAAAAr/h+N+wr82CnmdAAAAABJRU5ErkJggg==" }, "metadata": {}, "output_type": "display_data" } ], "source": [ "df_weight = df\n", "condition = df_weight[\"Department\"] == \"Sales\"\n", "df_weight[\"weight\"] = np.where(condition, 2, 1) # weight 2 if match - 1 don't match => 2 times the chance of beign picked\n", "df_weight = df.sample(frac=0.1, weights=\"weight\", random_state=42)\n", "df_weight[\"Age\"].hist()" ], "metadata": { "collapsed": false, "ExecuteTime": { "end_time": "2024-01-09T18:17:36.407116800Z", "start_time": "2024-01-09T18:17:36.203767500Z" } }, "id": "ba3b8a14c558df8c" }, { "cell_type": "code", "execution_count": 38, "outputs": [ { "data": { "text/plain": "Department\nResearch_Development 0.653741\nSales 0.303401\nHuman_Resources 0.042857\nName: proportion, dtype: float64" }, "execution_count": 38, "metadata": {}, "output_type": "execute_result" } ], "source": [ "df.value_counts(\"Department\", normalize=True)" ], "metadata": { "collapsed": false, "ExecuteTime": { "end_time": "2024-01-09T18:17:36.420165900Z", "start_time": "2024-01-09T18:17:36.402905900Z" } }, "id": "10f01d89bbf6b641" }, { "cell_type": "code", "execution_count": 39, "outputs": [ { "data": { "text/plain": "Department\nResearch_Development 0.537415\nSales 0.435374\nHuman_Resources 0.027211\nName: proportion, dtype: float64" }, "execution_count": 39, "metadata": {}, "output_type": "execute_result" } ], "source": [ "df_weight.value_counts(\"Department\", normalize=True)" ], "metadata": { "collapsed": false, "ExecuteTime": { "end_time": "2024-01-09T18:17:36.421218600Z", "start_time": "2024-01-09T18:17:36.410843Z" } }, "id": "bf432e27e6cb2952" }, { "cell_type": "markdown", "source": [ "# Cluster sampling\n", "* Use simple random sampling to pick some subgroups\n", "* Use simple random sampling on only those subgroups" ], "metadata": { "collapsed": false }, "id": "2db075dd5cba8831" }, { "cell_type": "code", "execution_count": 45, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "C:\\Users\\b061995\\AppData\\Local\\Temp\\ipykernel_21152\\4183575958.py:5: SettingWithCopyWarning: \n", "A value is trying to be set on a copy of a slice from a DataFrame.\n", "Try using .loc[row_indexer,col_indexer] = value instead\n", "\n", "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n", " df_filtered[\"JobRole\"] = df_filtered[\"JobRole\"].cat.remove_unused_categories()\n", "C:\\Users\\b061995\\AppData\\Local\\Temp\\ipykernel_21152\\4183575958.py:6: FutureWarning: The default of observed=False is deprecated and will be changed to True in a future version of pandas. Pass observed=False to retain current behavior or observed=True to adopt the future default and silence this warning.\n", " df_clust_samp = df_filtered.groupby(\"JobRole\").sample(n=10, random_state=42)\n" ] }, { "data": { "text/plain": "" }, "execution_count": 45, "metadata": {}, "output_type": "execute_result" }, { "data": { "text/plain": "
", "image/png": "iVBORw0KGgoAAAANSUhEUgAAAhUAAAGdCAYAAACl74FWAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjguMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8g+/7EAAAACXBIWXMAAA9hAAAPYQGoP6dpAAAhS0lEQVR4nO3de3BU9fnH8c8mKUlKgAAGO6YdERHLJUJAAwKxSEEY7xUvqEWpOrGog1ZAwCLihDZKFFGpgKJC1QHvtOoflF6kWCkiNwuKEoIUCgbCECRcEpL9/v7gl4wRjXvCc9g9h/drhnFy2P3u85zncPbj2c1uxDnnBAAAcJyS4l0AAAAIB0IFAAAwQagAAAAmCBUAAMAEoQIAAJggVAAAABOECgAAYIJQAQAATBAqAACACUIFAAAwkXKiH3DPnv2y/mDwSERq27aFL2sngrD3J4W/R/oLvrD3GPb+pPD36Fd/devG4oSHCufk2zD9XDsRhL0/Kfw90l/whb3HsPcnhb/HePbHyx8AAMAEoQIAAJggVAAAABOECgAAYIJQAQAATBAqAACACUIFAAAwQagAAAAmCBUAAMCE51Cxc+dO3X777erZs6cGDhyoefPm+VAWAAAIGs8f033PPffotNNO05tvvqmSkhKNHTtW2dnZGjx4sB/1AQCAgPB0pWLfvn1au3atRo0apfbt22vQoEHKz8/X8uXL/aoPAAAEhKdQkZaWpvT0dL355ps6cuSISktLtXr1anXu3Nmv+gAAQEB4evkjNTVVkydPVmFhof74xz+qtrZWV111la655pqY14hEPNcY85p+rJ0IEqm/pKSIIj4UUrdkSkqS+bfrRSLx/0ZCr/055xSNBudrFBPpGPVL2HsMe39S+Hv0qz8v60Wc83a6LS4u1s6dO/WrX/1KmzZtUmFhoR566CF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YIJQAQAATBAqAACACUIFAAAwQagAAAAmCBUAAMAEoQIAAJggVAAAABOECgAAYIJQAQAATDQ5VBQUFGjChAmWtQAAgABrUqh49913tXTpUutaAABAgHkOFRUVFZo2bZpycnL8qAcAAARUitc7PPLII7riiiu0a9cuP+oBAAAB5SlULF++XB999JHefvttTZkypUkPGIk06W4xrenH2okg7P0hPCIRjtMTyXJfnwznmbD36Fd/XtaLOVRUVVXpwQcf1OTJk5WWltaUuiRJbdu2aPJ947l2Igh7fwi+zMzm8S7hpNG6tT/7+mQ4z4S9x3j2F3OomDlzprp166b8/PzjesA9e/bLueNa4hiRyNGd6MfaiSBR+ktOTvLtRIZwqKg4oJqaaLzLiFmQj+m9ew+ottZuXyfKecZPYe/Rr/7q1o1FzKHi3XffVXl5uXJzcyVJ1dXVkqTFixdrzZo1MRfnnHwbpp9rJ4Kw94fg4xg9sfzY1yfDDMPeYzz7izlUvPjii6qpqan/+dFHH5UkjR071r4qAAAQODGHiuzs7AY/N29+9JLh6aefblsRAAAIJD6mGwAAmPD8ORV1Hn74Ycs6AABAwHGlAgAAmCBUAAAAE4QKAABgglABAABMECoAAIAJQgUAADBBqAAAACYIFQAAwAShAgAAmCBUAAAAE4QKAABgglABAABMECoAAIAJQgUAADBBqAAAACYIFQAAwAShAgAAmCBUAAAAE4QKAABgglABAABMECoAAIAJQgUAADBBqAAAACYIFQAAwAShAgAAmCBUAAAAE4QKAABgglABAABMECoAAIAJQgUAADBBqAAAACYIFQAAwITnULF161bdeuutys3N1YABAzR37lw/6gIAAAGT4uXG0WhUBQUFysnJ0VtvvaWtW7fq3nvv1amnnqrLLrvMrxoBAEAAeLpSUV5ers6dO2vKlClq3769fvazn+n888/XqlWr/KoPAAAEhKdQ0a5dO82YMUMZGRlyzmnVqlVauXKl8vLy/KoPAAAEhKeXP75u4MCB2rFjhy688EINGTIk5vtFIk19xO9fMyUlSc7Zr+8X55yi0e8vuK4/P/YdYCkS4Tg9kSz39clwngl7j37152W9JoeKJ598Uu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2uT58+rrCw0G3atMkVFha6fv36BfIzDup8vb/Fixe7rl27urfeest98cUX7qmnnnLnnHOO27ZtW5yr9Gb//v0uPz/f3XvvvW7z5s3uvffec/3793fPPPNMaGbYWI9hmWNBQYG77rrr3Keffur++c9/uj59+rj58+fHfYaBChVz5sxxnTp1+tY/zjn3xRdfuBtvvNF169bNXXLJJe5f//pXnCv25vv6W7JkibvssstcTk6OGzp0qFu8eHGcK26aL7/80t15552uZ8+erl+/fm7WrFn1v1Md9Bk613h/YZlhna8/6Trn3Lp169yVV17pcnJy3NVXX+02bNgQx+qO3zf7e/XVV91FF13kunXr5n7xi1+4Dz/8MI7VNd3nn3/uRo4c6Xr06OH69evnnnrqqfpjNCwzbKzHMMzxq6++cuPGjXM9evRw559/fsLMkK8+BwAAJgL3ngoAAJCYCBUAAMAEoQIAAJggVAAAABOECgAAYIJQAQAATBAqAACACUIFAAAwQagAAAAmCBUAAMAEoQIAAJggVAAAABP/B6or2YR5PLzYAAAAAElFTkSuQmCC" }, "metadata": {}, "output_type": "display_data" } ], "source": [ "job_roles = list(df[\"JobRole\"].unique())\n", "job_roles_samp = rd.sample(job_roles, k=4)\n", "condition = df[\"JobRole\"].isin(job_roles_samp)\n", "df_filtered = df[condition]\n", "df_filtered[\"JobRole\"] = df_filtered[\"JobRole\"].cat.remove_unused_categories()\n", "df_clust_samp = df_filtered.groupby(\"JobRole\").sample(n=10, random_state=42)\n", "df_clust_samp[\"Age\"].hist()" ], "metadata": { "collapsed": false, "ExecuteTime": { "end_time": "2024-01-09T19:08:30.584141Z", "start_time": "2024-01-09T19:08:30.403512700Z" } }, "id": "b59f600b56c026db" }, { "cell_type": "markdown", "source": [ "# Relative error\n", "\n", "$$\n", "RE=100*\\frac{|\\text{population mean} - \\text{sample mean}|}{\\text{population mean}}\n", "$$" ], "metadata": { "collapsed": false }, "id": "3e951798a9ae4a13" }, { "cell_type": "code", "execution_count": 50, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "24.05063291139242\n" ] } ], "source": [ "attrition_srs100 = df.sample(n=100, random_state=42)\n", "mean_attrition_srs100 = attrition_srs100[\"Attrition\"].mean()\n", "rel_error_pct100 = 100 * abs(df[\"Attrition\"].mean() - mean_attrition_srs100) / df[\"Attrition\"].mean()\n", "print(rel_error_pct100)" ], "metadata": { "collapsed": false, "ExecuteTime": { "end_time": "2024-01-09T22:10:26.772175100Z", "start_time": "2024-01-09T22:10:26.764408100Z" } }, "id": "9cc55bcb181b6fb4" }, { "cell_type": "markdown", "source": [], "metadata": { "collapsed": false }, "id": "3c1dfca1fd820eb7" }, { "cell_type": "markdown", "source": [ "# Bootstrapping\n", "\n", "*Sampling*: going from a population to a smaller sample.\n", "\n", "*Bootstraping*: building up a theorical population from the sample.\n", "\n", "**Process:**\n", "\n", "1. Make a resample of the same size as the original sample.\n", "2. Calculate the statistic of interest for this bootstrap sample.\n", "3. Repeat steps 1 and 2 many times.\n", "\n", "**Bootstrap distribution mean:**\n", "\n", "* Usually close to the sample mean.\n", "* May not be a good estimate of the population mean. (here we use sampling distribution)\n", "* Bootstrapping cannot correct biases from sampling.\n", "\n", "**Standard error:** standard deviation of the statistic of interest.\n", "\n", "* standard error * sqrt(sample_size) => population standard deviation\n", "* Estimated standard error -> standard deviation of the bootstrap distribution for a sample statistic.\n", "* It can be a good estimate of the population std\n", "* Bootstrapping doesn't suffer that much from biases\n" ], "metadata": { "collapsed": false }, "id": "df8c9191b9599079" }, { "cell_type": "code", "execution_count": 54, "outputs": [ { "data": { "text/plain": "" }, "execution_count": 54, "metadata": {}, "output_type": "execute_result" }, { "data": { "text/plain": "
", "image/png": "iVBORw0KGgoAAAANSUhEUgAAAjgAAAGdCAYAAAAfTAk2AAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjguMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8g+/7EAAAACXBIWXMAAA9hAAAPYQGoP6dpAAAsOklEQVR4nO3de3hU9Z3H8c+cmSQQIE0Ix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i9v6jOinGkaMGKERI0YoKytLBw4cUHV1tbp37x6zcCNJOTk5qqur065du4LLdu7cqezsbOXk5Oj9998P/lSEMUabNm1STk5OzLYPAAASV0R7cPbv36/Zs2fr5Zdf1re+9S35/X4dPHhQ3//+97Vs2TL16BH9cbgTTzxRZ599tmbPnq077rhD5eXlKigo0LRp03ThhRfq/vvv18KFC3XFFVdo9erVqq2t1UUXXRT1dgEAQOKLaA/OggULtGfPHm3YsEHvvPOO3nvvPf3lL39RTU1NzG7yJ0mLFy/Wd77zHf37v/+7br31Vk2ePFlTpkxR9+7d9cgjj2jjxo3Kz89XcXGxCgoKuMkfAACQFOEenFdeeUWPP/64TjzxxOCy/v37a+7cubruuutiVlyPHj107733tvra0KFDtXbt2phtCwAA2COiPTgpKSlynCNX9Xg8wasTAAAA4iWigDN27Fjdeeed+vTTT4PL/vnPf2rBggU666yzYlYc4BaO45HP50T8x+uN6D81AECEIjpE9atf/UrTp0/XBRdcoLS0NEnSl19+qTPPPFNz5syJaYFAvDmOR+kZqfK2stcSAOBOYQecTz75RL1799ZTTz2lbdu26eOPP1ZKSor69eunk046qT1qBOLKcTzyOo6WFG5TWWVNRGPk9s3Q5JH9Wr1BJgAg9kIOOMYYLVy4UH/84x+1cuVKjRgxQgMHDtTAgQN144036tVXX9VPfvIT3XrrrUzisFJZZY12VRyMaN3sjK4xrgYAcCwh73N/8skntWHDBi1btqzZL3xL0kMPPaRly5Zp7dq1WrVqVcyLBAAACEfIAefZZ5/VnDlzdM4557T6+tixY3XLLbcQcAAAQNyFHHA+++wzDR069JjvGTlypEpLS6MuCgAAIBohB5zMzEx99tlnx3zPnj17lJ6eHm1NAAAAUQk54IwbN04PPPCAGhoaWn29sbFRDz74oM4444yYFQcAABCJkK+iuvHGGzVp0iTl5+drypQpGjx4sHr06KEvv/xS//u//6unn35aBw8ePOpPKwAAAHSUkANOWlqann32WS1evFh33323amtrJR26fLxHjx4aP368fvazn6lXr17tViwAAEAowrrRX3p6uhYsWKC5c+e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2uozkeehw4XyecZzHuoUAef3v/+9li9frg8//FCLFi1STU2N1q5dq/3792v58uW67LLLNHPmTH3wwQdtjtX0kxC//OUvlZyc3AHVhy7aPn/7299q4sSJ+t73vtfBlYcnmj4PHjwoSbrrrrt03XXXaenSpSopKdGsWbM6uo02Rft5fvrppzrhhBP0xBNP6A9/+IPq6up09913d3AXbWvZZ5PS0lK9/fbbmjJlylHX/frrryXpiP8Wk5OTVV9f3z4FRyiaPltKpHmoSah9Juo81CSUPhN5HmoS6ucZ13moQ/YTucR//dd/mUGDBpkpU6aYc8891/j9/uBr06ZNM7/5zW+OuX5hYaEZNGiQWbhwYXuXGpVI+nz99dfNueeea2pra40xxqxZs8a1u4abRNLn+++/bwYMGGCef/754LKtW7eaAQMGmD179nRI3eGKpM8DBw6YYcOGmaKiouCy9957z5x88snmiy++6JC6w9XUZ11dnTHGmEcffdRMnDjxmOvs27fPDBgwwOzYsaPZ8lGjRpm//vWv7VZrNCLp83CJNg+F02ciz0Ph9JnI81A4fcZ7HrJ2D05FRcURu+/79++vhoYGZWdnq1+/fs1+dfy73/2uPv/886OOt379ev385z/Xj370I912223tVne4YtXnhg0btGfPHo0aNUq5ubmaN2+edu/erdzcXL333nvt3kdbYtXncccdJ0k68cQTm71XkisOacSqz507d6qmpkYnn3xycNmpp56qQCDg+j6/+uorSdL//M//6Nxzzz3mOOnp6UpJSVFFRUVwWWNjo6qrq4OfdTzFqs8miTgPhdNnIs9D4fSZyPNQOH3Gex6yNuCUlZVpxowZ+uKLL4LLtmzZop49eyonJ0clJSXy+/3B1z7++GNlZ2e3OtZbb72lWbNmafLkyZozZ0671x6OWPV5yy23aP369Vq3bp3WrVunmTNnKisrS+vWrdPgwYM7pJdjiVWfvXv3VlZWlj766KNm7/V4POrdu3f7NhGCWPXZdE7Kjh07gst27twpSerTp097lR+yY/XZs2dPGWP0wQcfaPjw4cccx3EcDRkyRBs3bgwuKyoqks/nazapxkus+pQSdx4Kp89EnofC6TOR56Fw+oz7PNTu+4jipLGx0eTn55trrrnGlJSUmL/97W9m9OjRZuXKlebAgQPmjDPOMHPmzDH//Oc/zdNPP21OPfVUs2XLFmOMMbW1tWbv3r3GmENXZJx99tnmJz/5SbNr//fu3RvcVRdPseqzJbftGo5lnytWrDCjR482b7zxhvnwww/NpEmTzPTp0+PVWjOx7PPaa681EydONB988IHZvHmzmThxomvus3GsPo0xprS01AwYMKDV72fLPl944QUzfPhwU1hYaIqLi83FF1/smvv9xKrPRJ6HjAnv8zxcIs1DxoTXZ6LOQ8aE12c85yFrA44xxuzZs8dMnz7dDB8+3Pzrv/6refjhh4M3xSopKTGTJ082gwcPNueff36z4/Vr1qwxAwYMMMb8/7HS1v68/fbbcemrpVj02ZLbJhZjYtdnIBAwy5YtM6NHjzbDhg0zv/jFL8z+/fs7vJ+jiVWf1dXV5te//rUZNWqUGT16tJkzZ4756quvOryfozlWn0VFRWbAgAGt/uXd2vf2kUceMaNGjTJ5eXlm9uzZ5uuvv+6QHkIRiz4TfR4K9/M8/LVEmofC6TOR56Fw+oznPOQxxpj2308EAADQcaw9BwcAAHReBBwAAGAdAg4AALAOAQcAAFiHgAMAAKxDwAEAANYh4AAAAOsQcAAAgHUIOAAAwDoEHAAAYB0CDgAAsA4BBwAAWOf/AN4D8pqKcquVAAAAAElFTkSuQmCC" }, "metadata": {}, "output_type": "display_data" } ], "source": [ "df_resample = df.sample(frac=1, replace=True)\n", "means = []\n", "for i in range(1000):\n", " means.append(np.mean(df.sample(frac=1, replace=True)[\"Age\"]))\n", "sns.histplot(means)" ], "metadata": { "collapsed": false, "ExecuteTime": { "end_time": "2024-01-09T23:29:37.068843300Z", "start_time": "2024-01-09T23:29:36.518302100Z" } }, "id": "5a5f9704be95cd7c" }, { "cell_type": "markdown", "source": [ "# Confidence " ], "metadata": { "collapsed": false }, "id": "d301591b3248bbb1" }, { "cell_type": "code", "execution_count": 58, "outputs": [ { "data": { "text/plain": "" }, "execution_count": 58, "metadata": {}, "output_type": "execute_result" }, { "data": { "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kc856q+NesdcBYuXKiHHnpIl1122UmX5+Xl6Z577tErr7wSk4AjSdu2bdNll12m//7v/1ZJSYkmTpyoiy66SFVVVUpMTKyzbmJiooLBYNTbSE+310UJ7davGbxejxISPDGv6/F4vv/urlf9aHqItna0qF+fbcSnttd7rGZaWkrMazdV7Aftw8y5qnfA+frrr3Xeeef96DoXXnihJk+efMpNSdKaNWu0ePFirV69Ws2aNVP37t21b98+Pf300zr99NNPCDPBYFDNmjWLejv793+nGL2qFlcu17E/FLv0awaPx620tBTV1oZUUxP7yxUcvwRCKBT+yfoJCZ6oeoimdkNQvz7biE/t2tpjNSsqjigUCse8flPCftA+4jlXx2v/lHoHnPT0dH399dfKzMz8wXX27t2rVq1a1bfkj9q8ebOysrLqhJauXbvqmWeeUc+ePRUIBOqsHwgElJGREfV2DEO2eqDYrV8A/4fHbmywH7QPM+eq3icZ9+vXT0899ZRqampOury2tlazZs3SJZdcEpPGMjIytHPnzjpHarZv364OHTrI7/dr48aNkROaDcPQhg0b5Pf7Y7JtAABgb/UOOLfffrv27dun/Px8LVy4UFu2bFFZWZk2b96sBQsW6He/+53Kyso0cuTImDSWl5enhIQEPfjgg9qxY4fef/99PfPMM7rhhhs0YMAAHTp0SJMnT1ZpaakmT56sqqoqDRw4MCbbBgAA9lbvl6hSU1O1cOFCTZ8+XY888oiqqqokHTt60qJFCw0aNEgjR45UmzZtYtJYixYt9NJLL2ny5Mm66qqr1Lp1a/3xj3/UtddeK5fLpWeffVbjxo3TwoUL1aVLF82dO1fJyckx2TYAALC3qC7016pVK02aNEljx45VWVmZDh06pFatWumMM86IvMshljp37qwXX3zxpMvOO+88LVu2LObbBAAA9hf1lYylY2/JjuVViwEAAGKpQZ9FBQAAYGUEHAAA4DgEHAAA4DgEHAAA4DgNOskYAGAdbrdLbnf8PoEyHDYUDnPpYNgLAQcAbMztdqlVWrI87vgdkA+FwzpYUUnIga0QcADAxtxulzxut2au2qpdBypjXr9D62Td0a+L3G5XXAJOQ44+eTz1D3Mc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AAMch4AAAAMexdMDZt2+fRo0apdzcXPXu3VtTpkxRdXW1JKmsrEw33XSTevTooUGDBunjjz82uVsAAGAVlg04hmFo1KhRqqqq0muvvabHH39cH3zwgWbOnCnDMDR8+HC1adNGS5Ys0RVXXKERI0Zo9+7dZrcNAAAswLKfRbV9+3YVFRXpH//4h9q0aSNJGjVqlB599FH98pe/VFlZmebPn6/k5GSdddZZWrNmjZYsWaKRI0ea3DkAADCbZY/gtG3bVs8991wk3Bx3+PBhFRcXq2vXrkpOTo6M5+TkqKioqJG7BAAAVmTZIzipqanq3bt35HY4HNa8efN04YUXqry8XBkZGXXWT09P1969e6Pejst1yq0CABBXdn2ucrli33t961k24Py7adOmacuWLVq8eLFeeuklJSYm1lmemJioYDAYdd309BaxarEOr9ejhARPzOt6PJ7vv7ttV9/OvTekfjQ9WK33plY/nrXtft9YcZ9Q33XtfN9Ix55HJCktLSXmtf91G/HsvVWr+PX+kz2YtuUoTJs2TS+//LIef/xxnX322fL5fDp48GCddYLBoJo1axZ17f37v5NhxKhRHftDT0tLUW1tSDU1odgV1rEHdSh0rGYoFI55/WN141ffzr1HWz8hwRNVD1bqvSnWj2dtu983VtsnRPPYsvN9I0m1tcdqVlQcUSgUjmnteD5XSf/X+8GDR1RbG9veXa76HZywfMCZOHGiXn/9dU2bNk39+/eXJLVr106lpaV11gsEAie8bFUfhqGYBhwAAGLNrs9TZj7HWvYkY0maNWuW5s+fr8cee0yXX355ZNzv9+uzzz7T0aNHI2OFhYXy+/1mtAkAQNx4PG55vbH98ngs/fQfE5Y9grNt2zbNmTNHBQUFysnJUXl5eWRZbm6uTjvtNI0ePVq33367PvjgA23atElTpkwxsWMAAGKnVXKCwmFDqalJZrdiS5YNOO+9955CoZCefvppPf3003WWbd26VXPmzNGYMWOUn5+vrKwszZ49W+3btzepWwAAYivF55Xb7dITq75Q2YEjMa2dnZWm31/YUS67vj2rHiwbcAoKClRQUPCDy7OysjRv3rxG7AgAgMa3q6JSOwKxDTiZac4/KuT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oxycnLUu3dvLVq0SF27dtWuXbskSXv27NFtt90mv9+vvLw8zZo1S6FQyKxfBUAcec1uAACisXLlSl166aVyu93Ky8vT8uXLI59cPGnSJG3cuFHPP/+8amtrNWbMmEiAMQxDI0aM0M9//nMtW7ZM5eXlGjt2rFwul4YPH27ybwUg1jiCA8A29uzZow0bNqhv376SpF//+tcqKytTYWGhjhw5ouXLl+uhhx5Sjx491LNnTz344IORn/3000+1e/duTZw4UZ06dVKvXr10//3365VXXjHr1wEQRxzBAWAbK1eulM/n0yWXXCJJys3NVcuWLbVs2TL5fD7V1NSoe/fukfWzs7Mj/962bZsOHjyonJycyFg4HNbRo0dVUVGhtLS0xvtFAMQdAQeAbaxcuVJHjx6tE1JCoZDefvttXXXVVSesbxhG5N+1tbXq1KmT5syZc8J6LVq0iE/DAExDwAFgCzt27NCWLVv04IMPqlevXpHx0tJS3Xnnndq5c6cSEhK0efNmXXjhhZKkzZs3R9Y788wztXv3brVu3ToSaP7xj39o6dKlmjp1auP+MgDijnNwANjCypUr1apVK1177bU6++yzI1+DBg1S586dtWLFCuXn52vy5MkqLi5WUVGRJk+eLElyuVy65JJLlJmZqXvvvVdbt27V+vXr9dBDDykpKUkej8fk3w5ArBFwANjCypUr9Zvf/EaJiYknLLv++uv1ySefaNiwYerSpYtuuukmjRw5UoMHD5YkJSQkyOPx6Omnn1Y4HNY111yjkSNHqk+fPnVORAbgHC7jX1+kBgAbe/fdd3XRRRcpJSVFkrRp0yYNHTpUGzduVEJCgsndAWhMnIMDwDFmzZqlDz74QAUFBTpy5IimTZumvLw8wg3QBHEEB4BjlJaWauLEidq0aZMSExOVl5enBx54gHdJAU0QAQcAADgOJxkDAADHIeAAAADHIeAAAADHIeAAAADHIeAAAADHIeAAAADHIeAAAADHIeAAAADH+f9DfhnFN8Wg0AAAAABJRU5ErkJggg==" }, "metadata": {}, "output_type": "display_data" } ], "source": [ "sns.histplot(df[\"Age\"])" ], "metadata": { "collapsed": false, "ExecuteTime": { "end_time": "2024-01-10T00:07:45.479965600Z", "start_time": "2024-01-10T00:07:45.326828900Z" } }, "id": "bfe7a7d694218129" }, { "cell_type": "markdown", "source": [ "Ways to calculate:\n", "\n", "1. Mean plus or minus one standard deviation:" ], "metadata": { "collapsed": false }, "id": "ca908d93de1725dd" }, { "cell_type": "code", "execution_count": 55, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "[27.78843603467279, 46.05918301294626]\n" ] } ], "source": [ "mean = np.mean(df[\"Age\"])\n", "c1 = mean - np.std(df[\"Age\"], ddof=1)\n", "c2 = mean + np.std(df[\"Age\"], ddof=1)\n", "print([c1, c2])" ], "metadata": { "collapsed": false, "ExecuteTime": { "end_time": "2024-01-10T00:05:56.985439200Z", "start_time": "2024-01-10T00:05:56.976144100Z" } }, "id": "ce7cabb03b505084" }, { "cell_type": "markdown", "source": [ "2. Quantile method for confidence intervals" ], "metadata": { "collapsed": false }, "id": "b8b9d30bb876311" }, { "cell_type": "code", "execution_count": 57, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "[21.0, 56.0]\n" ] } ], "source": [ "q1 = np.quantile(df[\"Age\"], 0.025)\n", "q2 = np.quantile(df[\"Age\"], 0.975)\n", "print([q1, q2])" ], "metadata": { "collapsed": false, "ExecuteTime": { "end_time": "2024-01-10T00:07:02.886095800Z", "start_time": "2024-01-10T00:07:02.876254600Z" } }, "id": "8ad909dac3468ff" }, { "cell_type": "markdown", "source": [ "3. Inverse cumulative distribution function - Standard error method for confidence itnerval" ], "metadata": { "collapsed": false }, "id": "f2c01ee8e89f647c" }, { "cell_type": "code", "execution_count": 61, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "[19.018806499779515, 54.82881254783953]\n" ] } ], "source": [ "from scipy.stats import norm\n", "point_estimate = np.mean(df[\"Age\"])\n", "std_error = np.std(df[\"Age\"], ddof=1) # here we should use the standard error (std(bootstrap_distribution))\n", "lower = norm.ppf(0.025, loc=point_estimate, scale=std_error)\n", "upper = norm.ppf(0.975, loc=point_estimate, scale=std_error)\n", "print([lower, upper])" ], "metadata": { "collapsed": false, "ExecuteTime": { "end_time": "2024-01-10T00:12:11.673899Z", "start_time": "2024-01-10T00:12:11.668428Z" } }, "id": "47c22c76acb0d459" } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 2 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython2", "version": "2.7.6" } }, "nbformat": 4, "nbformat_minor": 5 }