From 46db363ef9e9add87b88c10f309a176614684863 Mon Sep 17 00:00:00 2001 From: HenrikSoeder Date: Tue, 21 Nov 2023 21:57:45 +0000 Subject: [PATCH] Lab Done --- your-code/main.ipynb | 72 ++++++++++++++++++++++++++++++++++++++------ 1 file changed, 62 insertions(+), 10 deletions(-) diff --git a/your-code/main.ipynb b/your-code/main.ipynb index 332f496..882dd40 100644 --- a/your-code/main.ipynb +++ b/your-code/main.ipynb @@ -9,11 +9,14 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 2, "metadata": {}, "outputs": [], "source": [ - "# Libraries" + "import pandas as pd\n", + "import numpy as np\n", + "\n", + "import scipy.stats as st" ] }, { @@ -32,11 +35,37 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 13, "metadata": {}, "outputs": [], "source": [ - "# your code here" + "heights = [167, 167, 168, 168, 168, 169, 171, 172, 173, 175, 175, 175, 177, 182, 195]\n", + "\n", + "mean = np.mean(heights)\n", + "std = 4\n", + "n = len(heights)\n", + "\n", + "alpha = 0.8" + ] + }, + { + "cell_type": "code", + "execution_count": 14, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "(172.14308590115726, 174.79024743217607)" + ] + }, + "execution_count": 14, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "st.norm.interval(alpha, loc=mean, scale=std/np.sqrt(n))" ] }, { @@ -51,11 +80,34 @@ }, { "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], + "execution_count": 21, + "metadata": { + "scrolled": true + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Proportion with 80%: (0.20927226997969411, 0.3190296168127587)\n", + "Proportion with 90%: (0.19371492861666578, 0.334586958175787)\n" + ] + } + ], "source": [ - "# your code here" + "x = list(np.arange(106))\n", + "x = [True if i <=27 else False for i in x]\n", + "mean = np.mean(x)\n", + "n = len(x)\n", + "std = np.std(x)\n", + "\n", + "\n", + "\n", + "alpha_80 = st.norm.interval(0.8, loc=mean, scale=std/np.sqrt(n))\n", + "alpha_90 = st.norm.interval(0.9, loc=mean, scale=std/np.sqrt(n))\n", + "\n", + "print(\"Proportion with 80%: \", alpha_80)\n", + "print(\"Proportion with 90%: \", alpha_90)" ] }, { @@ -131,7 +183,7 @@ ], "metadata": { "kernelspec": { - "display_name": "Python 3", + "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, @@ -145,7 +197,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.7.3" + "version": "3.11.4" } }, "nbformat": 4,