Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
72 changes: 62 additions & 10 deletions your-code/main.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -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"
]
},
{
Expand All @@ -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))"
]
},
{
Expand All @@ -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)"
]
},
{
Expand Down Expand Up @@ -131,7 +183,7 @@
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
Expand All @@ -145,7 +197,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.3"
"version": "3.11.4"
}
},
"nbformat": 4,
Expand Down