Skip to content
This repository was archived by the owner on Jun 15, 2024. It is now read-only.
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
62 changes: 30 additions & 32 deletions notebooks/probability/pmf.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"cells": [
{
"cell_type": "markdown",
"id": "a51ebf61",
"id": "d65bcc11",
"metadata": {},
"source": [
"### Probability Mass Function (PMF)\n",
Expand All @@ -17,48 +17,46 @@
"\n",
"We can denote the sample space as: $\\Omega = \\{H, T\\}$\n",
"\n",
"Now, let us say that if the coin lands as Heads, we win 1\\$ and we win 0\\$ if the coin lands as Tails. We can associate a function $W$ with the experiment such that W(Heads) = 1 and W(Tails) = 0\n",
"Now, let us consider a discrete random variable $X$ which takes the values 1 and 0 if the coin lands as Heads and Tails respectively, i.e, $X$(Heads) = 1 and $X$(Tails) = 0. Thus, $X$ can be used to represent the occurence of Heads in a single toss of a coin. \n",
"\n",
"Let, $R_{X}$ be the range of X, then \n",
" <center>$R_{X} = \\{0, 1\\}$.\n",
"\n",
"```{admonition} Random Variable\n",
"A random variable is a function mapping the sample space (for example: $\\Omega = \\{H, T\\}$) of an experiment to a measurement space $E = \\{0, 1\\}$. Random variables are represented using capital letters.\n",
"```\n",
"\n",
"While we may have generally seen a random variable W associated with a coin toss taking the values 1 for Heads, 0 for Tails, we might have chosen any other values and still have a random variable. As an example\n",
"\n",
"$$\n",
"Y(\\omega)= \\begin{cases}100, & \\text { if } \\omega=\\text { heads } \\\\ -20, & \\text { if } \\omega=\\text { tails }\\end{cases}\n",
"$$\n",
"\n",
"\n",
"If our experiment is to roll two die (6-faced die) and note the sum of the numbers on the top side.\n",
"Then, Probability Mass Function(PMF) of discrete random variable $X$ gives the probability distribution for each vaule of $X$.\n",
" \n",
"<center>$P_{X}(0) = P_{X}(X=0) = \\frac{1}{2}$ when Heads occurs <br>\n",
" $P_{X}(1) = P_{X}(X=1) = \\frac{1}{2}$ when Heads does not occur\n",
"\n",
"The sample space for this example is: \n",
"\n",
"$$\n",
"\\begin{align*}\n",
" S = \\{&(1, 1), (1, 2), \\dots, (1, 6), \\\\\n",
" &(2, 1), (2, 2), \\dots, (2, 6), \\\\\n",
" &\\cdots, \\cdots, \\cdots, \\cdots \\\\\n",
" &(6, 1), (6, 2), \\dots, (6, 6) \\}\n",
"\\end{align*}\n",
"$$\n",
"\n",
"Based on this sample space, we can see that our random variable $Z$ denoting the sum of numbers on the top side takes the values $\\{2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12\\}$\n",
"```{admonition} Probability Mass Function (PMF)\n",
"Probability mass function also called the probability law is the probability distribution of a discrete random variable, and provides the possible values and their associated probabilities.It is the function $P : \\mathbb{R} → [ 0 , 1 ]$ defined by <br>\n",
"$P_{X}(x_k) = P_{X}(X=x_k)$ where $k = 1,2,3,\\dots$<br>\n",
"where $X$ is a discrete random variable with range $R_{X} = \\{x_1,x_2,x_3,\\dots\\}$ (finite or countably infinite).\n",
"```\n",
"<br>\n",
"Example. Let us consider tossing a fair coin twice and finding the probability mass function (PMF) of a random discrete variable $Y$ which observe the number of occurences of Heads in each event.\n",
"\n",
"The sample space for this example is:\n",
" <center>$S=\\{HH,HT,TH,TT\\}$.\n",
"\n",
"```{admonition} Discrete Random Variable\n",
"A discrete random variable can take discrete values. For example, W representing the money we win if we toss a coin randomly. Or, Y the top face of a dice when the dice is rolled. Or, $Z$ denoting the sum of numbers on the top side of two dies.\n",
"```\n",
"The number of Heads will be 0, 1 or 2. Thus \n",
" <center>$R_{Y} = \\{0, 1, 2\\}$. \n",
" \n",
"Since, it is a finite set, thus the variable $Y$ is discrete random variable. Therefore, the PMF of $Y$, $P_Y$ is defined as \n",
"\n",
"<center>$P_{Y}(k) = P_{Y}(Y=k)$ for $k = 0,1,2$.\n",
"\n",
"Let us now take a different example. Our experiment is to pick a person at random from a university and measure their weight. The sample space would be the list of all the people in the university and the random variable $T$ would be weight corresponding to that randomly chosen person. The weight of that person would be a continuous scale.\n"
"We have,\n",
"<center>$P_{Y}(0) = P_{Y}(Y=0) = P(TT) = \\frac{1}{4}$,<br>\n",
"$P_{Y}(1) = P_{Y}(Y=1) = P(\\{HT,TH\\}) = \\frac{1}{4} + \\frac{1}{4} = \\frac{1}{2}$,<br>\n",
"$P_{Y}(2) = P_{Y}(Y=2) = P(HH) = \\frac{1}{4}$.\n",
" \n",
" "
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
Expand All @@ -72,7 +70,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.7"
"version": "3.8.8"
}
},
"nbformat": 4,
Expand Down