diff --git a/your-code/main.ipynb b/your-code/main.ipynb index 332f496..85a52a1 100644 --- a/your-code/main.ipynb +++ b/your-code/main.ipynb @@ -9,11 +9,13 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 16, "metadata": {}, "outputs": [], "source": [ - "# Libraries" + "# Libraries\n", + "import numpy as np\n", + "import scipy.stats as st" ] }, { @@ -32,11 +34,31 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 13, "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "(172.14308590115726, 174.79024743217607)" + ] + }, + "execution_count": 13, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ - "# your code here" + "# your code here\n", + "heights = [167, 167, 168, 168, 168, 169, 171, 172, 173, 175, 175, 175, 177, 182, 195]\n", + "h = heights\n", + "\n", + "\n", + "mean = np.mean(h)\n", + "std = 4\n", + "n = len(h)\n", + "\n", + "st.norm.interval(0.80, loc=mean, scale=std/np.sqrt(n))" ] }, { @@ -51,11 +73,36 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 26, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "(0.20248138545542083, 0.3118043288302934)\n", + "(0.1869856177645281, 0.32730009652118613)\n" + ] + } + ], "source": [ - "# your code here" + "# your code here\n", + "n = 105\n", + "x = 27\n", + "p = x/n\n", + "\n", + "std = (p * (1 - p) / n) ** 0.5\n", + "\n", + "# 80% \n", + "cl = 0.80\n", + "ci_80 = st.norm.interval(cl, loc=p, scale=std)\n", + "\n", + "# 90&\n", + "cl2 = 0.90\n", + "ci_90 = st.norm.interval(cl2, loc=p, scale=std)\n", + "\n", + "print(ci_80)\n", + "print(ci_90)" ] }, { @@ -131,7 +178,7 @@ ], "metadata": { "kernelspec": { - "display_name": "Python 3", + "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, @@ -145,7 +192,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.7.3" + "version": "3.9.13" } }, "nbformat": 4,