From 3df2065c00508eb8a4ed6669826874f8142987a5 Mon Sep 17 00:00:00 2001 From: Marisan13 <96127669+Marisan13@users.noreply.github.com> Date: Mon, 20 Nov 2023 09:14:34 +0000 Subject: [PATCH] Lab done --- your-code/main.ipynb | 80 +++++++++++++++++++++++++++++++++++++------- 1 file changed, 67 insertions(+), 13 deletions(-) diff --git a/your-code/main.ipynb b/your-code/main.ipynb index 332f496..2f9e0e4 100644 --- a/your-code/main.ipynb +++ b/your-code/main.ipynb @@ -9,11 +9,13 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 1, "metadata": {}, "outputs": [], "source": [ - "# Libraries" + "import pandas as pd\n", + "import numpy as np\n", + "import scipy.stats as st" ] }, { @@ -32,11 +34,28 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 2, "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "(172.14308590115726, 174.79024743217607)" + ] + }, + "execution_count": 2, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ - "# your code here" + "heights = [167, 167, 168, 168, 168, 169, 171, 172, 173, 175, 175, 175, 177, 182, 195]\n", + "\n", + "n = len(heights)\n", + "mean = np.mean(heights)\n", + "std = 4\n", + "\n", + "st.norm.interval(0.8, loc=mean, scale = std /np.sqrt(n))" ] }, { @@ -51,11 +70,46 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 3, "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "(0.20248138545542083, 0.3118043288302934)" + ] + }, + "execution_count": 3, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ - "# your code here" + "from statsmodels.stats.proportion import proportion_confint\n", + "\n", + "# 80% \n", + "proportion_confint(count=27, nobs=105, alpha=0.2)" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "(0.1869856177645281, 0.32730009652118613)" + ] + }, + "execution_count": 4, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "# 90% \n", + "proportion_confint(count=27, nobs=105, alpha=0.1)" ] }, { @@ -76,7 +130,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 5, "metadata": {}, "outputs": [], "source": [ @@ -94,7 +148,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 6, "metadata": {}, "outputs": [], "source": [ @@ -121,7 +175,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 7, "metadata": {}, "outputs": [], "source": [ @@ -131,7 +185,7 @@ ], "metadata": { "kernelspec": { - "display_name": "Python 3", + "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, @@ -145,7 +199,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.7.3" + "version": "3.11.3" } }, "nbformat": 4,