|
| 1 | +{ |
| 2 | + "cells": [ |
| 3 | + { |
| 4 | + "cell_type": "code", |
| 5 | + "execution_count": 1, |
| 6 | + "metadata": {}, |
| 7 | + "outputs": [], |
| 8 | + "source": [ |
| 9 | + "import numpy as np\n", |
| 10 | + "import pandas as pd\n", |
| 11 | + "import matplotlib.pyplot as plt\n", |
| 12 | + "import seaborn as sns\n", |
| 13 | + "\n", |
| 14 | + "%matplotlib inline" |
| 15 | + ] |
| 16 | + }, |
| 17 | + { |
| 18 | + "cell_type": "markdown", |
| 19 | + "metadata": {}, |
| 20 | + "source": [ |
| 21 | + "### Introduction and Descriptive Statistics" |
| 22 | + ] |
| 23 | + }, |
| 24 | + { |
| 25 | + "cell_type": "code", |
| 26 | + "execution_count": 2, |
| 27 | + "metadata": {}, |
| 28 | + "outputs": [], |
| 29 | + "source": [ |
| 30 | + "x = [1, 3, 3, 4, 5, 6, 6, 7, 8, 8]" |
| 31 | + ] |
| 32 | + }, |
| 33 | + { |
| 34 | + "cell_type": "code", |
| 35 | + "execution_count": 3, |
| 36 | + "metadata": {}, |
| 37 | + "outputs": [], |
| 38 | + "source": [ |
| 39 | + "X = pd.DataFrame(x)" |
| 40 | + ] |
| 41 | + }, |
| 42 | + { |
| 43 | + "cell_type": "code", |
| 44 | + "execution_count": 4, |
| 45 | + "metadata": {}, |
| 46 | + "outputs": [ |
| 47 | + { |
| 48 | + "data": { |
| 49 | + "text/html": [ |
| 50 | + "<div>\n", |
| 51 | + "<style scoped>\n", |
| 52 | + " .dataframe tbody tr th:only-of-type {\n", |
| 53 | + " vertical-align: middle;\n", |
| 54 | + " }\n", |
| 55 | + "\n", |
| 56 | + " .dataframe tbody tr th {\n", |
| 57 | + " vertical-align: top;\n", |
| 58 | + " }\n", |
| 59 | + "\n", |
| 60 | + " .dataframe thead th {\n", |
| 61 | + " text-align: right;\n", |
| 62 | + " }\n", |
| 63 | + "</style>\n", |
| 64 | + "<table border=\"1\" class=\"dataframe\">\n", |
| 65 | + " <thead>\n", |
| 66 | + " <tr style=\"text-align: right;\">\n", |
| 67 | + " <th></th>\n", |
| 68 | + " <th>0</th>\n", |
| 69 | + " </tr>\n", |
| 70 | + " </thead>\n", |
| 71 | + " <tbody>\n", |
| 72 | + " <tr>\n", |
| 73 | + " <th>count</th>\n", |
| 74 | + " <td>10.000000</td>\n", |
| 75 | + " </tr>\n", |
| 76 | + " <tr>\n", |
| 77 | + " <th>mean</th>\n", |
| 78 | + " <td>5.100000</td>\n", |
| 79 | + " </tr>\n", |
| 80 | + " <tr>\n", |
| 81 | + " <th>std</th>\n", |
| 82 | + " <td>2.330951</td>\n", |
| 83 | + " </tr>\n", |
| 84 | + " <tr>\n", |
| 85 | + " <th>min</th>\n", |
| 86 | + " <td>1.000000</td>\n", |
| 87 | + " </tr>\n", |
| 88 | + " <tr>\n", |
| 89 | + " <th>25%</th>\n", |
| 90 | + " <td>3.250000</td>\n", |
| 91 | + " </tr>\n", |
| 92 | + " <tr>\n", |
| 93 | + " <th>50%</th>\n", |
| 94 | + " <td>5.500000</td>\n", |
| 95 | + " </tr>\n", |
| 96 | + " <tr>\n", |
| 97 | + " <th>75%</th>\n", |
| 98 | + " <td>6.750000</td>\n", |
| 99 | + " </tr>\n", |
| 100 | + " <tr>\n", |
| 101 | + " <th>max</th>\n", |
| 102 | + " <td>8.000000</td>\n", |
| 103 | + " </tr>\n", |
| 104 | + " </tbody>\n", |
| 105 | + "</table>\n", |
| 106 | + "</div>" |
| 107 | + ], |
| 108 | + "text/plain": [ |
| 109 | + " 0\n", |
| 110 | + "count 10.000000\n", |
| 111 | + "mean 5.100000\n", |
| 112 | + "std 2.330951\n", |
| 113 | + "min 1.000000\n", |
| 114 | + "25% 3.250000\n", |
| 115 | + "50% 5.500000\n", |
| 116 | + "75% 6.750000\n", |
| 117 | + "max 8.000000" |
| 118 | + ] |
| 119 | + }, |
| 120 | + "execution_count": 4, |
| 121 | + "metadata": {}, |
| 122 | + "output_type": "execute_result" |
| 123 | + } |
| 124 | + ], |
| 125 | + "source": [ |
| 126 | + "X.describe()" |
| 127 | + ] |
| 128 | + }, |
| 129 | + { |
| 130 | + "cell_type": "markdown", |
| 131 | + "metadata": {}, |
| 132 | + "source": [ |
| 133 | + "### Introduction to Probability Distribution" |
| 134 | + ] |
| 135 | + }, |
| 136 | + { |
| 137 | + "cell_type": "code", |
| 138 | + "execution_count": 5, |
| 139 | + "metadata": {}, |
| 140 | + "outputs": [ |
| 141 | + { |
| 142 | + "name": "stdout", |
| 143 | + "output_type": "stream", |
| 144 | + "text": [ |
| 145 | + "180.0\n" |
| 146 | + ] |
| 147 | + } |
| 148 | + ], |
| 149 | + "source": [ |
| 150 | + "Z = 1.50\n", |
| 151 | + "m = 150\n", |
| 152 | + "sigma = 20\n", |
| 153 | + "\n", |
| 154 | + "x = Z*sigma + m\n", |
| 155 | + "print(x)" |
| 156 | + ] |
| 157 | + }, |
| 158 | + { |
| 159 | + "cell_type": "code", |
| 160 | + "execution_count": 6, |
| 161 | + "metadata": {}, |
| 162 | + "outputs": [ |
| 163 | + { |
| 164 | + "name": "stdout", |
| 165 | + "output_type": "stream", |
| 166 | + "text": [ |
| 167 | + "117.7\n" |
| 168 | + ] |
| 169 | + } |
| 170 | + ], |
| 171 | + "source": [ |
| 172 | + "Z = -2.4\n", |
| 173 | + "m = 134.5\n", |
| 174 | + "sigma = 7.0\n", |
| 175 | + "\n", |
| 176 | + "y = Z*sigma + m\n", |
| 177 | + "print(y)" |
| 178 | + ] |
| 179 | + }, |
| 180 | + { |
| 181 | + "cell_type": "markdown", |
| 182 | + "metadata": {}, |
| 183 | + "source": [ |
| 184 | + "### Hypothesis Testing" |
| 185 | + ] |
| 186 | + }, |
| 187 | + { |
| 188 | + "cell_type": "code", |
| 189 | + "execution_count": 7, |
| 190 | + "metadata": {}, |
| 191 | + "outputs": [ |
| 192 | + { |
| 193 | + "data": { |
| 194 | + "text/plain": [ |
| 195 | + "(463, 19)" |
| 196 | + ] |
| 197 | + }, |
| 198 | + "execution_count": 7, |
| 199 | + "metadata": {}, |
| 200 | + "output_type": "execute_result" |
| 201 | + } |
| 202 | + ], |
| 203 | + "source": [ |
| 204 | + "df = pd.read_csv(\"teachingratings.csv\")\n", |
| 205 | + "df.shape" |
| 206 | + ] |
| 207 | + }, |
| 208 | + { |
| 209 | + "cell_type": "code", |
| 210 | + "execution_count": 8, |
| 211 | + "metadata": {}, |
| 212 | + "outputs": [ |
| 213 | + { |
| 214 | + "name": "stdout", |
| 215 | + "output_type": "stream", |
| 216 | + "text": [ |
| 217 | + "7884\n" |
| 218 | + ] |
| 219 | + } |
| 220 | + ], |
| 221 | + "source": [ |
| 222 | + "r = 439\n", |
| 223 | + "c = 19\n", |
| 224 | + "DF = (r-1)*(c-1)\n", |
| 225 | + "print(DF)" |
| 226 | + ] |
| 227 | + }, |
| 228 | + { |
| 229 | + "cell_type": "code", |
| 230 | + "execution_count": 9, |
| 231 | + "metadata": {}, |
| 232 | + "outputs": [ |
| 233 | + { |
| 234 | + "name": "stdout", |
| 235 | + "output_type": "stream", |
| 236 | + "text": [ |
| 237 | + "2.1371514694800307\n" |
| 238 | + ] |
| 239 | + } |
| 240 | + ], |
| 241 | + "source": [ |
| 242 | + "x = 91.54\n", |
| 243 | + "m = 63.18\n", |
| 244 | + "sigma = 13.27\n", |
| 245 | + "\n", |
| 246 | + "Z = (x-m)/sigma\n", |
| 247 | + "print(Z)" |
| 248 | + ] |
| 249 | + }, |
| 250 | + { |
| 251 | + "cell_type": "code", |
| 252 | + "execution_count": 10, |
| 253 | + "metadata": {}, |
| 254 | + "outputs": [ |
| 255 | + { |
| 256 | + "name": "stdout", |
| 257 | + "output_type": "stream", |
| 258 | + "text": [ |
| 259 | + "76.6\n" |
| 260 | + ] |
| 261 | + } |
| 262 | + ], |
| 263 | + "source": [ |
| 264 | + "#From Z table for probability of 0.25 = -0.67\n", |
| 265 | + "\n", |
| 266 | + "Z = -0.67\n", |
| 267 | + "m = 90\n", |
| 268 | + "sigma = 20\n", |
| 269 | + "\n", |
| 270 | + "time = Z*sigma + m\n", |
| 271 | + "print(time)" |
| 272 | + ] |
| 273 | + }, |
| 274 | + { |
| 275 | + "cell_type": "code", |
| 276 | + "execution_count": 11, |
| 277 | + "metadata": {}, |
| 278 | + "outputs": [ |
| 279 | + { |
| 280 | + "name": "stdout", |
| 281 | + "output_type": "stream", |
| 282 | + "text": [ |
| 283 | + "3.000000000000002\n" |
| 284 | + ] |
| 285 | + } |
| 286 | + ], |
| 287 | + "source": [ |
| 288 | + "x = 6.90\n", |
| 289 | + "mu = 5.85\n", |
| 290 | + "sd = 0.35\n", |
| 291 | + "\n", |
| 292 | + "Z = (x-mu)/sd\n", |
| 293 | + "print(Z)" |
| 294 | + ] |
| 295 | + }, |
| 296 | + { |
| 297 | + "cell_type": "code", |
| 298 | + "execution_count": null, |
| 299 | + "metadata": {}, |
| 300 | + "outputs": [], |
| 301 | + "source": [] |
| 302 | + } |
| 303 | + ], |
| 304 | + "metadata": { |
| 305 | + "kernelspec": { |
| 306 | + "display_name": "Python 3", |
| 307 | + "language": "python", |
| 308 | + "name": "python3" |
| 309 | + }, |
| 310 | + "language_info": { |
| 311 | + "codemirror_mode": { |
| 312 | + "name": "ipython", |
| 313 | + "version": 3 |
| 314 | + }, |
| 315 | + "file_extension": ".py", |
| 316 | + "mimetype": "text/x-python", |
| 317 | + "name": "python", |
| 318 | + "nbconvert_exporter": "python", |
| 319 | + "pygments_lexer": "ipython3", |
| 320 | + "version": "3.8.3" |
| 321 | + } |
| 322 | + }, |
| 323 | + "nbformat": 4, |
| 324 | + "nbformat_minor": 4 |
| 325 | +} |
0 commit comments