DSA_SoSe_24/Exploration.ipynb

846 lines
442 KiB
Plaintext
Raw Normal View History

2024-05-08 08:48:17 +02:00
{
"cells": [
2024-06-07 20:52:07 +02:00
{
"cell_type": "markdown",
"id": "f9f54623-f404-4987-b490-ff028230bf22",
"metadata": {},
"source": [
"## Explorative Datenanalyse\n",
"\n",
"In diesem Notebook wird eine explorative Datenanalyse durchgeführt, um die Struktur und die wichtigsten Merkmale des Datensatzes zu verstehen. \n",
"Die Bereinigung der Daten wird in dem Notebook \"Cleaning.ipynb\" durchgeführt, deshalb wird hier direkt mit den bereinigten Daten gearbeitet. \n",
"Es wird hauptsächlich mit Visualisierungsmethoden wie unterschiedlichen Diagrammen gearbeitet, um die Daten übersichtlich darzustellen. Außerdem werden Methoden der deskriptiven Statistik verwendet, um festzustellen, ob bestimmte Korrelationen und Muster (z. B. der Zusammenhang zwischen einem erhöhten Cholesterinwert und einer Erkrankung) in den Daten von statistischer Signifikanz sind oder auch auf zufällige Variationen zurückgeführt werden können."
]
},
2024-05-08 08:48:17 +02:00
{
"cell_type": "code",
2024-06-11 17:22:38 +02:00
"execution_count": 1,
2024-05-08 08:48:17 +02:00
"id": "37d611da-6f56-46d8-905a-62026750150c",
"metadata": {
"tags": []
},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>age</th>\n",
" <th>sex</th>\n",
" <th>cp</th>\n",
" <th>trestbps</th>\n",
" <th>chol</th>\n",
" <th>fbs</th>\n",
" <th>restecg</th>\n",
" <th>thalach</th>\n",
" <th>exang</th>\n",
" <th>oldpeak</th>\n",
" <th>slope</th>\n",
" <th>ca</th>\n",
" <th>thal</th>\n",
" <th>goal</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>63</td>\n",
2024-06-07 15:16:29 +02:00
" <td>male</td>\n",
2024-05-08 08:48:17 +02:00
" <td>1</td>\n",
" <td>145</td>\n",
" <td>233</td>\n",
" <td>1</td>\n",
" <td>2</td>\n",
" <td>150</td>\n",
" <td>0</td>\n",
" <td>2.3</td>\n",
" <td>3</td>\n",
" <td>0.0</td>\n",
" <td>6.0</td>\n",
2024-06-07 20:52:07 +02:00
" <td>0</td>\n",
2024-05-08 08:48:17 +02:00
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>67</td>\n",
2024-06-07 15:16:29 +02:00
" <td>male</td>\n",
2024-05-08 08:48:17 +02:00
" <td>4</td>\n",
" <td>160</td>\n",
" <td>286</td>\n",
" <td>0</td>\n",
" <td>2</td>\n",
" <td>108</td>\n",
" <td>1</td>\n",
" <td>1.5</td>\n",
" <td>2</td>\n",
" <td>3.0</td>\n",
" <td>3.0</td>\n",
2024-06-07 20:52:07 +02:00
" <td>1</td>\n",
2024-05-08 08:48:17 +02:00
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>67</td>\n",
2024-06-07 15:16:29 +02:00
" <td>male</td>\n",
2024-05-08 08:48:17 +02:00
" <td>4</td>\n",
" <td>120</td>\n",
" <td>229</td>\n",
" <td>0</td>\n",
" <td>2</td>\n",
" <td>129</td>\n",
" <td>1</td>\n",
" <td>2.6</td>\n",
" <td>2</td>\n",
" <td>2.0</td>\n",
" <td>7.0</td>\n",
2024-06-07 20:52:07 +02:00
" <td>1</td>\n",
2024-05-08 08:48:17 +02:00
" </tr>\n",
" <tr>\n",
" <th>3</th>\n",
" <td>37</td>\n",
2024-06-07 15:16:29 +02:00
" <td>male</td>\n",
2024-05-08 08:48:17 +02:00
" <td>3</td>\n",
" <td>130</td>\n",
" <td>250</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" <td>187</td>\n",
" <td>0</td>\n",
" <td>3.5</td>\n",
" <td>3</td>\n",
" <td>0.0</td>\n",
" <td>3.0</td>\n",
2024-06-07 20:52:07 +02:00
" <td>0</td>\n",
2024-05-08 08:48:17 +02:00
" </tr>\n",
" <tr>\n",
" <th>4</th>\n",
" <td>41</td>\n",
2024-06-07 15:16:29 +02:00
" <td>female</td>\n",
2024-05-08 08:48:17 +02:00
" <td>2</td>\n",
" <td>130</td>\n",
" <td>204</td>\n",
" <td>0</td>\n",
" <td>2</td>\n",
" <td>172</td>\n",
" <td>0</td>\n",
" <td>1.4</td>\n",
" <td>1</td>\n",
" <td>0.0</td>\n",
" <td>3.0</td>\n",
2024-06-07 20:52:07 +02:00
" <td>0</td>\n",
2024-05-08 08:48:17 +02:00
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
2024-06-07 15:16:29 +02:00
" age sex cp trestbps chol fbs restecg thalach exang oldpeak \\\n",
"0 63 male 1 145 233 1 2 150 0 2.3 \n",
"1 67 male 4 160 286 0 2 108 1 1.5 \n",
"2 67 male 4 120 229 0 2 129 1 2.6 \n",
"3 37 male 3 130 250 0 0 187 0 3.5 \n",
"4 41 female 2 130 204 0 2 172 0 1.4 \n",
2024-05-08 08:48:17 +02:00
"\n",
2024-06-07 15:16:29 +02:00
" slope ca thal goal \n",
2024-06-07 20:52:07 +02:00
"0 3 0.0 6.0 0 \n",
"1 2 3.0 3.0 1 \n",
"2 2 2.0 7.0 1 \n",
"3 3 0.0 3.0 0 \n",
"4 1 0.0 3.0 0 "
2024-05-08 08:48:17 +02:00
]
},
2024-06-11 17:22:38 +02:00
"execution_count": 1,
2024-05-08 08:48:17 +02:00
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
2024-06-07 11:20:34 +02:00
"import pandas as pd\n",
"import numpy as np\n",
"\n",
"df = pd.read_csv('./data/dataset_cleaned.csv')\n",
2024-06-07 20:52:07 +02:00
"df['sex'] = df['sex'].replace({0: 'female', 1: 'male'})\n",
2024-06-07 11:20:34 +02:00
"\n",
"# extract all columns except 'goal' --> X\n",
"X = df.loc[:, df.columns != 'goal']\n",
"# extract only the column 'goal' --> y\n",
"y = df.loc[:, 'goal']\n",
"\n",
2024-05-08 08:48:17 +02:00
"df.head()"
]
},
{
"cell_type": "code",
2024-06-11 17:22:38 +02:00
"execution_count": 2,
2024-05-08 08:48:17 +02:00
"id": "6b3e5424-4a7e-4e53-82b9-d78e38939834",
"metadata": {
"tags": []
},
"outputs": [
{
"data": {
2024-06-11 17:22:38 +02:00
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAjsAAAGxCAYAAACEFXd4AAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjguMCwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy81sbWrAAAACXBIWXMAAA9hAAAPYQGoP6dpAAA49UlEQVR4nO3deVxWZf7/8fcdyw0qi4Bww4iARWWJ+5RiJaahuJRLmksqaWZlJpktViY1JVq5/XI0x8k1HW1TM01FR1xGK7XMrcwcXCqIMgNBBZXz+6OvZ7wF1BS8b06v5+NxHg/Pda5znc+Bbnh33dd9sBmGYQgAAMCirnF1AQAAABWJsAMAACyNsAMAACyNsAMAACyNsAMAACyNsAMAACyNsAMAACyNsAMAACyNsAMAACyNsAPgD5s1a5ZsNpu2bt1a6vEOHTooOjq6wq9/4MABs23+/PmaOHFiib4HDhyQzWbTG2+8ccnj//rrr/Ly8tKiRYskSQUFBRo7dqzq168vf39/+fn56dprr1X37t21bt26K70dABXM09UFAEB5mD9/vnbt2qWUlJQrHmvJkiXy9vZW27ZtdebMGSUmJmrnzp166qmndMstt0iS9u3bp6VLl2rDhg1q0aLFFV8TQMUh7ADAed5//321a9dOvr6+Wrt2rTZt2qQZM2bogQceMPu0adNGjz32mIqLi11YKYBLwdtYACqcYRiaMmWKGjRoIF9fX1WvXl333nuv/vvf/zr1S09P1z333KOaNWvKx8dH1113nQYNGqRffvnlguMnJCRo2bJlOnjwoGw2m7mdb/z48YqJiVG1atXUrFkzffrppyX65OXlafXq1eratask6ciRI5Kk8PDwUq99zTXOP0azs7M1aNAg1axZU97e3oqJidFLL72k06dPm1+Ldu3aKTg4WIcOHTLPO378uG6++WbVqVNHBQUFF7xfAH8MYQfAZTtz5oxOnz5dYjMMw6nfoEGDlJKSotatW2vx4sWaMmWKdu/erfj4eP30009mv/3796tZs2aaOnWqVq1apRdffFGfffaZbrvtNp06darMOqZMmaLmzZvL4XBo8+bN5nauv//970pPT9fEiRM1b948FRQUqF27dsrNzXXqt3TpUtlsNrVv316S1KRJE3l5eWno0KGaN2+esrKyyqwjOztbt9xyi1auXKkXX3xRn3zyiQYMGKC0tDQNHDhQkmSz2TR37lxVqVJF3bt3N+/r0UcfVWZmpt59911VrVr1Er76AC6ZAQB/0MyZMw1JF9yioqIMwzCMzZs3G5KMcePGOY1x+PBhw9fX13j66adLvUZxcbFx6tQp4+DBg4YkY8mSJSWun5mZaba1b9/evOa5MjMzDUlGXFyccfr0abP9888/NyQZ//rXv5z6d+rUyejYsaNT29tvv21Uq1bNvLfw8HCjb9++xvr16536DRo0yKhWrZpx8OBBp/Y33njDkGTs3r3bbNu4caPh6elppKSkGDNmzDAkGf/85z9L/VoAuDLM7AC4bHPmzNGWLVtKbLfddpvZ5+OPP5bNZtP999/vNPvjcDhUv359ZWRkmH1zcnL08MMPKzIyUp6envLy8lJUVJQk6euvv76iWtu3by8PDw9zv169epKkgwcPmm0FBQVauXKl+RbWWf3799f333+v+fPn6/HHH1dkZKTeeecdtWjRQq+//rrTvbZs2VIRERFO95qUlCRJTp/cat68uV599VVNnDhRjzzyiO6//34NGDDgiu4RQOlYoAzgstWpU0dNmjQp0R4QEKDDhw9Lkn766ScZhqGwsLBSx6hdu7Ykqbi4WImJifrxxx81cuRIxcXFqWrVqiouLlbTpk114sSJK6o1ODjYad9ut0uS07jLli3TqVOndPfdd5d6Tz179lTPnj0lSbt371br1q31/PPPa+DAgQoMDNRPP/2kp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T9/sXy9/d3cTUAAOBS5OXlKTIy0vw9XhbCjv73Bwj9/f0JOwAAVDIXW4LCAmUAAGBphB0AAGBphB0AAGBprNm5RIZh6PTp0zpz5oyrS/nT8/DwkKenJ48JAABcEsLOJSgqKlJWVpaOHz/u6lLwf6pUqaLw8HB5e3u7uhQAgJsj7FxEcXGxMjMz5eHhoYiICHl7ezOj4EKGYaioqEg///yzMjMzFRsbe8EHSQEAQNi5iKKiIhUXFysyMlJVqlRxdTmQ5OvrKy8vLx08eFBFRUXy8fFxdUkAADfG/xJfImYP3AvfDwDApeI3BgAAsDTCDgAAsDTW7Fym6GeXXdXrHRjT/g+fk5CQoAYNGmjixInlX9D/iY6OVkpKilJSUsrsk5qaqsWLF2v79u0VVgcAAGVhZgflymazafHixa4uAwAAk0vDTlpamv7617/Kz89PoaGh6tSpk/bu3evUxzAMpaamKiIiQr6+vkpISNDu3bud+hQWFmrIkCEKCQlR1apVdffdd+v777+/mrcCAADclEvDzrp16zR48GB9+umnSk9P1+nTp5WYmKiCggKzz2uvvabx48dr8uTJ2rJlixwOh+666y4dO3bM7JOSkqJFixZpwYIF2rhxo/Lz89WhQweedqzfnxP09NNPKygoSA6HQ6mpqeax3NxcPfTQQwoNDZW/v7/uvPNOffXVV+bx/fv365577lFYWJiqVaumv/71r1q9enWZ14qOjpYkde7cWTabzdw/a+7cuYqOjlZAQIB69Ohhfg/nzJmj4OBgFRYWOvXv2rWr+vbte2VfAADAn55L1+ysWLHCaX/mzJkKDQ3Vtm3bdMcdd8gwDE2cOFHPP/+8unTpIkmaPXu2wsLCNH/+fA0aNEi5ubl6++23NXfuXLVu3VqS9M477ygyMlKrV69WmzZtrvp9uZPZs2dr2LBh+uyzz7R582YlJyerefPmat26tdq3b6+goCAtX75cAQEBmjZtmlq1aqVvv/1WQUFBys/PV7t27fTKK6/Ix8dHs2f
2024-05-08 08:48:17 +02:00
"text/plain": [
"<Figure size 640x480 with 1 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"import matplotlib.pyplot as plt\n",
"import seaborn as sns\n",
"\n",
2024-06-07 15:16:29 +02:00
"counts_male = sum(X['sex'] == 'male')\n",
"counts_female = sum(X['sex'] == 'female')\n",
2024-06-07 11:20:34 +02:00
"\n",
2024-06-07 15:16:29 +02:00
"counts_male_sick = sum(np.all([X['sex'] == 'male',\n",
2024-06-07 11:20:34 +02:00
" y > 0], axis=0))\n",
2024-06-07 15:16:29 +02:00
"counts_female_sick = sum(np.all([X['sex'] == 'female',\n",
2024-06-07 11:20:34 +02:00
" y > 0], axis=0))\n",
2024-05-08 08:48:17 +02:00
"\n",
2024-06-07 15:16:29 +02:00
"plt.bar([1, 0], [counts_male, counts_female])\n",
"plt.bar([1, 0], [counts_male_sick, counts_female_sick])\n",
2024-06-11 17:22:38 +02:00
"plt.xticks([1, 0],[f'male ({counts_male})', f'female ({counts_female})'])\n",
"plt.ylabel('n')\n",
"plt.title('Health/Sex')\n",
2024-06-07 11:20:34 +02:00
"plt.legend(['healthy', 'sick'])\n",
2024-06-11 17:22:38 +02:00
"plt.show()"
]
},
{
"cell_type": "markdown",
"id": "66139486-85d3-45b6-b3fa-74e0eb6f235b",
"metadata": {},
"source": [
"Der obige Plot zeigt die Anzahl der kranken / gesunden Probanden aufgeteilt nach dem Geschlecht. \n",
"Es gibt etwa doppelt so viele männliche Probanden wie weibliche, von denen ca. die Hälfte an einer Herzerkreislauf-Erkrankung leiden.\n",
"Bei den Frauen sind lediglich 1/4 erkrankt."
2024-05-08 08:48:17 +02:00
]
},
{
"cell_type": "code",
2024-06-11 17:22:38 +02:00
"execution_count": 3,
2024-05-08 08:48:17 +02:00
"id": "48fd2655-1dcc-41f6-9938-ef6ea937d52e",
"metadata": {
"tags": []
},
"outputs": [
2024-06-11 17:22:38 +02:00
{
"name": "stderr",
"output_type": "stream",
"text": [
"C:\\Users\\maxwi\\anaconda3\\Lib\\site-packages\\seaborn\\_oldcore.py:1119: FutureWarning: use_inf_as_na option is deprecated and will be removed in a future version. Convert inf values to NaN before operating instead.\n",
" with pd.option_context('mode.use_inf_as_na', True):\n"
]
},
2024-05-08 08:48:17 +02:00
{
"data": {
2024-06-11 17:22:38 +02:00
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAjMAAAHFCAYAAAAHcXhbAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjguMCwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy81sbWrAAAACXBIWXMAAA9hAAAPYQGoP6dpAAA2hUlEQVR4nO3de1wVdeL/8fdJ9Ahy8YLAIUVMCc172dfUTEulVbuqraaWrtlauruxtl/9ulRiP/PWZtba4up6/ZZZuVpuqUleaFvM9RJJLpoVeChh6XgDhSBgfn/49awnMC8BMwOv5+Mxj8eemTkz7zP6WN/NfGbGYRiGIQAAAJu6xuwAAAAAPwVlBgAA2BplBgAA2BplBgAA2BplBgAA2BplBgAA2BplBgAA2BplBgAA2BplBgAA2BplBqglXn75ZTkcDnXs2NHsKJXKysqSw+HQypUrvfMSExPlcDiuaDuFhYVKTEzUzp07r+h7le0rOjpad9111xVt51LWrFmjhQsXVrrM4XAoMTGxSvcHgDID1BrLly+XJB08eFC7d+82Oc3lmTBhgnbt2nVF3yksLNTMmTOvuMxczb6uxo+VmV27dmnChAnVngGoaygzQC2wd+9effrppxoyZIgkadmyZSYnujwtWrTQLbfcUq37KCwsrLF9Xcott9yiFi1amJoBqI0oM0AtcL68zJ07V7169dLatWu9/4hf6Ouvv9bw4cMVFBSkxo0ba/To0dqzZ0+Fyz/SuYJ0zz33qGnTpmrYsKG6deumN99887LyHDt2TD//+c8VFBSkkJAQjRgxQrm5uRXWq+zSz/bt29WvXz81a9ZM/v7+ioqK0rBhw1RYWKisrCw1b95ckjRz5kw5HA45HA6NGzfOZ3v79+/X8OHD1aRJE7Vp0+ai+zpvw4YN6ty5sxo2bKjrrrtOL7/8ss/ylStXyuFwKCsry2f+zp075XA4vGeJ+vXrp/fee09Hjx71Zrtwn5VdZ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fz/v3vf0uSfve736l+/fo+06RJkyRJHo/nopkutp+IiIhL/p42bdrogw8+UFhYmCZPnqw2bdqoTZs2eumlly753Qu5XK7LXreyXOfnHT9+/Ir2e6WOHz9eadbIyMhK99+sWTOfz06nU9K5S3tAXeZndgAAV2/58uUyDEPr1q3TunXrKixftWqVZs2apXr16qlZs2b65z//WWGdHw7MDQ0NlSRNnz5dQ4cOrXS/sbGxF810ufu5mD59+qhPnz4qKyvT3r179cc//lHx8fEKDw/3nn26lCt5dk1luc7PO18eGjZsKEkqLi72We/HSt3laNasmXJycirMP3bsmKT//FkA+HGcmQFsqqysTKtWrVKbNm20Y8eOCtOTTz6pnJwcbd68WZLUt29fFRQUeD+ft3btWp/PsbGxiomJ0aeffqru3btXOgUFBV001+23366CggJt3LjRZ/6aNWuu6PfVq1dPPXr00CuvvCJJ3ks+VX024uDBg/r000995q1Zs0ZBQUG68cYbJZ17uJ4kHThwwGe9H/7G8/kuN1v//v21fft2b3k5b/Xq1QoICDD9VnLALjgzA9jU5s2bdezYMc2bN0/9+vWrsLxjx45atGiRli1bprvuuktjx47Viy++qDFjxmjWrFlq27atNm/erPfff1+SdM01//lvmz//+c8aNGiQ7rzzTo0bN07XXnutTpw4oYyMDO3fv7/CnVIXevjhh/Xiiy/q4Ycf1nPPPaeYmBht2rTJu58fs3jxYm3fvl1DhgxRVFSUvvvuO++lsgEDBkiSgoKC1KpVK73zzjvq37+/mjZtqtDQUG/huFKRkZG65557lJiYKJfLpVdffVXJycmaN2+eAgICJEk333yzYmNj9bvf/U6lpaVq0qSJNmzYoI8++qjC9jp16qT169crKSlJN910k6655hp179690n3PmDFD7777rm6//XY988wzatq0qV577TW99957mj9/vkJCQq7qNwF1jtkjkAFcnfvuu89o0KCBkZeXd9F1Ro4cafj5+Rm5ubmGYRiG2+02hg4dagQGBhpBQUHGsGHDjE2bNlV699Gnn35q/PznPzfCwsKM+vXrGxEREcYdd9zhvWvqx3z99dfGsGHDfPaTmpp6ybuZdu3aZdx///1Gq1atDKfTaTRr1szo27evsXHjRp/tf/DBB0a3bt0Mp9NpSDLGjh3rs71vv/22QqaL3c00ZMgQY926dUaHDh2MBg0aGNHR0caCBQsqfP/zzz834uLijODgYKN58+bGr3/9a+O9996rcDfTiRMnjOHDhxuNGzc2HA6Hzz5VyV1Y6enpxt13322EhIQYDRo0MLp06eJzjAzjP3czvfXWWz7zMzMzKxxToC5yGIZhmNSjAFjA7Nmz9dRTT8ntdvN0WgC2xGUmoA5ZtGiRJKldu3b6/vvvtX37dr388ssaM2YMRQaAbVFmgDokICBAL774orKyslRcXKyoqChNmzZNTz31lNnRAOCqcZkJAADYGrdmAwAAW6PMAAAAW6PMAAAAW6v1A4DLy8t17NgxBQUFXdEjzgEAgHkMw1BBQYEiIyN9HupZmVpfZo4dO1bhjbQAAMAesrOzL/noiFpfZs6/QyY7O1vBwcEmpwEAAJcjPz9fLVu2/NF3wZ1X68vM+UtLwcHBlBkAAGzmcoaIMAAYAADYGmUGAADYGmUGAADYWq0fMwMAwIXKysr0/fffmx2jzqtfv77q1atXJduizAAA6gTDMJSbm6tTp06ZHQX/p3HjxoqIiPjJz4GjzAAA6oTzRSYsLEwBAQE8SNVEhmGosLBQeXl5kiSXy/WTtkeZAQDUemVlZd4i06xZM7PjQJK/v78kKS8vT2FhYT/pkhMDgAEAtd75MTIBAQEmJ8GFzv95/NQxTJQZAECdwaUla6mqPw/KDAAAsDXGzAAA6iy32y2Px1Nj+wsNDVVUVFSVbGvcuHE6deqU3n7
2024-05-08 08:48:17 +02:00
"text/plain": [
"<Figure size 640x480 with 1 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
2024-06-11 17:22:38 +02:00
"sns.histplot(data=df, x='age', hue='goal', multiple='stack')\n",
2024-05-08 08:48:17 +02:00
"plt.xlabel('Age')\n",
2024-06-11 17:22:38 +02:00
"plt.ylabel('n')\n",
2024-05-08 08:48:17 +02:00
"plt.title('Age distribution')\n",
2024-06-11 17:22:38 +02:00
"plt.legend(['sick', 'healthy'])\n",
2024-05-08 08:48:17 +02:00
"plt.show()"
]
},
{
"cell_type": "code",
2024-06-11 17:22:38 +02:00
"execution_count": 4,
2024-05-08 08:48:17 +02:00
"id": "b9174a9d-6c8a-4915-9580-48f23cbdd038",
"metadata": {
"tags": []
},
"outputs": [
{
"data": {
2024-06-11 17:22:38 +02:00
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAjMAAAHFCAYAAAAHcXhbAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjguMCwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy81sbWrAAAACXBIWXMAAA9hAAAPYQGoP6dpAAB9RklEQVR4nO3dd3hUZdrH8e+ZmkwaIYEUCCFAqAGpIk2KgCugrl3EgoC4UhRQwSBgRCUCCqi4qKyyuMq6Nl4LKihSVEBBQOm9RCAEQnoyM5mZ8/4xzGgAkZLkTLk/1zUXnDPtztTfPOcpiqqqKkIIIYQQfkqndQFCCCGEEJdDwowQQggh/JqEGSGEEEL4NQkzQgghhPBrEmaEEEII4dckzAghhBDCr0mYEUIIIYRfkzAjhBBCCL8mYUYIIYQQfk3CjBAB4uWXX0ZRFNLS0rQu5ZwOHjyIoij8+9//9u7LyMhAUZSLup3S0lIyMjJYuXLlRV3vXPdVv359BgwYcFG381cWLVrEnDlzznmeoihkZGRU6v0JISTMCBEw3nrrLQC2bdvGjz/+qHE1F2bYsGGsXbv2oq5TWlrK008/fdFh5lLu61KcL8ysXbuWYcOGVXkNQgQbCTNCBIANGzbwyy+/0L9/fwDefPNNjSu6MHXr1uWqq66q0vsoLS2ttvv6K1dddRV169bVtAYhApGEGSECgCe8PP/883Tu3Jn33nvP+yX+R7/99hu33norERER1KhRg0GDBrF+/fqzDv+AOyDdcMMN1KxZk5CQENq0acP7779/QfUcPXqU22+/nYiICKKiorjjjjvIzs4+63LnOvTz7bff0qNHD2JiYggNDaVevXrccsstlJaWcvDgQWrVqgXA008/jaIoKIrC4MGDK9zexo0bufXWW4mOjqZhw4Z/el8eixcvplWrVoSEhNCgQQNefvnlCuf/+9//RlEUDh48WGH/ypUrURTF20rUo0cPlixZwqFDh7y1/fE+z3WYaevWrdx4441ER0cTEhJC69atWbhw4Tnv57///S9PPvkkiYmJREZG0rt3b3bt2nXOv0mIYCJhRgg/V1ZWxn//+186dOhAWloaQ4YMoaioiA8++KDC5UpKSujZsycrVqxg+vTpvP/++8TFxXHHHXecdZsrVqygS5cu5Ofn89prr/HJJ5/QunVr7rjjjrNCz7nq6d27N8uWLSMzM5MPPviA+Pj4c97PmQ4ePEj//v0xmUy89dZbfPXVVzz//POEhYVht9tJSEjgq6++AmDo0KGsXbuWtWvXMnny5Aq3c/PNN9OoUSM++OADXnvttfPe5+bNmxkzZgxjx45l8eLFdO7cmUceeYQXXnjhL+s90z//+U+6dOlCfHy8t7bzHdratWsXnTt3Ztu2bbz88st8/PHHNG/enMGDBzNjxoyzLj9x4kQOHTrEv/71L9544w327NnD9ddfj9PpvOhahQgoqhDCr7399tsqoL722muqqqpqUVGRGh4ernbr1q3C5V599VUVUL/88ssK+x988EEVUBcsWODd17RpU7VNmzZqeXl5hcsOGDBATUhIUJ1O55/WM2/ePBVQP/nkkwr7H3jggbPu56mnnlL/+DH04YcfqoC6efPmP739EydOqID61FNPnXWe5/amTJnyp+f9UXJysqooyln316dPHzUyMlItKSlRVVVVFyxYoALqgQMHKlxuxYoVKqCuWLHCu69///5qcnLyOWs/s+4777xTNZvN6uHDhytc7rrrrlMtFouan59f4X769etX4XLvv/++Cqhr16495/0JESykZUYIP/fmm28SGhrKnXfeCUB4eDi33XYb3333HXv27PFebtWqVURERPC3v/2twvUHDhxYYXvv3r3s3LmTQYMGAeBwOLynfv36cezYsfMe2lixYgURERHccMMNFfbfddddf/m3tG7dGpPJxPDhw1m4cCH79+//y+ucyy233HLBl23RogVXXHFFhX133XUXhYWFbNy48ZLu/0J9++23XHPNNSQlJVXYP3jwYEpLS89q1TnzMW3VqhUAhw4dqtI6hfB1EmaE8GN79+5l9erV9O/fH1VVyc/PJz8/n1tvvRX4fYQTQG5uLnFxcWfdxpn7jh8/DsBjjz2G0WiscBoxYgQAJ0+e/NOa/ux+4uPj//LvadiwId988w21a9dm5MiRNGzYkIYNG/LSSy/95XX/KCEh4YIve666PPtyc3Mv6n4vVm5u7jlrTUxMPOf9x8TEVNg2m82A+9CeEMHMoHUBQohL99Zbb6GqKh9++CEffvjhWecvXLiQZ599Fr1eT0xMDD/99NNZlzmzY25sbCwA6enp3Hzzzee83yZNmvxpTRd6P3+mW7dudOvWDafTyYYNG3jllVcYM2YMcXFx3tanv3Ixc9ecqy7PPk94CAkJAcBms1W43PlC3YWIiYnh2LFjZ+0/evQo8PtzIYQ4P2mZEcJPOZ1OFi5cSMOGDVmxYsVZp0cffZRjx47x5ZdfAtC9e3eKioq82x7vvfdehe0mTZqQmprKL7/8Qvv27c95ioiI+NO6evbsSVFREZ9++mmF/YsWLbqov0+v19OxY0deffVVAO8hn8pujdi2bRu//PJLhX2LFi0iIiKCtm3bAu7J9QB+/fXXCpc782/01HehtV1zzTV8++233vDi8fbbb2OxWDQfSi6Ev5CWGSH81JdffsnRo0eZPn06PXr0OOv8tLQ05s6dy5tvvsmAAQO47777mD17NnfffTfPPvssjRo14ssvv2Tp0qUA6HS//7Z5/fXXue6667j22msZPHgwderU4dSpU+zYsYONGzeeNVLqj+69915mz57Nvffey3PPPUdqaipffPGF937O57XXXuPbb7+lf//+1KtXD6vV6j1U1rt3bwAiIiJITk7mk08+4ZprrqFmzZrExsZ6A8fFSkxM5IYbbiAjI4OEhATeeecdvv76a6ZPn47FYgGgQ4cONGnShMceewyHw0F0dDSLFy/m+++/P+v2WrZsyccff8y8efNo164dOp2O9u3bn/O+n3rqKT7//HN69uzJlClTqFmzJu+++y5LlixhxowZREVFXdLfJETQ0boHshDi0vz9739XTSaTmpOT86eXufPOO1WDwaBmZ2erqqqqhw8fVm+++WY1PDxcjYiIUG+55Rb1iy++OOfoo19++UW9/fbb1dq1a6tGo1GNj49Xe/Xq5R01dT6//fabesstt1S4nzVr1vzlaKa1a9eqN910k5qcnKyazWY1JiZG7d69u/rpp59WuP1vvvlGbdOmjWo2m1VAve+++yrc3okTJ86q6c9GM/Xv31/98MMP1RYtWqgmk0mtX7++OmvWrLOuv3v3brVv375qZGSkWqtWLXX06NHqkiVLzhrNdOrUKfXWW29Va9SooSqKUuE+OccorC1btqjXX3+9GhUVpZpMJvWKK66o8Bip6u+jmT744IMK+w8cOHDWYypEMFJUVVU1ylFCCB8wbdo0Jk2axOHDh2V2WiGEX5LDTEIEkblz5wLQtGlTysvL+fbbb3n55Ze5++67JcgIIfyWhBkhgojFYmH27NkcPHgQm81GvXr1mDBhApMmTdK6NCGEuGRymEkIIYQQfk2GZgshhBDCr0mYEUIIIYRfkzAjhBBCCL8W8B2AXS4XR48eJSIi4qKmOBdCCCGEdlRVpaioiMTExAqTep5LwIeZo0ePnrUirRBCCCH8Q1ZW1l9OHRHwYcazhkxWVhaRkZEaVyOEEEKIC1FYWEhSUtJ514LzCPgw4zm0FBkZKWFGCCGE8DMX0kVEOgALIYQQwq9JmBFCCCGEX5MwI4QQQgi/JmFGCCGEEH5NwowQQggh/JqEGSGEEEL4NQkzQgghhPBrEmaEEEII4dckzAghhBDCr0mYEUIIIYRfkzAjhBBCCL8mYUYIIYQQfk3CjBBCCCH8WsCvmi2EECIwrFixgh9//JE2bdpw7bXXal2O8CGKqqqq1kVUpcLCQqKioigoKCAyMlLrcoQQQlwCVVXp06cPDocDgKVLl2I2mzWuSlSli/n+lsNMIqCoqkpWVhYul0vrUoQQlaisrMwbZACKi4s1rEb4Ggk
2024-05-08 08:48:17 +02:00
"text/plain": [
"<Figure size 640x480 with 1 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"ax = sns.violinplot(X, x='sex', y='age')\n",
"ax.set_xticklabels(['male', 'female'])\n",
"plt.title('Age distribution')\n",
"plt.show()"
]
},
{
"cell_type": "code",
2024-06-11 17:22:38 +02:00
"execution_count": 5,
2024-05-08 08:48:17 +02:00
"id": "522ff499-cd7f-4417-ae7d-d637402505b8",
"metadata": {
"tags": []
},
"outputs": [
2024-06-11 17:22:38 +02:00
{
"name": "stderr",
"output_type": "stream",
"text": [
"C:\\Users\\maxwi\\anaconda3\\Lib\\site-packages\\seaborn\\_oldcore.py:1119: FutureWarning: use_inf_as_na option is deprecated and will be removed in a future version. Convert inf values to NaN before operating instead.\n",
" with pd.option_context('mode.use_inf_as_na', True):\n"
]
},
2024-05-08 08:48:17 +02:00
{
"data": {
2024-06-11 17:22:38 +02:00
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAjMAAAHFCAYAAAAHcXhbAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjguMCwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy81sbWrAAAACXBIWXMAAA9hAAAPYQGoP6dpAAA/WUlEQVR4nO3deXQUZb7/8U+TpbOQBEIgnQBZkLAIBBQQAyogAgOIojJzFVAQ9SIgMwyOKKISuAwoKoID4oEZAWdk8P4UUBFZZIlLBFkFMTDIBIKaGMOWQELW5/cHNz20YU+H7krer3P6nHTV09/6VleAD9VPddmMMUYAAAAWVcvTDQAAAFQGYQYAAFgaYQYAAFgaYQYAAFgaYQYAAFgaYQYAAFgaYQYAAFgaYQYAAFgaYQYAAFgaYQZwk927d+vhhx9WfHy8AgICVLt2bd14442aMWOGjh075hwXFxenO++8023bPXTokGw2mxYtWuS2mudKTU1VcnKyTpw4USX1L1dcXJyGDRt21a+32WxKTk52Pl+0aJFsNpsOHTp0RXWmTZumFStWXNFrzretbt26qXXr1ldU51JWrVrlso/nquz7B3gzwgzgBgsWLFD79u21detWPfXUU1q9erWWL1+u3/72t3rzzTf1yCOPeLrFq5aamqrJkyd7PMy4W79+/fTVV18pKirqil53NWHmard1pVatWqXJkyefd93y5cv1/PPPV+n2AU/x9XQDgNV99dVXGjlypHr27KkVK1bIbrc71/Xs2VNPPvmkVq9e7cEOvVN+fr6CgoI8tv369eurfv36VbqNgoICBQQEXJNtXcoNN9zg0e0DVYkzM0AlTZs2TTabTfPnz3cJMuX8/f111113VVi+evVq3XjjjQoMDFSLFi301ltvVRjz7bff6u6771bdunUVEBCgdu3aafHixZfV14EDBzRo0CA1aNBAdrtdLVu21Ny5c13GlJWVaerUqWrevLkCAwNVp04dJSYmavbs2ZKk5ORkPfXUU5Kk+Ph42Ww22Ww2bdq0yVnj3XffVVJSkoKDg1W7dm317t1bO3fudNnOsGHDVLt2be3Zs0e9evVSSEiIevToIUk6duyYRo0apYYNG8rf319NmjTRxIkTVVhYeFn7+Wu5ubl67LHHVK9ePdWuXVu/+c1v9K9//avCuPN99LNz507deeedzvcsOjpa/fr10w8//CDp7EdVp0+f1uLFi53vRbdu3VzqrV27VsOHD1f9+vUVFBSkwsLCi36k9fnnn+vmm29WYGCgGjZsqOeff16lpaXO9Zs2barwnksVP14cNmyY8/iW93buNs/3MVNGRoaGDBni8jvy6quvqqysrMJ2XnnlFc2cOVPx8fGqXbu2kpKStHnz5ss4IkDV48wMUAmlpaXasGGD2rdvr8aNG1/267755hs9+eSTeuaZZxQZGam//vWveuSRR9S0aVPddtttkqT9+/erc+fOatCggV5//XXVq1dP//jHPzRs2DD9/PPPGj9+/AXrf/fdd+rcubNiYmL06quvyuFwaM2aNfr973+vnJwcTZo0SZI0Y8YMJScn67nnntNtt92m4uJi7du3z/mR0qOPPqpjx47pL3/5i5YtW+b8mOT666+XdDbIPffcc3r44Yf13HPPqaioSC+//LJuvfVWff31185xklRUVKS77rpLI0aM0DPPPKOSkhKdOXNG3bt318GDBzV58mQlJibq888/1/Tp07Vr1y59/PHHV3Q8jDEaMGCAUlNT9cILL6hjx4768ssv1adPn0u+9vTp0+rZs6fi4+M1d+5cRUZGKisrSxs3blReXp6ks2fhbr/9dnXv3t35kU1oaKhLneHDh6tfv376+9//rtOnT8vPz++C28zKytL999+vZ555RlOmTNHHH3+sqVOn6vjx45ozZ84V7fvzzz+v06dP67333tNXX33lXH6hj7Z++eUXde7cWUVFRfqf//kfxcXFaeXKlfrTn/6kgwcP6o033nAZP3fuXLVo0UKzZs1ybq9v375KT09XWFjYFfUKuJ0BcNWysrKMJHP//fdf9mtiY2NNQECAOXz4sHNZQUGBCQ8PNyNGjHAuu//++43dbjcZGRkur+/Tp48JCgoyJ06cMMYYk56ebiSZhQsXOsf07t3bNGrUyJw8edLltU888YQJCAgwx44dM8YYc+edd5p27dpdtN+XX37ZSDLp6ekuyzMyMoyvr68ZM2aMy/K8vDzjcDjM7373O+eyoUOHGknmrbfechn75ptvGknmf//3f12Wv/TSS0aSWbt2rXNZbGysGTp06EV7/eSTT4wkM3v2bJflf/7zn40kM2nSJOeyhQsXuuzXtm3bjCSzYsWKi24jODj4vH2U13vooYcuuO7c97Br165Gkvnggw9cxj722GOmVq1azt+PjRs3Gklm48aNLuPOd9xHjx5tLvTX+q/fv2eeecZIMlu2bHEZN3LkSGOz2cz+/ftdttOmTRtTUlLiHPf1118bSeaf//znebcHXEt8zAR4QLt27RQTE+N8HhAQoGbNmunw4cPOZRs2bFCPHj0qnPEZNmyY8vPzXf73fa4zZ85o/fr1uueeexQUFKSSkhLno2/fvjpz5ozz44GbbrpJ33zzjUaNGqU1a9YoNzf3svdhzZo1Kikp0UMPPeSyjYCAAHXt2rXCxyKSdN9997k837Bhg4KDgzVw4MAK+yhJ69evv+x+JGnjxo2SpMGDB7ssHzRo0CVf27RpU9WtW1dPP/203nzzTX333XdXtO1yv97HiwkJCanwEeSgQYNUVlamzz777Kq2f7k2bNig66+/XjfddJPL8mHDhskYow0bNrgs79evn3x8fJzPExMTJcnldxbwFMIMUAkREREKCgpSenr6Fb2uXr16FZbZ7XYVFBQ4nx89evS8HxFER0c715/P0aNHVVJSor/85S/y8/NzefTt21eSlJOTI0maMGGCXnnlFW3evFl9+vRRvXr11KNHD23btu2S+/Dzzz9Lkjp27FhhO++++65zG+WCgoIqfCRz9OhRORwO2Ww2l+UNGjSQr6/vBffxQo4ePSpfX98K76/D4bjka8PCwpSSkqJ27drp2WefVatWrRQdHa1JkyapuLj4snu4kiuWIiMjKywr7/VK9/1KXenv16/f0/L5Yef+zgKewpwZoBJ8fHzUo0cPffLJJ/rhhx/UqFEjt9WuV6+eMjMzKyz/6aefJJ0NUudTt25d+fj46MEHH9To0aPPOyY+Pl6S5Ovrq3HjxmncuHE6ceKEPv30Uz377LPq3bu3jhw5ctGrjcq3/9577yk2NvaS+/PrwCKd3cctW7bIGOOyPjs7WyUlJRfcxwupV6+eSkpKdPToUZd/fLOysi7r9W3atNHSpUtljNHu3bu1aNEiTZkyRYGBgXrmmWcuq8b59vNCygPhucp7Le8/ICBAkipMiP51WLxSV/v7BXgjzswAlTRhwgQZY/TYY4+pqKiowvri4mJ99NFHV1y3R48e2rBhg/Mfl3Jvv/22goKCdPPNN5/3dUFBQerevbt27typxMREdejQocLjfGeG6tSpo4EDB2r06NE6duyY8yqYC/0PvHfv3vL19dXBgwfPu40OHTpc1j6eOnWqwve2vP322871V6J79+6SpHfeecdl+ZIlS66ojs1mU9u2bfXaa6+pTp062rFjh3Pdr8+gVUZeXp4+/PDDCr3WqlXLORE8Li5O0tkvZTzXr19X3pt0eWdLevTooe+++85l36Sz773NZnO+l4AVcGYGqKSkpCTNmzdPo0aNUvv27TVy5Ei1atVKxcXF2rlzp+bPn6/WrVurf//+V1R30qRJWrlypbp3764XXnhB4eHheuedd/Txxx9rxowZF72CZPbs2brlllt06623auTIkYqLi1NeXp6+//57ffTRR875EP3791fr1q3VoUMH1a9fX4cPH9asWbMUGxurhIQESWfPVpTXHDp0qPz8/NS8eXPFxcVpypQpmjhxov7973/rN7/5jerWrauff/5ZX3/9tYKDgy/4BW7lHnroIc2dO1dDhw7VoUOH1KZNG33xxReaNm2a+vbtqzvuuOOK3rN
2024-05-08 08:48:17 +02:00
"text/plain": [
"<Figure size 640x480 with 1 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
2024-06-11 17:22:38 +02:00
"sns.histplot(data=df, x='chol', hue='goal', multiple='stack')\n",
2024-06-07 20:52:07 +02:00
"plt.xlabel('Cholesterol')\n",
2024-06-11 17:22:38 +02:00
"plt.ylabel('n')\n",
2024-06-07 20:52:07 +02:00
"plt.title('Cholesterol distribution')\n",
2024-06-11 17:22:38 +02:00
"plt.legend(['sick', 'healthy'])\n",
"\n",
"upper_limit_chol = 200\n",
"plt.axvline(x=upper_limit_chol, color='red')\n",
2024-05-08 08:48:17 +02:00
"plt.show()"
]
},
2024-06-11 17:22:38 +02:00
{
"cell_type": "markdown",
"id": "82dbc7a2-bdfd-46d6-88a3-b652b06a1cf1",
"metadata": {},
"source": [
"Der Plot zeigt die Cholesterinverteilung der kranken und gesunden Probanden. Deutlich zu erkennen ist, dass die meisten Probanden einen erhöhten Cholesterinwert (>200) aufweisen."
]
},
2024-05-08 08:48:17 +02:00
{
"cell_type": "code",
2024-06-11 17:22:38 +02:00
"execution_count": 6,
2024-05-08 08:48:17 +02:00
"id": "f220fadf-33ec-4bf6-a225-a2c874f02088",
"metadata": {
"tags": []
},
"outputs": [
2024-06-11 17:22:38 +02:00
{
"name": "stderr",
"output_type": "stream",
"text": [
"C:\\Users\\maxwi\\anaconda3\\Lib\\site-packages\\seaborn\\_oldcore.py:1119: FutureWarning: use_inf_as_na option is deprecated and will be removed in a future version. Convert inf values to NaN before operating instead.\n",
" with pd.option_context('mode.use_inf_as_na', True):\n"
]
},
2024-05-08 08:48:17 +02:00
{
"data": {
2024-06-11 17:22:38 +02:00
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAjMAAAHFCAYAAAAHcXhbAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjguMCwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy81sbWrAAAACXBIWXMAAA9hAAAPYQGoP6dpAABGDUlEQVR4nO3deVjU5f7/8deIMAwKuCCbitgRl9yoLNdyS03LbDnnWLZoVl9zqWN+SzMrsePRsjL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zpyRMUa//fabXnvtNeXk5GjQoEEXfN3u3bvVqVMnhYaG6q233lLdunX14YcfasiQIfrtt980duxYSdLvv/+uTp066fTp0/rrX/+q6OhoLV26VM8884z27dun2bNnSzr7V/mtt96qI0eOaOrUqWratKmWLVumgQMHXtL7efTRR9WrVy8tXLhQBw8e1AsvvKBu3bpp+/btqlWrlrNdamqqHnzwQY0dO1ZTpkxRtWrVlJubq65du+rQoUN6/vnn1aZNG/3888966aWXtGPHDq1atUo2m03ff/+9Bg4cqIEDByouLk7+/v46cOCAvvnmG2f/06ZNU1xcnF544QXdcsstKigo0K5du3TixIlLej/nWrJkidavX6+XXnpJ4eHhCg0N1S+//KJOnTopKipKb7zxhsLDw/X111/rqaeeUkZGhiZOnFhmf8YY3XXXXUpMTNRLL72kG2+8Ud9995369u170VpycnLUq1cvNW7cWG+//bbCwsKUlpamNWvWKCsrS5L0/fffq0ePHurevbtzl01QUJBLP0OHDtXtt9+uf/zjH8rJyblgiE5LS9N9992n5557Ti+//LKWLVumyZMn6/jx45o1a1Z5ptDpxRdfVE5Ojj777DN9//33zuVl7doq7+e42Ntvv63mzZtrxowZzvH69eun5ORkBQcHX1KtQKkMADN//nwjqcTDbreb2bNnl2gvyUycONH5/L777jN2u92kpKS4tOvbt68JCAgwJ06cMMYY89xzzxlJZuPGjS7thg8fbmw2m9m9e7cxxpg5c+YYSeZf//qXS7vHH3/cSDLz588v1/u5++67XZZ/9913RpKZPHmyc1nXrl2NJLN69WqXtlOnTjXVqlUzmzZtcln+2WefGUlm+fLlxhhjXn/9dSPJ+R5Lc8cdd5jY2NgL1jx48GDTqFGjEssnTpxozv+vSpIJDg42x44dc1nep08f06BBA3Py5EmX5aNGjTL+/v4l2p/rq6++MpLMzJkzXZb/7W9/K/H7Lp7f5ORkY4wxmzdvNpLMkiVLLvgea9SoYQYPHlxieXF/Dz/8cJnriscy5r+/s9I+H9WqVTMHDhwwxhizZs0aI8msWbPGpV1ycnKJz9HIkSNLzHOxRo0audRd3s9x8TitW7c2Z86ccbb74YcfjCTz8ccflzoecKnYzQSc44MPPtCmTZu0adMmffXVVxo8eLBGjhx50b90v/nmG/Xs2VMNGzZ0WT5kyBDl5uY6/9r95ptvdO211+qmm24q0c4Y49yasWbNGgUGBurOO+90aXexLUTne+CBB1yed+rUSY0aNdKaNWtclteuXVs9evRwWbZ06VK1atVKsbGxOnPmjPPRp08fl10XN954oyTpz3/+s/7v//5Phw8fLlHHTTfdpB9//FEjRozQ119/rczMzEt6H6Xp0aOHateu7Xx+6tQprV69WnfffbcCAgJcau7Xr59OnTp1wV0bxXNy/pyVZ86bNGmi2rVra9y4cXrnnXf0yy+/XNZ7uvfee8vdtqzPR1FRkdatW3dZ45dXeT/HxW6//Xb5+Pg4n7dp00aSdODAAbfWiasHYQY4R4sWLdSuXTu1a9dOt912m/7f//t/6t27t8aOHXvBXSJHjx4tdZN8ZGSkc/2ltgsLCyvRLjw8/JLeT2ntw8PDneMUK62m3377Tdu3b5evr6/LIzAwUMYYZWRkSJJuueUWLVmyRGfOnNHDDz+sBg0aqFWrVvr444+dfY0fP16vv/66NmzYoL59+6pu3brq2bOnNm/efEnv50I1Hz16VGfOnNHf//73EjX369dPkpw1l+bo0aOqXr266tat67K8PHMeHByshIQExcbG6vnnn1fLli0VGRmpiRMnqqCg4LLf04Vc6PNx/u+3opX3c1zs/Dm12+2Szu5OBSoCx8wAF9GmTRt9/fXX2rNnT4m/RIvVrVtXqampJZYfOXJEkhQSEnLJ7X744YcS7cp7APCF2qelpalJkyYuy84/wLa4FofDoffee6/UvotrlaQBAwZowIABys/P14YNGzR16lQNGjRI0dHR6tixo6pXr64xY8ZozJgxOnHihFatWqXnn39effr00cGDBxUQECB/f3/l5+eXGKesAHJ+zbVr15aPj48eeughjRw5stTXNG7cuNTl0tk5P3PmjI4ePery5VveOW/durU++eQTGWO0fft2LViwQC+//LIcDoeee+65cvVR2u+hLL/99luJZcW1Ftfv7+8vSSXm9UKhrjzK+zkGKgtbZoCLSEpKkqQLnh7bs2dPffPNN87/zIt98MEHCggIUIcOHZztfvnlF23durVEO5vNpu7du0uSunfvrqysLH3xxRcu7RYuXHhJtX/00UcuzxMTE3XgwAHnWTQXcscdd2jfvn2qW7euc2vVuY/Szjyy2+3q2rWrXn31VUlnz/A5X61atfTHP/5RI0eO1LFjx1zOmElPT3f5kj59+rS+/vrrcr3XgIAAde/eXdu2bVObNm1Krfn8LQTnKp778+fsUufcZrOpbdu2evPNN1WrVi2X37Xdbq+wrRFlfT6qVaumW265RZKcv6Pt27e7tDv/dcW1SeXbWlLezzFQWdgyA5zjp59+0pkzZySd3VS+aNEixcfH6+67777gX/UTJ07U0qVL1b17d7300kuqU6eOPvroIy1btkzTpk1znrHx9NNP64MPPtDtt9+ul19+WY0aNdKyZcs0e/Z
2024-05-08 08:48:17 +02:00
"text/plain": [
"<Figure size 640x480 with 1 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
2024-06-11 17:22:38 +02:00
"sns.histplot(data=df, x='trestbps', hue='goal', multiple='stack')\n",
2024-05-08 08:48:17 +02:00
"plt.xlabel('Blood pressure (rest)')\n",
2024-06-11 17:22:38 +02:00
"plt.ylabel('n')\n",
2024-05-08 08:48:17 +02:00
"plt.title('Blood pressure distribution')\n",
2024-06-11 17:22:38 +02:00
"plt.legend(['sick', 'healthy'])\n",
"\n",
"upper_limit_bp = 140\n",
"plt.axvline(x=upper_limit_bp, color='red')\n",
2024-05-08 08:48:17 +02:00
"plt.show()"
]
},
2024-06-11 17:22:38 +02:00
{
"cell_type": "markdown",
"id": "9d6e7a47-bc78-46b9-9550-13b2bde97aba",
"metadata": {},
"source": [
"Wie in der Grafik zu erkennen, haben die meisten Probanden einen unauffälligen Blutdruck von unter 140mmHg (systolisch). \n",
"Bei den Probanden mit Hypertonus (>140mmHg) ist die relative Häufigkeit an Herzkreislauferkrankungen deutlich erhöht."
]
},
2024-05-08 08:48:17 +02:00
{
"cell_type": "code",
2024-06-11 17:22:38 +02:00
"execution_count": 19,
2024-06-07 15:16:29 +02:00
"id": "abe0020f-8588-48bf-af58-f67b326cdd25",
"metadata": {},
2024-05-08 08:48:17 +02:00
"outputs": [
{
"data": {
2024-06-11 17:22:38 +02:00
"image/png": "iVBORw0KGgoAAAANSUhEUgAAArcAAAIhCAYAAABUopIpAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjguMCwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy81sbWrAAAACXBIWXMAAA9hAAAPYQGoP6dpAABHrklEQVR4nO3de1hU5cL+8XvJWQXkoBACamWWIVqeisxzKiaWuYNCy9xWblELj2WWutslHT2kb7UzyzLNt51pZZqH0tKwRM007bVyo0CKJiqIchLW748u57dnozajA4OL7+e65rqYZz2zuBfm8m6x5hnDNE1TAAAAgAXUcXcAAAAAwFUotwAAALAMyi0AAAAsg3ILAAAAy6DcAgAAwDIotwAAALAMyi0AAAAsg3ILAAAAy6DcAgAAwDIotwBqjAULFsgwDLtHw4YN1bVrV61YsaLSfMMwNG3atGrPuX//fhmGoQULFlT7965NXnnlFYWEhOjMmTPujgLgMkK5BVDjvP3229q8ebPS09P1xhtvyMPDQwkJCfr000/dHQ3VaOnSpbrjjjvk6enp7igALiOcMQDUODExMWrXrp3teZ8+fRQUFKT3339fCQkJbkxWvU6fPq26deu6O4bDTNNUcXGx/Pz8Lnlfhw8f1qZNmzRx4kQXJANQm3DlFkCN5+vrK29vb3l5ef3p3B9//FF33HGHgoKC5OvrqzZt2uidd96pNC8rK0uDBw9Wo0aN5OPjo+uuu04vv/yyKioq7OYdPHhQiYmJ8vf3V2BgoJKSkpSbm+tQ7rO3Waxdu1ZDhw5VcHCw6tWrp4SEBP373/+2m9u1a1fFxMTo66+/VlxcnOrWrau//vWvkqSCggKNHz9ezZo1k7e3txo3bqzU1FSdOnXKbh//+te/1LFjRwUGBqpu3bq68sorbfuQpIqKCj3zzDNq0aKF/Pz81KBBA8XGxmr27Nm2OQ888ICaNm1a6VimTZsmwzDsxgzD0KhRo/T666/ruuuuk4+Pj+1n/csvvyg5Odnu5/s///M/Dv3cJGnZsmWqX7++evbsecF5r732mlq3bq369evL399f1157rZ544gm7Obm5uRo+fLgiIyPl7e2tZs2a6e9//7vtdgfTNNW3b1+FhIQoKyvL9rrTp0/r+uuv13XXXVfpZw2g5uLKLYAap7y8XGfOnJFpmjp8+LBefPFFnTp1SsnJyRd83d69exUXF6dGjRrZ7td877339MADD+jw4cO2q4C///674uLiVFpaqn/84x9q2rSpVqxYofHjx2vfvn169dVXJUlFRUXq2bOnDh48qLS0NF1zzTX67LPPlJSU5NTxDBs2TLfddpsWL16s7OxsPfnkk+ratat27typBg0a2OYdOnRIgwcP1sSJEzV9+nTVqVNHp0+fVpcuXZSTk6MnnnhCsbGx2r17t6ZMmaJdu3Zp3bp1MgxDmzdvVlJSkpKSkjRt2jT5+vrqwIED+vLLL237f+GFFzRt2jQ9+eST6ty5s8rKyvR///d/OnHihFPH85+WL1+ujRs3asqUKQoPD1ejRo20Z88excXFKTo6Wi+//LLCw8O1evVqPfLIIzp69KimTp36p/tdunSp+vXrJx8fn/POWbJkiVJSUjR69Gi99NJLqlOnjn799Vft2bPHNic3N1cdOnRQnTp1NGXKFF111VXavHmznnnmGe3fv19vv/22DMPQwoUL1aZNGyUmJmrjxo3y8vJSSkqKMjMz9d1336levXoX/TMCUM1MAKgh3n77bVNSpYePj4/56quvVpovyZw6dart+T333GP6+PiYWVlZdvPi4+PNunXrmidOnDBN0zQff/xxU5L53Xff2c0bMWKEaRiGuXfvXtM0TfO1114zJZkff/yx3byHHnrIlGS+/fbbDh3PgAED7Ma/+eYbU5L5zDPP2Ma6dOliSjK/+OILu7lpaWlmnTp1zIyMDLvxDz/80JRkrly50jRN03zppZdMSbZjPJd+/fqZbdq0uWDmIUOGmE2aNKk0PnXqVPO//8mQZAYGBprHjh2zG+/du7cZGRlp5ufn242PGjXK9PX1rTT/vx09etT09PQ0ly5desF5o0aNMhs0aHDBOcOHDzfr169vHjhwwG787M9r9+7dtrFNmzaZnp6eZmpqqvnWW2+Zksw333zzgvsHUPNwWwKAGufdd99VRkaGMjIytGrVKg0ZMkQjR47U3LlzL/i6L7/8Uj169FBUVJTd+AMPPKDTp09r8+bNtnktW7ZUhw4dKs0zTdN2tXP9+vXy9/dX//797eb92RXk/zZo0CC753FxcWrSpInWr19vNx4UFKTu3bvbja1YsUIxMTFq06aNzpw5Y3v07t1bhmFow4YNkqT27dtLkhITE/XBBx/ot99+q5SjQ4cO+uGHH5SSkqLVq1eroKDAqeM4l+7duysoKMj2vLi4WF988YUGDBigunXr2mXu27eviouL9e23315wnx9//LG8vb3Vp0+fC87r0KGDTpw4oXvvvVcff/yxjh49WmnOihUr1K1bN0VERNhliY+PlyR99dVXtrm33HKLnn32Wc2aNUsjRozQ4MGDNWzYMGd+HABqAMotgBrnuuuuU7t27dSuXTv16dNH//znP9WrVy9NnDjxgr9Cz8vL0xVXXFFpPCIiwrbd2XlhYWGV5oWHhzt1POeaHx4ebvs+Z50r0+HDh7Vz5055eXnZPfz9/WWapq3Qde7cWcuXL9eZM2d0//33KzIyUjExMXr//fdt+5o0aZJeeuklffvtt4qPj1dISIh69OihrVu3OnU8F8qcl5enM2fOaM6cOZUy9+3bV5LOWUL/04cffqj4+Pg/fTPdfffdp7feeksHDhzQwIED1ahRI3Xs2FFr1661zTl8+LA+/fTTSlmuv/76c2YZNGiQvL29VVJSogkTJjj8cwBQc3DPLYDLQmxsrFavXq2ff/650hXXs0JCQnTo0KFK4wcPHpQkhYaGOj1vy5YtleY5+oayC83Pzc3V1VdfbTf232/YOpvFz89Pb7311jn3fTarJN1xxx264447VFJSom+//VZpaWlKTk5W06ZNdfPNN8vT01Njx47V2LFjdeLECa1bt05PPPGEevfurezsbNWtW1e+vr4qKSmp9H3OV0j/O3NQUJA8PDx03333aeTIked8TbNmzc45Lkn5+fn64osvHF5DeOjQoRo6dKhOnTqlr7/+WlOnTlW/fv30888/q0mTJgoNDVVsbKyeffbZc77+7P/QSH/c6z1o0CAFBQXJx8dHw4YN0zfffCNvb2+HsgCoGSi3AC4LO3bskCQ1bNjwvHN69OihZcuW6eDBg3al5d1331XdunV100032ealpaVp+/btuvHGG+3mGYahbt26SZK6deumDz74QJ988ondrQmLFy92KvuiRYs0cOBA2/P09HQdOHBADz744J++tl+/fpo+fbpCQkIuWAr/k4+Pj7p06aIGDRpo9erV+v7773XzzTfbzWnQoIH+8pe/6LffflNqaqr279+vli1bqmnTpjpy5IgOHz5su2pdWlqq1atXO/S969atq27duun7779XbGys08Xw008/lWEY6tevn1Ovq1evnuLj41VaWqo777xTu3fvVpMmTdSvXz+tXLlSV111ld3tE+cydepUbdy4UWvWrFG9evXUuXNnTZgwwW41CQA1H+UWQI3z448/2pZpysvL00cffaS1a9dqwIABFyx4U6dOtd1jOWXKFAUHB2vRokX67LPP9MILLygwMFCSNGbMGL377ru6/fbb9fTTT6tJkyb67LPP9Oqrr2rEiBG65pprJEn333+/Zs6cqfvvv1/PPvusmjdvrpUrVzpc9M7aunWrHnzwQd19993Kzs7W5MmT1bhxY6WkpPzpa1NTU7V06VJ17txZY8aMUWxsrCoqKpSVlaU1a9Zo3Lhx6tixo6ZMmaKcnBz16NFDkZGROnHihGbPni0vLy916dJFkpSQkGBbQ7hhw4Y6cOCAZs2apSZNmqh58+aSpKSkJE2ZMkX33HOPJkyYoOLiYr3yyisqLy93+Hhnz56tTp066dZbb9WIESPUtGlTnTx5Ur/++qs
2024-05-08 08:48:17 +02:00
"text/plain": [
2024-06-07 15:16:29 +02:00
"<Figure size 800x600 with 1 Axes>"
2024-05-08 08:48:17 +02:00
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
2024-06-07 15:16:29 +02:00
"plt.figure(figsize=(8, 6))\n",
"sns.boxplot(x='sex', y='trestbps', data=df)\n",
2024-06-07 20:52:07 +02:00
"plt.title('Blood pressure / sex')\n",
2024-06-11 17:22:38 +02:00
"plt.xlabel('Sex')\n",
2024-05-08 08:48:17 +02:00
"plt.ylabel('Blood pressure (rest)')\n",
"plt.show()"
]
},
{
"cell_type": "code",
2024-06-11 17:22:38 +02:00
"execution_count": 8,
2024-05-08 08:48:17 +02:00
"id": "5c174a9d-59b7-4efe-a0eb-a132388c1d2a",
"metadata": {
"tags": []
},
"outputs": [
{
"data": {
2024-06-11 17:22:38 +02:00
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAjsAAAHFCAYAAAAUpjivAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjguMCwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy81sbWrAAAACXBIWXMAAA9hAAAPYQGoP6dpAADo8ElEQVR4nOzdd3hUZfbA8e/0STKT3iuh995RqoioWLBRFsGu2FDcte0qrv50rYtr72DFjqKCiBSV3qX3GtJ7m35/f1wyYchMSCAQiOfzPHkk971z7ztjkjnzlnM0iqIoCCGEEEI0UdrG7oAQQgghxOkkwY4QQgghmjQJdoQQQgjRpEmwI4QQQogmTYIdIYQQQjRpEuwIIYQQokmTYEcIIYQQTZoEO0IIIYRo0iTYEUIIIUSTJsGOEI3ozz//5IYbbiA9PR2z2YzFYqF79+4899xzFBQUeM9r1qwZl156aYPdd//+/Wg0GmbMmFHnx4wePZrLL7+8Tud+//33aDQaoqKisNvtJ9nLs8+0adPQaDQ+xwYPHszgwYO931dUVDBt2jQWL15cp2suXrwYjUbDV1991YA9FUIcS9/YHRDir+qdd95h8uTJtGnThr///e+0b98ep9PJmjVrePPNN1m+fDnffvttY3cTgPLycubNm8ebb75Zp/Pfe+89AAoKCpg9ezbXXXfd6exeo3r99dd9vq+oqOCJJ54A8AmChBCNR4IdIRrB8uXLueOOOxg+fDizZ8/GZDJ524YPH87UqVOZN29eI/bQ108//YTL5WLUqFEnPDcrK4uffvqJoUOHsmzZMt57770mHey0b9++sbsghDgBmcYSohE8/fTTaDQa3n77bZ9Ap4rRaOSyyy6rcXzevHl0796doKAg2rZty/vvv1/jnM2bN3P55ZcTERGB2Wyma9euz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yy7Hb7axYsYJnnnmGcePG0axZM/r16xfw3lXH/AWZp0Nd73/vvffy0Ucf8d133zFv3jzCw8MZP378Ca8fHR3N9OnTmT59OgcPHuT777/noYceIicnh3nz5nl/Nl555RX69u3r9xrHBqObN2/mscceo1evXqxevZqXXnqJ+++/vz5PWYgzRkZ2hGgEDz/8MIqicMstt+BwOGq0V42o1NewYcNYuHBhjV05H374IcHBwQHfxAL5+uuv6du3L0lJSSc897333sNqtfLrr7+yaNEin6/nn38eu93OJ598AsCgQYMAdbThWLNmzfL5Pjg4mCFDhrB+/Xo6d+5Mz549a3zVNRgxmUwMGjSIZ599FqDGTqvPPvsMRVG83x84cIBly5bVO1dO1e66Y0fc6qKu9+/Rowf9+/fn2Wef5ZNPPmHSpEmEhITU616pqancddddDB8+nHXr1gEwYMAAwsPD2bp1q9/XuWfPnhiNRkDNu3TNNdfQrFkzFi1axF133cVDDz3EypUr69UPIc4UGdkRohH069ePN954g8mTJ9OjRw/uuOMOOnTogNPpZP369bz99tt07NixTnltjvX444/zww8/MGTIEB577DEiIyP55JNP+PHHH3nuuecICwur87XcbjffffcdDz300AnP3bx5M6tWreKOO+5g6NChNdoHDBjAiy++yHvvvcddd93FRRddxIABA5g6dSolJSX06NGD5cuX8+GHHwKg1VZ/Dnv55Zc577zzOP/887njjjto1qwZpaWl7N69mzlz5rBw4cKA/Xrsscc4fPgww4YNIzk5maKiIl5++WUMBoM34KqSk5PDlVdeyS233EJxcTGPP/44ZrOZhx9+uK4vGQBWq5W0tDS+++47hg0bRmRkJNHR0TRr1qzWx9Xn/vfeey/XXXcdGo2GyZMnn7BPxcXFDBkyhHHjxtG2bVu
2024-05-08 08:48:17 +02:00
"text/plain": [
"<Figure size 640x480 with 1 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"from sklearn.linear_model import LinearRegression\n",
"\n",
"model = LinearRegression()\n",
"x = np.array(X['age'])\n",
"x = x[:, np.newaxis]\n",
"reg = model.fit(x, X['chol'])\n",
"pred = reg.predict(x)\n",
"\n",
"sns.scatterplot(X, x='age', y='chol', hue='sex')\n",
"plt.plot(x, pred, color='black')\n",
"plt.xlabel('Age')\n",
"plt.ylabel('Chol')\n",
2024-06-07 11:20:34 +02:00
"plt.title('Chol / Age split by sex')\n",
"plt.show()"
2024-05-08 08:48:17 +02:00
]
},
2024-06-11 17:22:38 +02:00
{
"cell_type": "markdown",
"id": "e28e7c0f-c8ab-4afc-a1ae-b164397f108b",
"metadata": {},
"source": [
"Diese Grafik zeigt das Alter der Probanden im Verhältnis zu ihrem Cholesteringehalt aufgeteilt nach dem Geschlecht.\n",
"Deutlich zu erkennen ist der Anstieg von Cholesterin bei zunehmenden Alter."
]
},
2024-05-08 08:48:17 +02:00
{
"cell_type": "code",
2024-06-11 17:22:38 +02:00
"execution_count": 18,
2024-05-08 08:48:17 +02:00
"id": "b3d627cf-3ec9-4cd9-bee6-5baeb9d1a22d",
"metadata": {
"tags": []
},
"outputs": [
{
"data": {
2024-06-11 17:22:38 +02:00
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAjsAAAHFCAYAAAAUpjivAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjguMCwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy81sbWrAAAACXBIWXMAAA9hAAAPYQGoP6dpAADdv0lEQVR4nOzdd3iT5frA8W929950s6HsPcsuIENBQHAAoh4RByg4zs95HBxxiyKIRxAVFygKMmUje4nsWSjQvds0+/39EQmEJKWFbp7PdeXSPM+b970zaO48UyZJkoQgCIIgCEIdJa/uAARBEARBECqTSHYEQRAEQajTRLIjCIIgCEKdJpIdQRAEQRDqNJHsCIIgCIJQp4lkRxAEQRCEOk0kO4IgCIIg1Gki2REEQRAEoU4TyY4gCIIgCHWaSHaEWm3hwoXIZDK7W3BwML169WLFihUOx8tkMl599dUqjzM5ORmZTMbChQur/Nq3k48//pjAwEBMJlOpxxUUFPDmm2/Svn17fHx80Gg0xMbG8uCDD7J//37bca+++ioymYysrKwKi7FXr1706tWrws5XFlf+nSQnJ9vKJkyYQGxsrN1xb731FsuWLSvTOa98pt99992KC1QQKolIdoQ6YcGCBezYsYPt27fz+eefo1AoGDp0KMuXL6/u0IQqtHTpUoYPH45SqXR5zJkzZ2jTpg3//e9/6d27N9999x1r167ltddeIz09nXbt2pGfn1+FUVePl156iV9++cWurDzJjiDUJq7/IghCLZKQkED79u1t9wcOHIi/vz/fffcdQ4cOrcbIqpZWq8XDw6O6wygzSZLQ6XS4u7vf8rnS09PZtm0bzz77rMtjzGYzd911F1lZWezYsYOEhARbXWJiIuPHj2fVqlWoVKpbjqemq1+/fnWHIAhVRrTsCHWSm5sbarW6TF9ahw8fZvjw4fj7++Pm5kbr1q356quvHI67cOEC9913HyEhIWg0Gpo2bcp7772HxWKxO+7y5cuMHj0ab29vfH19GTNmDGlpaWWK+0p3w7p165g4cSIBAQF4enoydOhQzp49a3dsr169SEhIYMuWLXTt2hUPDw8efPBBwNpNM336dOLi4lCr1dSrV4+pU6dSXFxsd46ffvqJTp064evri4eHB/Hx8bZzAFgsFt544w0aN26Mu7s7fn5+tGzZko8++sh2jLPuELjaBXQtmUzG448/zty5c2natCkajcb2Wp86dYpx48bZvb6ffvppmV43gF9++QUvLy/69evn8phly5bx999/88ILL9glOtcaNGiQQ8KYnp7O2LFj8fX1JTQ0lAcffNCh9Uen0/HCCy/YveZTpkwhLy+vzM/hWhs2bKBXr14EBgbi7u5OdHQ0I0eORKvVAle7kWbNmsWbb75JdHQ0bm5utG/fnvXr19/w/Ne/bzKZjOLiYr766itbl3BZutssFkup19+6dSsymYzvvvvO4bGLFi1CJpOxZ88el+fXarW2z7KbmxsBAQG0b9/e4Xx79+5l2LBhBAQE4ObmRps2bfjxxx9t9VlZWURFRdG1a1eMRqOt/OjRo3h6enL//fff8LkKtZdo2RHqBLPZjMlkQpIk0tPTeeeddyguLmbcuHGlPu7EiRN07dqVkJAQ23iPb775hgkTJpCenm5rJcjMzKRr164YDAZef/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X07t2bgIAA7rzzTk6dOgVYP+8A06dPd/j8PPbYY4D950cmkzFhwgR0Oh1hYWFirM5tQiQ7Qp3VsmVLSkpKOHnypMtjAgMDSU1NdSi/fPkyAEFBQeU+7sof32uVdYByacenpaU5fOlePwD4SiwtWrSwtXRdf7syHgNg+PDhrF+/nvz8fDZt2kR
2024-05-08 08:48:17 +02:00
"text/plain": [
"<Figure size 640x480 with 1 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"model = LinearRegression()\n",
"x = np.array(X['chol'])\n",
"x = x[:, np.newaxis]\n",
"reg = model.fit(x, X['trestbps'])\n",
"pred = reg.predict(x)\n",
"\n",
"sns.scatterplot(X, x='chol', y='trestbps', hue='sex')\n",
"plt.plot(x, pred, color='black')\n",
"plt.xlabel('Chol')\n",
"plt.ylabel('Blood pressure (rest)')\n",
2024-06-11 17:22:38 +02:00
"plt.title('Blood pressure / Chol split by sex')\n",
2024-06-07 11:20:34 +02:00
"plt.show()"
2024-05-08 08:48:17 +02:00
]
},
{
"cell_type": "code",
2024-06-11 17:22:38 +02:00
"execution_count": null,
"id": "027c0554-8f2b-47a4-8dc6-97fe492a3590",
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": 10,
2024-05-08 08:48:17 +02:00
"id": "3a6dc91a-f3e9-4d7e-9e4b-58c59d24463c",
"metadata": {
"tags": []
},
"outputs": [
{
"data": {
2024-06-11 17:22:38 +02:00
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAjoAAAHNCAYAAAAXN9H8AAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjguMCwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy81sbWrAAAACXBIWXMAAA9hAAAPYQGoP6dpAABzGklEQVR4nO3dd1gU1/s28HtpS0cFKSpSBBUUKxawRwVL1GgSjRrU2GMHEeVLsBtiB000sUVNTNTEEmMMil1EjSCoUWwokkSwi5228/7hy/5cgbXNMOx6f3LNd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XMMGzYMiYmJYnwKJXpnEh0iIiLSrrjTAHJycorUy83NRVJSEgICAjTKAwICkJCQUOy9/f398e+//2LHjh0QBAHXr1/Hr7/+is6dO0vyLIWY6BAREekyEXt0ijsNICoqqkjIW7duoaCgAA4ODhrlDg4OyMrKKraZ/v7+WLduHXr16gUTExM4OjqiXLlyWLx4sSQfSyEmOkRERLpMxDk6xZ0GEB4eXmLoF08WEAShxNMGzp49izFjxmDy5MlISkpCbGwsrly5orEFjBT0bnk5ERERvRmlUgmlUvnSenZ2djA0NCzSe3Pjxo0ivTyFoqKi0KxZM0yYMAEAUKdOHVhYWKBFixaYOXMmnJyc3v4BisEeHSIiIl0mw2RkExMTNGzYEHFxcRrlcXFx8Pf3L/Y9jx8/hoGBZtphaPjsSCVBEF7zoV8de3SIiIh0mUw7I4eEhCAoKAi+vr7w8/PDsmXLkJGRoR6
2024-05-08 08:48:17 +02:00
"text/plain": [
"<Figure size 640x480 with 2 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
2024-06-07 15:16:29 +02:00
"corr = df.loc[:,df.columns!='sex'].corr()\n",
2024-05-08 08:48:17 +02:00
"\n",
2024-06-07 11:20:34 +02:00
"sns.heatmap(corr)\n",
"plt.show()"
2024-05-08 08:48:17 +02:00
]
2024-06-07 15:16:29 +02:00
},
{
"cell_type": "markdown",
"id": "038d8abb-e88f-472d-95c4-bc0c51695196",
"metadata": {},
"source": [
2024-06-07 20:52:07 +02:00
"#### Cholesterinwerte im Vergleich Frauen/Männer"
2024-06-07 15:16:29 +02:00
]
},
{
"cell_type": "code",
2024-06-11 17:22:38 +02:00
"execution_count": 11,
2024-06-07 15:16:29 +02:00
"id": "48e6d986-b7f9-45e6-8bf2-32e687eb132d",
"metadata": {},
"outputs": [
{
"data": {
2024-06-11 17:22:38 +02:00
"image/png": "iVBORw0KGgoAAAANSUhEUgAAArcAAAIhCAYAAABUopIpAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjguMCwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy81sbWrAAAACXBIWXMAAA9hAAAPYQGoP6dpAAA9OklEQVR4nO3deXQUVeL+/6fI1tkJQRLCEkEQB8IuMmaQgCwxbIKOKKCCoCIREAEZERV0kAyMAo44+BFEcWHQr4gbhE0QxYAsIiA4jiBL0ITIlgTMAsn9/eHPPrQB7A5JOlTer3P6HPrW7cpTRNvH6ttVljHGCAAAALCBat4OAAAAAJQVyi0AAABsg3ILAAAA26DcAgAAwDYotwAAALANyi0AAABsg3ILAAAA26DcAgAAwDYotwAAALANyi0AW9m5c6fuueceNWjQQA6HQyEhIWrTpo1mzJih48ePO+ddeeWV6tWrV5n93AMHDsiyLL322mtlts9zpaWlacqUKTp58mS57N9dV155pYYMGeL2/H/961+KjIzU2bNnyy8UAJyDcgvANubNm6e2bdtqy5YteuSRR7RixQotXbpUt912m1566SUNGzbM2xFLLS0tTU899ZTXy62nlixZoptvvlm+vr7ejgKgiuDdBoAtbNy4USNGjFC3bt30/vvvKyAgwLmtW7duGjdunFasWOHFhJXTL7/8oqCgoHLZ95EjR7RhwwZNmDChXPYPAOfDmVsAtjBt2jRZlqWXX37Zpdj+xt/fX3369CkxvmLFCrVp00aBgYG65pprtGDBghJzvvnmG918882KiIiQw+FQq1attHDhQrdyff/99xo4cKBq1aqlgIAA/elPf9KLL77oMqe4uFhTp05VkyZNFBgYqOrVq6tFixZ6/vnnJUlTpkzRI488Iklq0KCBLMuSZVn69NNPnft4++23df311ys4OFghISFKTEzU9u3bXX7OkCFDFBISol27dql79+4KDQ1Vly5dJEnHjx9XcnKy6tSpI39/fzVs2FCTJk1SQUGBW8d5PkuXLlVISIi6du160Xlz585Vy5YtFRISotDQUF1zzTV67LHHXOZkZmZq+PDhqlu3rvz9/dWgQQM99dRTzuUOxhj16NFDkZGROnTokPN1v/zyi5o1a6Y//elPOn36dKmPBcDlgzO3AC57RUVFWrt2rdq2bat69eq5/bodO3Zo3LhxevTRRxUVFaX58+dr2LBhatSokTp27ChJ+u677xQfH69atWo514+++eabGjJkiI4cOXLRs5J79uxRfHy86tevr+eee07R0dFauXKlRo8eraNHj2ry5MmSpBkzZmjKlCl6/PHH1bFjR505c0b//e9/nUsQ7r33Xh0/flwvvPCC3nvvPdWuXVuS1LRpU0m/FvvHH39c99xzjx5//HEVFhbqn//8p2644QZt3rzZOU+SCgsL1adPHw0fPlyPPvqozp49q/z8fHXu3Fn79u3TU089pRYtWujzzz9XSkqKvv76ay1btsyj38dvlixZol69ep33fzZ+s3jxYiUnJ2vUqFF69tlnVa1aNe3du1d79uxxzsnMzNR1112natWq6cknn9RVV12ljRs3aurUqTpw4IBeffVVWZalN954Q61atVL//v31+eefy8/PT8nJydq/f7++/PJLBQcHl+o4AFxmDABc5jIzM40kc8cdd7j9mtjYWONwOMzBgwedY3l5eaZGjRpm+PDhzrE77rjDBAQEmEOHDrm8PikpyQQFBZmTJ08aY4zZv3+/kWReffVV55zExERTt25dk52d7fLakSNHGofDYY4fP26MMaZXr16mVatWF837z3/+00gy+/fvdxk/dOiQ8fX1NaNGjXIZz83NNdHR0aZ///7OscGDBxtJZsGCBS5zX3rpJSPJvPPOOy7j06dPN5LMqlWrnGOxsbFm8ODBF81qjDFHjx41vr6+ZsmSJRedN3LkSFO9evWLzhk+fLgJCQlx+V0ZY8yzzz5rJJndu3c7xzZs2GB8fX3NmDFjzIIFC4wkM3/+/D/MC8A+WJYAoMpq1aqV6tev73zucDh09dVX6+DBg86xtWvXqkuXLiXOCA8ZMkS//PKLNm7ceN595+fn65NPPlG/fv0UFBSks2fPOh89evRQfn6+Nm3aJEm67rrrtGPHDiUnJ2vlypXKyclx+xhWrlyps2fP6u6773b5GQ6HQwkJCS5LF35z6623ujxfu3atgoOD9de//rXEMUrSJ5984nae33zwwQfy9/fXTTfddNF51113nU6ePKkBAwbogw8+0NGjR0vM+fjjj9W5c2fFxMS4HGNSUpIkaf369c65f/nLX/TMM89o9uzZGjFihO68887L+ouEADxHuQVw2atZ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ESEjhw5os2bNys4OFhPPfXURY/x7rvv1osvvqjBgwfrwIEDat68uTZs2KBp06apR48ef3gpr99799131a1bN4WGhv7h3Pvuu0+BgYH6y1/+otq1ayszM1MpKSkKDw9Xu3btJElPP/20Vq9erfj4eI0ePVpNmjRRfn6+Dhw4oOXLl+ull15S3bp1tXr1aqWkpOiJJ55wFvKUlBSNHz9enTp1cinuAGzM299oA4Cy9PXXX5vBgweb+vXrG39/fxMcHGxat25tnnzySZOVleWcFxsba3r27Fni9QkJCSYhIcFlbNeuXaZ3794mPDzc+Pv7m5YtW7pcFcGY818t4bfxoUOHmjp16hg/Pz9zxRVXmPj4eDN16lTnnOeee87Ex8ebmjVrGn9/f1O/fn0zbNgwc+DAAZd9TZw40cTExJhq1aoZSWbdunXObe+//77p3LmzCQsLMwEBASY2Ntb89a9/NWvWrHHOGTx4sAkODj7v39uxY8fMAw88YGrXrm18fX1NbGysmThxosnPz3eZ90dXSzh16pRxOBwl/h4uZOHChaZz584mKirK+Pv7m5iYGNO/f3+zc+dOl3k///y
2024-06-07 15:16:29 +02:00
"text/plain": [
"<Figure size 800x600 with 1 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"plt.figure(figsize=(8, 6))\n",
"sns.boxplot(x='sex', y='chol', data=df)\n",
2024-06-07 20:52:07 +02:00
"plt.title('Cholesterol / sex')\n",
"plt.xlabel('Sex')\n",
"plt.ylabel('Cholesterol in mg/dl')\n",
2024-06-07 15:16:29 +02:00
"plt.show()"
]
},
{
"cell_type": "code",
2024-06-11 17:22:38 +02:00
"execution_count": 12,
2024-06-07 15:16:29 +02:00
"id": "3e85fdf6-3a77-41b0-bbc7-a407fbb1374f",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
2024-06-07 20:52:07 +02:00
" Geschlecht Untere Grenze Obere Grenze\n",
2024-06-07 15:16:29 +02:00
"0 Männer 234.288517 246.199046\n",
"1 Frauen 249.044612 275.413721\n"
]
}
],
"source": [
2024-06-07 20:52:07 +02:00
"# confidence interval (95%) for cholesterol level of men/women\n",
2024-06-07 15:16:29 +02:00
"from scipy import stats\n",
"\n",
2024-06-07 20:52:07 +02:00
"# filter by gender and calculate interval\n",
2024-06-07 15:16:29 +02:00
"conf_level = 0.95\n",
"chol_men = df.loc[df['sex'] == 'male', 'chol']\n",
"chol_women = df.loc[df['sex'] == 'female', 'chol']\n",
"conf_int_men = stats.t.interval(conf_level, len(chol_men) - 1, loc=chol_men.mean(), scale=stats.sem(chol_men))\n",
"conf_int_women = stats.t.interval(conf_level, len(chol_women) - 1, loc=chol_women.mean(), scale=stats.sem(chol_women))\n",
"\n",
"result_table_men_vs_women = pd.DataFrame({\n",
" 'Geschlecht': ['Männer', 'Frauen'],\n",
2024-06-07 20:52:07 +02:00
" 'Untere Grenze': [conf_int_men[0], conf_int_women[0]],\n",
" 'Obere Grenze': [conf_int_men[1], conf_int_women[1]]\n",
2024-06-07 15:16:29 +02:00
"})\n",
"\n",
"print(result_table_men_vs_women)"
]
},
2024-06-07 20:52:07 +02:00
{
"cell_type": "markdown",
"id": "249c97a2-b9dd-4041-ad40-ee3175a394ad",
"metadata": {},
"source": [
"Das 95%-Konfidenzintervall bedeutet, dass der wahre Mittelwert des Cholesterinspiegels mit 95%iger Wahrscheinlichkeit in den angegebenen Intervallen liegt. \n",
"Da sich die Intervalle für Männer und Frauen nicht überlappen, deutet dies auf einen signifikanten Unterschied im durchschnittlichen Cholesterinspiegel zwischen Männern und Frauen hin."
]
},
2024-06-07 15:16:29 +02:00
{
"cell_type": "markdown",
"id": "4d6ef765-3785-4263-a72f-6e3ab5822d61",
"metadata": {},
"source": [
2024-06-07 20:52:07 +02:00
"#### Cholesterin im Vergleich zur Erkrankung"
2024-06-07 15:16:29 +02:00
]
},
{
"cell_type": "code",
2024-06-11 17:22:38 +02:00
"execution_count": 13,
2024-06-07 15:16:29 +02:00
"id": "fb8d7c02-936a-49c1-adfe-43943f7111d0",
"metadata": {},
"outputs": [
{
"data": {
2024-06-11 17:22:38 +02:00
"image/png": "iVBORw0KGgoAAAANSUhEUgAAA1IAAAIhCAYAAABE54vcAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjguMCwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy81sbWrAAAACXBIWXMAAA9hAAAPYQGoP6dpAABIWklEQVR4nO3daXRUVd7+/euQeQYCJEAG0ACKhBlpIs1gGAQBRWzQ0AKCNoIgkamlUYFuBkEN0OKtfxEFhYjeIjaizFOLEQmDii3aioxCiEwZMAmQnOcFN/VYJoFsSKgK+X7WqrWofXad+p0iGq7aw7Fs27YFAAAAACixSq4uAAAAAADKG4IUAAAAABgiSAEAAACAIYIUAAAAABgiSAEAAACAIYIUAAAAABgiSAEAAACAIYIUAAAAABgiSAEAAACAIYIUALi5r7/+Wg8//LDq1q0rX19fBQYGqnnz5po1a5ZOnTrl6FenTh316NGj1N73wIEDsixLCxcuLLVz/lZKSoomT56sM2fOlMn5S6pOnToaNGhQifv/85//VGhoqC5cuGD0PkV9npMnT5ZlWUbnKS8GDRqkOnXquLoMACgzBCkAcGPz589XixYtlJqaqnHjxmn16tVavny5/vSnP+nVV1/VkCFDXF3iVUtJSdGUKVNcHqRMLVu2TPfcc488PT2v+VyPPPKIPv/881Koyv0888wzWr58uavLAIAyc+2/BQAAZeLzzz/XsGHD1LlzZ3344Yfy8fFxHOvcubPGjBmj1atXu7BC9/Trr7/K39+/TM59/Phxbd26VePHjy+V80VERCgiIqJUzuVubr75ZleXAABlihEpAHBT06dPl2VZeu2115xC1CXe3t7q1atXofbVq1erefPm8vPz0y233KI33nijUJ9vvvlG99xzj6pUqSJfX181bdpUixYtKlFdP/zwgxISElSjRg35+Pjo1ltv1csvv+zUp6CgQFOnTlWDBg3k5+enypUrq3Hjxpo7d66ki1Paxo0bJ0mqW7euLMuSZVnavHmz4xzvvvuu2rRpo4CAAAUGBqpr167avXu30/sMGjRIgYGB2rNnj7p06aKgoCDFx8dLkk6dOqXhw4erdu3a8vb21k033aSJEycqLy+vRNdZlOXLlyswMFCdOnW6bL+jR4+qb9++CgoKUkhIiPr166e0tLRC/Yqa2vfuu++qS5cuqlmzpvz8/HTrrbfqqaee0tmzZwu9fv78+apfv758fHzUsGFDJScnF5pSd2lK4QsvvKCkpCTVrVtXgYGBatOmjbZt21bonCtWrFCbNm3k7++voKAgde7cudCo2S+//KK//OUvioyMlI+Pj6pXr6477rhD69evd/Qpamrf//7v/6p169YKCQmRv7+/brrpJg0ePPiynyUAuCtGpADADeXn52vjxo1q0aKFIiMjS/y6r776SmPGjNFTTz2lsLAwvf766xoyZIhiYmLUrl07SdL333+vuLg41ahRw7HeZ/HixRo0aJCOHz9+2dGWb7/9VnFxcYqKitKLL76o8PBwrVmzRk888YROnDihSZMmSZJmzZqlyZMn6+mnn1a7du10/vx5fffdd45pfI888ohOnTqll156SR988IFq1qwpSWrYsKGkiyHy6aef1sMPP6ynn35a586d0/PPP68//vGP2r59u6OfJJ07d069evXS0KFD9dRTT+nChQvKzc1Vx44dtW/fPk2ZMkWNGzfWp59+qhkzZujLL7/Uxx9/bPT3ccmyZcvUo0ePIoPtJTk5OerUqZOOHj2qGTNmqH79+vr444/Vr1+/Er3HDz/8oO7duysxMVEBAQH67rvvNHPmTG3fvl0bN2509Hvttdc0dOhQ9enTR7Nnz1ZGRoamTJlSbFB8+eWXdcstt2jOnDmSLk696969u/bv36+QkBBJUnJysvr3768uXbronXfeUV5enmbNmqUOHTpow4YNatu2rSTpoYce0q5duzRt2jTVr19fZ86c0a5du3Ty5Mlir+vzzz9Xv3791K9fP02ePFm+vr46ePCg0zUBQLliAwDcTlpami3JfuCBB0r8mujoaNvX19c+ePCgoy0nJ8euWrWqPXToUEfbAw88YPv4+NiHDh1yen23bt1sf39/+8yZM7Zt2/b+/fttSfabb77p6NO1a1c7IiLCzsjIcHrtiBEjbF9fX/vUqVO2bdt2jx497KZNm1623ueff96WZO/fv9+p/dChQ7anp6c9cuRIp/asrCw7PDzc7tu3r6Nt4MCBtiT7jTfecOr76quv2pLs9957z6l95syZtiR77dq1jrbo6Gh74MCBl63Vtm37xIkTtqenp71s2bLL9nvllVdsSfa//vUvp/ZHH3200Oc5adIk+3K/igsKCuzz58/bW7ZssSXZX331lW3btp2fn2+Hh4fbrVu3dup/8OBB28vLy46Ojna0Xfp7jI2NtS9cuOBo3759uy3JfueddxznrFWrlh0bG2vn5+c7+mVlZdk1atSw4+LiHG2BgYF2YmLiZT+HgQMHOtXxwgsv2JIcP18AUN4xtQ8AbiBNmzZVVFSU47mvr6/q16+vgwcPOto2btyo+Pj4QiNdgwYN0q+//lrs5ge5ubnasGGDevfuLX9/f124cMHx6N69u3Jzcx1TxW6//XZ99dVXGj58uNasWaPMzMwSX8OaNWt04cIFDRgwwOk9fH191b59e6fpf5f06dPH6fnGjRsVEBCg+++/v9A1StKGDRtKXM8l//rXv+Tt7a277rrrsv02bdqkoKCgQtMuExISSvQ+P/30kxISEhQeHi4PDw95eXmpffv2kqS9e/dKujiqmJaWpr59+zq9NioqSnfccUeR57377rvl4eHheN64cWNJcvxsfP/99zp69KgeeughVar0///zIDAwUH369NG2bdv066+/Srr497tw4UJNnTpV27Zt0/nz5694Xa1atZIk9e3bV++9955+/vnnEn0eAOCuCFIA4IaqVasmf39/7d+/3+h1oaGhhdp8fHyUk5PjeH7y5EnHVLrfqlWrluN4UU6ePKkLFy7opZdekpeXl9Oje/fukqQTJ05IkiZMmKAXXnhB27ZtU7du3RQaGqr4+Hjt2LHjitdw/PhxSRf/4f3793n33Xcd73GJv7+/goODC9UaHh5eaP1RjRo15OnpedkpaMV5//331a1btytuZHHy5EmFhYUVag8PD7/ie2RnZ+uPf/yjvvjiC02dOlWbN29WamqqPvjgA0ly/D1eqr+o9ymqTSr8s3FpeuLvz1ncz0ZBQYFOnz4t6eI6roEDB+r1119XmzZtVLVqVQ0YMKDIdWCXtGvXTh9++KEjJEdERKhRo0Z65513iv9AAMCNsUYKANyQh4eH4uPjtWrVKh05cqRUd3YLDQ3VsWPHCrUfPXpU0sUQV5QqVarIw8NDDz30kB5//PEi+9StW1eS5OnpqdGjR2v06NE6c+aM1q9fr7/97W/q2rWrDh8+fNkwcun933//fUVHR1/xeoq6D1NoaKi++OIL2bbtdDw9PV0XLlwo9hqLk5GRoQ0bNpTonlqhoaHavn17ofbLhYxLNm7cqKNHj2rz5s2OUShJhbaIvxSKLoVO0/cpyqVzFvezUalSJVWpUkXSxb+jOXPmaM6cOTp06JBWrFihp556Sunp6ZfdSfKee+7RPffco7y8PG3btk0zZsxQQkKC6tSpozZt2lxV3QDgKoxIAYCbmjBhgmzb1qOPPqpz584VOn7+/Hl99NFHxueNj493/IP9t9566y35+/vrD3/4Q5Gv8/f3V8eOHbV79241btxYLVu2LPQoakSscuXKuv/++/X444/r1KlTOnDggKTCIyKXdO3aVZ6entq3b1+R79GyZcsSXWN2drY+/PDDQtd46biJjz76SJZlleiGxx07dlRWVpZWrFjh1J6cnHzF114Kfb/fzOL//b//5/S8QYMGCg8P13vvvefUfujQIaWkpFzxfYrSoEED1a5dW8nJybJt29F+9uxZLVu2zLGT3+9FRUVpxIgR6ty5s3bt2lWi9/Lx8VH79u01c+ZMSSq0GyMAlAeMSAGAm2rTpo1eeeUVDR8+XC1atNC
2024-06-07 15:16:29 +02:00
"text/plain": [
"<Figure size 1000x600 with 1 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"plt.figure(figsize=(10, 6))\n",
"sns.boxplot(x='goal', y='chol', data=df)\n",
2024-06-07 20:52:07 +02:00
"plt.title('Cholesterol / diagnosis')\n",
"plt.xlabel('diagnosis')\n",
"plt.ylabel('Cholesterol in mg/dl')\n",
"plt.xticks([0, 1], ['healthy', 'sick'])\n",
2024-06-07 15:16:29 +02:00
"plt.show()"
]
},
2024-06-07 20:52:07 +02:00
{
"cell_type": "markdown",
"id": "96cd0dbf-5a76-47a5-8103-81dc3f5cf266",
"metadata": {},
"source": [
"Im folgenden wird ein t-Test durchgeführt, um zu analysieren, ob der Cholesterinwert bei erkrankten Personen höher ist als bei gesunden. \n",
"Hierfür wurden folgende Hypothesen aufgestellt: \n",
"- Nullhypothese (HO): Cholesterinwert bei erkrankten Personen ist gleich wie oder kleiner als bei gesunden.\n",
"- Alternativhypothese (H1): Cholesterinwert bei erkrankten Personen ist höher als bei gesunden."
]
},
2024-06-07 15:16:29 +02:00
{
"cell_type": "code",
2024-06-11 17:22:38 +02:00
"execution_count": 14,
2024-06-07 15:16:29 +02:00
"id": "f5d1a57a-8d24-4a23-a035-3e6d7fd7eb89",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
2024-06-07 20:52:07 +02:00
"t-Statistik: 1.3834015443480652\n",
"p-Wert: 0.08379388357371184\n"
2024-06-07 15:16:29 +02:00
]
}
],
"source": [
2024-06-07 20:52:07 +02:00
"# t-test\n",
2024-06-07 15:16:29 +02:00
"from scipy.stats import ttest_ind\n",
"\n",
"chol_healthy = df.loc[df['goal'] == 0, 'chol']\n",
"chol_sick = df.loc[df['goal'] == 1, 'chol']\n",
"\n",
"t_statistic, p_value = ttest_ind(chol_sick, chol_healthy, alternative='greater')\n",
"\n",
"print(\"t-Statistik:\", t_statistic)\n",
2024-06-07 20:52:07 +02:00
"print(\"p-Wert:\", p_value)"
]
},
{
"cell_type": "markdown",
"id": "9f6927e8-dec2-4b8e-a8fb-4d1e348306bd",
"metadata": {},
"source": [
"Die t-Statistik sagt aus, dass der Mittelwert des Cholesterinspiegels in der erkrankten Gruppe um ca. 1,38 Standardabweichungen höher ist, als der Mittelwert in der gesunden Gruppe. Der Wert ist allerdings kein Maß dafür, ob der Unterschied statistisch signifikant ist. Hierfür muss der p-Wert betrachtet werden, der aussagt, ob der beobachtete Unterschied zwischen den Gruppen auf rein zufällige Variationen zurückgeführt werden könnte. \n",
"Der p-Wert ist größer als 0.05, daher wird die Nullhypothese nicht abgelehnt. \n",
"Es gibt keine signifikanten Hinweise darauf, dass der Cholesterinwert bei kranken Personen höher ist als bei gesunden."
2024-06-07 15:16:29 +02:00
]
},
{
"cell_type": "markdown",
"id": "362223d0-efaf-426c-8bb7-81108c065ccf",
"metadata": {},
"source": [
2024-06-07 20:52:07 +02:00
"#### Systolischer Ruheblutdruck"
2024-06-07 15:16:29 +02:00
]
},
{
"cell_type": "code",
2024-06-11 17:22:38 +02:00
"execution_count": 15,
2024-06-07 15:16:29 +02:00
"id": "1574b038-0941-4473-a968-adca7f5ec26e",
"metadata": {},
"outputs": [
{
"data": {
2024-06-11 17:22:38 +02:00
"image/png": "iVBORw0KGgoAAAANSUhEUgAAArcAAAIhCAYAAABUopIpAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjguMCwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy81sbWrAAAACXBIWXMAAA9hAAAPYQGoP6dpAABk6UlEQVR4nO3deXxMd////+fIHiKSIBEStJZSsRRVoZZaY1+u4hO1V1drqFK1tVqlailtXd2oqtLaWlr72jTVIhQXrZYQakltiS0Ryfn94Wt+nSaYk8wY4nG/3XK7Zd7nPWeek6Su1/We13kfi2EYhgAAAIA8IJ+rAwAAAACOQnELAACAPIPiFgAAAHkGxS0AAADyDIpbAAAA5BkUtwAAAMgzKG4BAACQZ1DcAgAAIM+guAUAAECeQXELwC5z5syRxWKx+SpSpIgaNGigFStWZJlvsVg0duzYO57z8OHDslgsmjNnzh1/7fvJu+++q6CgIF27ds3U87L7/YwdO1YWi8XBCe8OPXv2VKlSpVwdA7ivUNwCMGX27Nn66aefFBcXpw8//FBubm5q3bq1li9f7upouIMWL16stm3byt3dPdfnevrpp/XTTz85INXdZ9SoUVq6dKmrYwD3ldz/qwTgvlKpUiXVqFHD+rh58+YKCAjQl19+qdatW7sw2Z11+fJl+fr6ujqG3QzDUGpqqnx8fHJ9rlOnTik2NlbDhg1zQDKpRIkSKlGihEPOdbd58MEHXR0BuO+wcgsgV7y9veXp6SkPD4/bzt27d6/atm2rgIAAeXt7q2rVqvrss8+yzEtMTNRTTz2lokWLysvLSxUqVNA777yjzMxMm3nHjx9Xp06d5OfnJ39/f3Xu3FknT560K/eNNou1a9eqV69eCgwMVP78+dW6dWsdOnTIZm6DBg1UqVIlbdmyRZGRkfL19VXv3r0lSSkpKRo6dKhKly4tT09PFS9eXIMGDdKlS5dszvH111+rVq1a8vf3l6+vrx544AHrOSQpMzNT48ePV/ny5eXj46NChQqpcuXKmj59unXOzT7izu5jfYvFon79+mnWrFmqUKGCvLy8rD/rP/74Q9HR0TY/3/fee8+un5skLV26VAUKFFDjxo1vOc/e3092+RcuXKimTZuqWLFi8vHxUYUKFTR8+PAsP1dJ+uijj1SuXDl5eXmpYsWKmj9/fpaf1Y12iMmTJ2vKlCkqXbq0ChQooNq1a2vr1q1Zzvntt9+qdu3a8vX1lZ+fn5o0aZJldfnvv//WM888o7CwMHl5ealIkSKqU6eO1q1bZ52T3e/sdn8LAHKHlVsApmRkZOjatWsyDEOnTp3S22+/rUuXLik6OvqWz/v9998VGRmpokWLWvs1582bp549e+rUqVPWVcC///5bkZGRunr1ql5//XWVKlVKK1as0NChQ3Xw4EG9//77kqQrV66ocePGOn78uCZMmKBy5crpu+++U+fOnU29nz59+qhJkyaaP3++jh49qldffVUNGjTQ7t27VahQIeu8EydO6KmnntKwYcP05ptvKl++fLp8+bLq16+vY8eO6ZVXXlHlypX1v//9T6NHj9aePXu0bt06WSwW/fTTT+rcubM6d+6ssWPHytvbW0eOHNGGDRus5580aZLGjh2rV199VfXq1VN6erp+++03nT9/3tT7+adly5bphx9+0OjRoxUSEqKiRYtq3759ioyMVHh4uN555x2FhIRo9erVGjBggE6fPq0xY8bc9ryLFy9Wq1at5OXlddM5uf39/PHHH2rRooUGDRqk/Pnz67ffftPEiRP1yy+/2PzcPvzwQz377LPq2LGjpk6dquTkZI0bN05paWnZnve9997TQw89pGnTpkm63jbQokULJSQkyN/fX5I0f/58de3aVU2bNtWXX36ptLQ0TZo0SQ0aNND69etVt25dSVK3bt0UHx+vN954Q+XKldP58+cVHx+vM2fO3PR92fO3ACCXDACww+zZsw1JWb68vLyM999/P8t8ScaYMWOsj7t06WJ4eXkZiYmJNvOioqIMX19f4/z584ZhGMbw4cMNScbPP/9sM+/55583LBaL8fvvvxuGYRgffPCBIcn45ptvbOb17dvXkGTMnj3brvfTvn17m/Eff/zRkGSMHz/eOla/fn1DkrF+/XqbuRMmTDDy5ctnbNu2zWZ80aJFhiTj+++/NwzDMCZPnmxIsr7H7LRq1cqoWrXqLTP36NHDKFmyZJbxMWPGGP/+51yS4e/vb5w9e9ZmvFmzZkaJEiWM5ORkm/F+/foZ3t7eWeb/2+nTpw13d3dj8eLFt5xn5veTXf5/yszMNNLT043Nmzcbkoxff/3VMAzDyMjIMEJCQoxatWrZzD9y5Ijh4eFh87NKSEgwJBkRERHGtWvXrOO//PKLIcn48ssvrecMDQ01IiIijIyMDOu8CxcuGEWLFjUiIyOtYwUKFDAGDRp0y5/Dv39n9vwtAMgd2hIAmDJ37lxt27ZN27Zt08qVK9WjRw+9+OKLmjlz5i2ft2HDBjVq1EhhYWE24z179tTly5etH/lu2LBBFStW1KOPPpplnmEY1hWujRs3ys/PT23atLGZd7sV5H/r2rWrzePIyEiVLFlSGzdutBkPCAjQE088YTO2YsUKVapUSVWrVtW1a9esX82aNZPFYtGmTZskSTVr1pQkderUSV999ZX++uuvLDkeffRR/frrr3rhhRe0evVqpaSkmHof2XniiScUEBBgfZyamqr169erffv28vX1tcncokULpaamZvsR/T9988038vT0VPPmzW85L7e/n0OHDik6OlohISFyc3OTh4eH6tevL0nav3+/pOufBpw8eVKdOnWyeW54eLjq1KmT7XlbtmwpNzc36+PKlStLko4cOWI95/Hjx9WtWzfly/f//09kgQIF1LFjR23dulWXL1+WdP13NmfOHI0fP15bt25Venr6bd+XPX8LAHKH4haAKRUqVFCNGjVUo0YNNW/eXP/973/VtGlTDRs27JYfoZ85c0bFihXLMh4aGmo9bnZecHBwlnkhISGm3k9280NCQrJ8tJxdplOnTmn37t3y8PCw+fLz85NhGDp9+rQkqV69elq2bJmuXbum7t27q0SJEqpUqZK+/PJL67lGjBihyZMna+vWrYqKilJQUJAaNWqk7du3m3o/t8p85swZXbt2TTNmzMiSuUWLFpJkzXwzixYtUlRU1G0vpsvN7+fixYt6/PHH9fPPP2v8+PHatGmTtm3bpiVLlki63vJw4zUkZfs62Y1JUlBQkM3jG60V/z7nzf4GMzMzde7cOUnX+4J79Oihjz/+WLVr11ZgYKC6d+9+y75ve/4WAOQOPbcAcq1y5cpavXq1Dhw4kGXF9YagoCCdOHEiy/jx48clSYULFzY975dffskyz94Lym41/+TJkypTpozNWHb7sBYuXFg+Pj769NNPsz33jayS1LZtW7Vt21ZpaWnaunWrJkyYoOjoaJUqVUq1a9eWu7u7YmJiFBMTo/Pnz2vdunV65ZVX1KxZMx09elS+vr7y9vbOtpf0ZgXpvzMHBATIzc1N3bp104svvpjtc0qXLp3tuCQlJydr/fr1du0hnJvfz4YNG3T8+HFt2rTJulorKcv/ebpRqJ46dSpHr5OdG+e82d9gvnz5rKvhhQsX1rRp0zRt2jQlJibq22+/1fDhw5WUlKRVq1bd9DVu97cAIHdYuQWQa7t27ZIkFSlS5KZzGjVqZC1a/mnu3Lny9fXVY489Zp23b98+xcfHZ5lnsVjUsGFDSVLDhg114cIFffvttzbz5s+fbyr7F198YfM4Li5OR44cUYMGDW773FatWungwYMKCgqyrmb/8yu7nQ28vLxUv359TZw4UZK0c+fOLHMKFSqk//znP3rxxRd19uxZHT58WJJUqlQpJSUl2RRzV69e1erVq+16r76+vmrYsKF27typypUrZ5v53yub/7R8+XJZLBa1atXqtq+Vm9/PjaL83xes/fe//7V5XL58eYWEhOirr76yGU9MTFRcXNxtXyc75cuXV/HixTV//nwZhmEdv3TpkhYvXmzdQeHfwsPD1a9fPzV
2024-06-07 15:16:29 +02:00
"text/plain": [
"<Figure size 800x600 with 1 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"plt.figure(figsize=(8, 6))\n",
2024-06-07 20:52:07 +02:00
"sns.boxplot(x='goal', y='trestbps', data=df)\n",
"plt.title('Blood pressure / diagnosis')\n",
"plt.xlabel('Diagnosis')\n",
"plt.ylabel('Systolic resting blood pressure (in mmHg on admission to hospital)')\n",
"plt.xticks([0, 1], ['healthy', 'sick'])\n",
2024-06-07 15:16:29 +02:00
"plt.show()"
]
},
{
"cell_type": "code",
2024-06-11 17:22:38 +02:00
"execution_count": 16,
2024-06-07 15:16:29 +02:00
"id": "0a359020-86f6-4d8c-9144-d2977674e51d",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
2024-06-07 20:52:07 +02:00
" Diagnose Untere Grenze Obere Grenze\n",
"0 Gesund 126.618412 131.731588\n",
"1 Krank 131.442350 137.827723\n"
2024-06-07 15:16:29 +02:00
]
}
],
"source": [
2024-06-07 20:52:07 +02:00
"# confidence interval (95%) for blood pressure and diagnosis\n",
"\n",
"# filter by diagnosis and calculate interval\n",
2024-06-07 15:16:29 +02:00
"conf_level = 0.95\n",
"blutdruck_gesund = df.loc[df['goal'] == 0, 'trestbps']\n",
"blutdruck_krank = df.loc[df['goal'] == 1, 'trestbps']\n",
"conf_int_gesund = stats.t.interval(conf_level, len(blutdruck_gesund) - 1, loc=blutdruck_gesund.mean(), scale=stats.sem(blutdruck_gesund))\n",
"conf_int_krank = stats.t.interval(conf_level, len(blutdruck_krank) - 1, loc=blutdruck_krank.mean(), scale=stats.sem(blutdruck_krank))\n",
"\n",
"result_table_blutdruck = pd.DataFrame({\n",
" 'Diagnose': ['Gesund', 'Krank'],\n",
2024-06-07 20:52:07 +02:00
" 'Untere Grenze': [conf_int_gesund[0], conf_int_krank[0]],\n",
" 'Obere Grenze': [conf_int_gesund[1], conf_int_krank[1]]\n",
2024-06-07 15:16:29 +02:00
"})\n",
"\n",
"print(result_table_blutdruck)"
]
},
2024-06-07 20:52:07 +02:00
{
"cell_type": "markdown",
"id": "751dc52f-4675-4046-91c1-a00541ec172b",
"metadata": {},
"source": [
"Die Intervalle überlappen sich nur minimal, deshalb kann hier keine klare Aussage getroffen werden, ob es einen statistisch signifikanten Unterschied zwischen den beiden Gruppen gibt. Um eine klarere Aussage treffen zu können, wird zusätzlich ein t-Test durchgeführt. \n",
"Im Folgenden wird ein t-Test durchgeführt, um zu analysieren, ob der Cholesterinwert bei erkrankten Personen höher ist als bei gesunden.\n",
"Hierfür wurden folgende Hypothesen aufgestellt:\n",
"\n",
"Nullhypothese (HO): Der Blutdruck von erkrankten Personen ist niedriger oder gleich wie der von gesunden. \n",
"Alternativhypothese (H1): Der Blutdruck von erkrankten Personen ist höher als der von gesunden."
]
},
2024-06-07 15:16:29 +02:00
{
"cell_type": "code",
2024-06-11 17:22:38 +02:00
"execution_count": 17,
2024-06-07 15:16:29 +02:00
"id": "003e4148-8318-41f4-8e38-af74c5ad54fa",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
2024-06-07 20:52:07 +02:00
"t-Statistik: 2.6678917570482685\n",
2024-06-11 17:22:38 +02:00
"p-Wert: 0.004027398179437639\n"
2024-06-07 15:16:29 +02:00
]
}
],
"source": [
"# t-Test\n",
"blutdruck_healthy = df.loc[df['goal'] == 0, 'trestbps']\n",
"blutdruck_sick = df.loc[df['goal'] == 1, 'trestbps']\n",
"\n",
"# Durchführung des t-Tests\n",
"t_statistic, p_value = ttest_ind(blutdruck_sick, blutdruck_healthy, alternative='greater')\n",
"\n",
"print(\"t-Statistik:\", t_statistic)\n",
2024-06-07 20:52:07 +02:00
"print(\"p-Wert:\", p_value)"
2024-06-07 15:16:29 +02:00
]
2024-06-07 20:52:07 +02:00
},
{
"cell_type": "markdown",
"id": "e281ae05-5f6f-40e0-9499-362d9cba5eea",
"metadata": {},
"source": [
"Die t-Statistik besagt, dass der Mittelwert der erkrankten Personen um ca. 2,67 Standardabweichung von dem der gesunden Personen abweicht. \n",
"Der p-Wert ist kleiner als 0.05, daher wird die Nullhypothese abgelehnt.\n",
"Es gibt signifikante Hinweise darauf, dass der Blutdruck bei kranken Personen höher ist als bei gesunden Personen."
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "ddfac31a-9a03-4b4a-900b-7afa98d4f3cb",
"metadata": {},
"outputs": [],
"source": []
2024-05-08 08:48:17 +02:00
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"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",
2024-06-11 17:22:38 +02:00
"version": "3.11.7"
2024-05-08 08:48:17 +02:00
}
},
"nbformat": 4,
"nbformat_minor": 5
}