diff --git a/your-code/main.ipynb b/your-code/main.ipynb index 332f496..310a0ac 100644 --- a/your-code/main.ipynb +++ b/your-code/main.ipynb @@ -9,11 +9,13 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 21, "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": 4, "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "(172.14308590115726, 174.79024743217607)" + ] + }, + "execution_count": 4, + "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", + "mean = sum(heights) / len(heights)\n", + "n = 15\n", + "std = 4\n", + "\n", + "st.norm.interval(0.80, loc = mean, scale = std/np.sqrt(n))" ] }, { @@ -51,11 +70,31 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 26, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "80% Confidence Interval: (0.2548114047320704, 0.2594743095536438)\n", + "90% Confidence Interval: (0.2541504703696276, 0.2601352439160866)\n" + ] + } + ], "source": [ - "# your code here" + "n = 105\n", + "shops_with_losses = 27\n", + "\n", + "proportion = shops_with_losses / n\n", + "\n", + "standard_error = (proportion * (1 - proportion)) / n\n", + "\n", + "interval_80 = stats.norm.interval(0.80, loc=proportion, scale=standard_error)\n", + "interval_90 = stats.norm.interval(0.90, loc=proportion, scale=standard_error)\n", + "\n", + "print(f\"80% Confidence Interval: {interval_80}\")\n", + "print(f\"90% Confidence Interval: {interval_90}\")" ] }, { @@ -131,7 +170,7 @@ ], "metadata": { "kernelspec": { - "display_name": "Python 3", + "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, @@ -145,7 +184,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.7.3" + "version": "3.10.9" } }, "nbformat": 4,