175 lines
4.5 KiB
Plaintext
175 lines
4.5 KiB
Plaintext
{
|
|
"cells": [
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 2,
|
|
"id": "c58309b2",
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"import os\n",
|
|
"import sys\n",
|
|
"\n",
|
|
"import matplotlib.pyplot as plt\n",
|
|
"import numpy as np\n",
|
|
"import pandas as pd\n",
|
|
"import seaborn as sns\n",
|
|
"\n",
|
|
"sns.set_theme(style=\"whitegrid\", context=\"notebook\")"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"id": "a6732353-51d5-4478-9cf8-5834e57e5a4e",
|
|
"metadata": {},
|
|
"source": [
|
|
"# Chapter 3 Notes"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"id": "9f0046c2",
|
|
"metadata": {},
|
|
"source": [
|
|
"## Random Variables (3.1.1 - 3.1.3)"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"id": "7c73b89f",
|
|
"metadata": {},
|
|
"source": [
|
|
"***Definition.*** Random Variables: \\\n",
|
|
"A random variable $X$ is a function from the sample space to the real numbers. ie\n",
|
|
"$$X : S \\to \\mathbb{R}$$\n",
|
|
"\n",
|
|
"Each outcome ($\\omega$) in the sample space must have a $X(\\omega)$ defined. \n",
|
|
"\n",
|
|
"> Note that $X$ is a deterministic function. The randomness comes from the fact that we dont know the inputs to $X$, ie the outcome of the random experiment"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"id": "afa12aa6",
|
|
"metadata": {},
|
|
"source": [
|
|
"***Definition.*** $X$ is a discrete random variable, if its range is countable"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"id": "abd4a3ea",
|
|
"metadata": {},
|
|
"source": [
|
|
"### More on $X$\n",
|
|
"\n",
|
|
"Let $\\Omega$ be a sample space and let $X$ be a random variable on $\\Omega$\n",
|
|
"\n",
|
|
"- $X$ is a function, and $\\forall \\omega \\in \\Omega, X(\\omega) \\in \\mathbb{R}\\quad$ (ie $X(\\omega)$ is defined on all **outcomes**) \n",
|
|
"- $P_x(1)$ is asking: For event $A = \\{\\omega \\in \\Omega \\mid X(\\omega) = 1 \\}$, what is $P(A)$?\n",
|
|
"- $X$ induces a partition of $\\Omega$\n"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"id": "a7dab8e8",
|
|
"metadata": {},
|
|
"source": [
|
|
"***Definition.*** Let $X$ be a discrete random variable with range $R_X = \\{x_1, x_2, x_3, \\dots\\}$ (finite or countably infinite). The function\n",
|
|
"\n",
|
|
"$$P_X(x_k) = P(X = x_k), \\text{for} k = 1,2,3,\\dots,$$\n",
|
|
"\n",
|
|
"is called the *probability mass function (PMF)* of $X$. (also called the probability distribution)\n",
|
|
"\n",
|
|
"Note that if $x \\notin R_X$, then $P_X(x) = 0$ "
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"id": "84ca67da",
|
|
"metadata": {},
|
|
"source": [
|
|
"## Properties of PMF\n",
|
|
"- $0 \\geq P_X(x) \\geq 1, \\forall x$\n",
|
|
"- $\\sum_{x \\in R_X}P_X(x) = 1$ \n",
|
|
"- for any set $A \\subset R_X, P(X \\in A) = \\sum_{x \\in A} P_X(x)$"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"id": "57323d97",
|
|
"metadata": {},
|
|
"source": [
|
|
"## Independent Random Variables (3.1.4)"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"id": "c6261f7d",
|
|
"metadata": {},
|
|
"source": [
|
|
"***Definition.*** Consider two discrete random variables $X$ and $Y$. We say that $X$ and $Y$ are independent if:\n",
|
|
"\n",
|
|
"$$P(X=x, Y=y) = P(X=x)P(Y=y)$$\n",
|
|
"\n",
|
|
"In general, if two random variables are independent, then you can write\n",
|
|
"\n",
|
|
"$$P(X \\in A, Y \\in B) = P(X \\in A)(Y \\in B)$$"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"id": "7b0362c1",
|
|
"metadata": {},
|
|
"source": [
|
|
"***Definition.*** Consider $n$ discrete random variables $X_1, X_2, X_3, \\dots, X_n$. We say that $X_1, X_2, X_3, \\dots, X_n$ are independent if:\n",
|
|
"\n",
|
|
"$$P(X_1 = x_1, X_2 = x_2, X_3 = x_3, \\dots, X_n = x_n) = P(X_1 = x_1)P(X_2 = x_2) \\dots P(X_n = x_n)$$\n"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"id": "e50c7c48",
|
|
"metadata": {},
|
|
"source": [
|
|
"## Special Distributions (3.1.5)"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"id": "853e9acb",
|
|
"metadata": {},
|
|
"source": [
|
|
"***Definition.*** A random variable $X$ is said to be a *Bernoulli* random variable with parameter *p*, shown as $X \\sim \\text{Bernoulli}(p),$ if its PMF is given by"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"id": "9e1caee1",
|
|
"metadata": {},
|
|
"source": []
|
|
}
|
|
],
|
|
"metadata": {
|
|
"kernelspec": {
|
|
"display_name": "roadmap (3.14.5)",
|
|
"language": "python",
|
|
"name": "python3"
|
|
},
|
|
"language_info": {
|
|
"codemirror_mode": {
|
|
"name": "ipython",
|
|
"version": 3
|
|
},
|
|
"file_extension": ".py",
|
|
"mimetype": "text/x-python",
|
|
"name": "python",
|
|
"nbconvert_exporter": "python",
|
|
"pygments_lexer": "ipython3",
|
|
"version": "3.14.5"
|
|
}
|
|
},
|
|
"nbformat": 4,
|
|
"nbformat_minor": 5
|
|
}
|