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
68 changes: 58 additions & 10 deletions your-code/main.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,13 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 13,
"metadata": {},
"outputs": [],
"source": [
"# Libraries"
"import numpy as np\n",
"import matplotlib.pyplot as plt\n",
"import scipy.stats as st"
]
},
{
Expand All @@ -32,11 +34,29 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 12,
"metadata": {},
"outputs": [],
"outputs": [
{
"data": {
"text/plain": [
"(172.14308590115726, 174.79024743217607)"
]
},
"execution_count": 12,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# your code here"
"# your code here\n",
"# your code here\n",
"heights = [167, 167, 168, 168, 168, 169, 171, 172, 173, 175, 175, 175, 177, 182, 195]\n",
"std = 4 # of the population\n",
"mean = sum(heights)/len(heights)\n",
"mean\n",
"n = len(heights)\n",
"st.norm.interval(0.80,loc=mean,scale=std/np.sqrt(n))"
]
},
{
Expand All @@ -51,11 +71,39 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 11,
"metadata": {},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"(0.20248138545542083, 0.3118043288302934)\n",
"(0.18698561776452813, 0.3273000965211861)\n"
]
}
],
"source": [
"# your code here"
"# your code here\n",
"sample_proportion = 27 / 105\n",
"\n",
"confidence_80 = 0.80\n",
"confidence_90 = 0.90\n",
"\n",
"standard_error = np.sqrt((sample_proportion * (1 - sample_proportion)) / 105)\n",
"\n",
"z_score_80 = st.norm.ppf((1 + confidence_80) / 2)\n",
"z_score_90 = st.norm.ppf((1 + confidence_90) / 2)\n",
"\n",
"margin_of_error_80 = z_score_80 * standard_error\n",
"margin_of_error_90 = z_score_90 * standard_error\n",
"\n",
"confidence_interval_80 = (sample_proportion - margin_of_error_80, sample_proportion + margin_of_error_80)\n",
"confidence_interval_90 = (sample_proportion - margin_of_error_90, sample_proportion + margin_of_error_90)\n",
"\n",
"\n",
"print(confidence_interval_80)\n",
"print(confidence_interval_90)"
]
},
{
Expand Down Expand Up @@ -131,7 +179,7 @@
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
Expand All @@ -145,7 +193,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.3"
"version": "3.11.4"
}
},
"nbformat": 4,
Expand Down