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
188 changes: 162 additions & 26 deletions lab-intro-probability.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,21 @@
"Welcome to this Intro to Probability lab, where we explore decision-making scenarios through the lens of probability and strategic analysis. In the business world, making informed decisions is crucial, especially when faced with uncertainties. This lab focuses on scenarios where probabilistic outcomes play a significant role in shaping strategies and outcomes. Students will engage in exercises that require assessing and choosing optimal paths based on data-driven insights. The goal is to enhance your skills by applying probability concepts to solve real-world problems."
]
},
{
"cell_type": "code",
"execution_count": 8,
"metadata": {},
"outputs": [],
"source": [
"import pandas as pd\n",
"import matplotlib.pyplot as plt \n",
"import numpy as np\n",
"import scipy.stats as stats \n",
"from scipy.stats import expon\n",
"from scipy.stats import poisson\n",
"\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
Expand All @@ -38,11 +53,26 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 23,
"metadata": {},
"outputs": [],
"outputs": [
{
"data": {
"text/plain": [
"np.float64(88.44772466215431)"
]
},
"execution_count": 23,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"#code here"
"n = 460\n",
"p = 0.97\n",
"\n",
"prob = stats.binom.cdf(450, n, p) * 100 \n",
"prob\n"
]
},
{
Expand Down Expand Up @@ -72,11 +102,25 @@
},
{
"cell_type": "code",
"execution_count": 5,
"execution_count": 22,
"metadata": {},
"outputs": [],
"outputs": [
{
"data": {
"text/plain": [
"48.99999999999999"
]
},
"execution_count": 22,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"#code here"
"p = 0.3\n",
"\n",
"prob = ((1-p)**2) * 100\n",
"prob "
]
},
{
Expand Down Expand Up @@ -107,11 +151,26 @@
},
{
"cell_type": "code",
"execution_count": 6,
"execution_count": 24,
"metadata": {},
"outputs": [],
"outputs": [
{
"data": {
"text/plain": [
"np.float64(1.289822084039205)"
]
},
"execution_count": 24,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"#code here"
"lam = 500\n",
"\n",
"prob = (1 - poisson.cdf(550, lam)) * 100\n",
"\n",
"prob "
]
},
{
Expand All @@ -123,11 +182,26 @@
},
{
"cell_type": "code",
"execution_count": 7,
"execution_count": 29,
"metadata": {},
"outputs": [],
"outputs": [
{
"data": {
"text/plain": [
"np.float64(26.77043869515715)"
]
},
"execution_count": 29,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"#code here"
"p_hour = 1 - poisson.cdf(550, 500)\n",
"\n",
"p_day = 1 - (1 - p_hour)**24\n",
"\n",
"p_day * 100\n"
]
},
{
Expand Down Expand Up @@ -157,10 +231,26 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 25,
"metadata": {},
"outputs": [],
"source": []
"outputs": [
{
"data": {
"text/plain": [
"np.float64(39.346934028736655)"
]
},
"execution_count": 25,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"lam = 1/10\n",
"\n",
"prob = (expon.cdf(5, scale=1/lam)) * 100\n",
"prob\n"
]
},
{
"cell_type": "markdown",
Expand All @@ -173,10 +263,24 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 26,
"metadata": {},
"outputs": [],
"source": []
"outputs": [
{
"data": {
"text/plain": [
"np.float64(22.31301601484298)"
]
},
"execution_count": 26,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"prob = (1 - expon.cdf(15, scale=1/lam)) * 100\n",
"prob\n"
]
},
{
"cell_type": "markdown",
Expand All @@ -196,11 +300,29 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 27,
"metadata": {},
"outputs": [],
"outputs": [
{
"data": {
"text/plain": [
"np.float64(68.26894921370858)"
]
},
"execution_count": 27,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"#code here"
"from scipy.stats import norm\n",
"med_weight = 150\n",
"\n",
"std = 10\n",
"\n",
"\n",
"prob = (norm.cdf(160, med_weight, std) - norm.cdf(140, med_weight, std)) * 100\n",
"prob"
]
},
{
Expand All @@ -219,17 +341,31 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 28,
"metadata": {},
"outputs": [],
"outputs": [
{
"data": {
"text/plain": [
"np.float64(45.11883639059736)"
]
},
"execution_count": 28,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"#code here"
"lam = 1/50\n",
"\n",
"prob = (expon.cdf(30, scale=1/lam)) * 100\n",
"prob\n"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"display_name": "base",
"language": "python",
"name": "python3"
},
Expand All @@ -243,7 +379,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.9"
"version": "3.13.9"
}
},
"nbformat": 4,
Expand Down