Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Stochastic Modeling

Problem-Solving Strategy

  1. Identify the Distribution: Recognize which distribution the problem involves

  2. Use Definitions: Start with the definition (PMF, PDF, or property)

  3. Check Conditions: Verify all conditions are met before applying theorems

  4. Use Linearity: Expectation is linear - use this whenever possible

  5. Conditioning: Break complex problems into simpler conditional problems

  6. Symmetry: Look for symmetry to simplify calculations

  7. Approximations: Use CLT for large nn approximations

Differentiation Rules

Power Ruleddxxn=nxn1\frac{d}{dx} x^n = n x^{n-1}
Exponentialddxeax=aeax\frac{d}{dx} e^{ax} = a e^{ax}
Natural Logddxln(x)=1x\frac{d}{dx} \ln(x) = \frac{1}{x}
Product Ruleddx[f(x)g(x)]=f(x)g(x)+f(x)g(x)\frac{d}{dx} [f(x)g(x)] = f'(x)g(x) + f(x)g'(x)
Quotient Ruleddx[f(x)g(x)]=f(x)g(x)f(x)g(x)[g(x)]2\frac{d}{dx} \left[\frac{f(x)}{g(x)}\right] = \frac{f'(x)g(x) - f(x)g'(x)}{[g(x)]^2}
Chain Ruleddxf(g(x))=f(g(x))g(x)\frac{d}{dx} f(g(x)) = f'(g(x)) \cdot g'(x)

Integration Rules

Power Rulexndx=xn+1n+1+C\int x^n dx = \frac{x^{n+1}}{n+1} + C (for n1n \neq -1)
Exponentialeaxdx=1aeax+C\int e^{ax} dx = \frac{1}{a} e^{ax} + C
Natural Log1xdx=lnx+C\int \frac{1}{x} dx = \ln|x | + C
Integration by Partsudv=uvvdu\int u dv = uv - \int v du
xeaxdx=uvvduu=xdv=eaxdxdu=dxv=eaxa\begin{align*} \int x e^{ax} \, dx &= uv - \int v \, du \\ u &= x & dv &= e^{ax} \, dx \\ du &= dx & v &= \frac{e^{ax}}{a} \end{align*}
ex2dx=π0eaxdx=1afor a>00xeaxdx=1a20x2eaxdx=2a3\begin{align*} \int_{-\infty}^{\infty} e^{-x^2} dx &= \sqrt{\pi} & \int_0^{\infty} e^{-ax} dx &= \frac{1}{a} \quad \text{for } a > 0 \\ \int_0^{\infty} x e^{-ax} dx &= \frac{1}{a^2} & \int_0^{\infty} x^2 e^{-ax} dx &= \frac{2}{a^3} \end{align*}

Probability

A Probability Space is a triple (Ω,A,P)(\Omega, \mathcal{A}, P), where: Ω\Omega: Set of outcomes, A\mathcal{A}: Set of events, PP: Probability measure.

A Probability Measure P:ARP: \mathcal{A} \to \mathbb{R} satisfies:

  1. 0P(A)1AA0 \leq P(A) \leq 1 \quad \forall \, A \in \mathcal{A}

  2. P(Ω)=1P(\Omega) = 1

  3. P(i=1Ai)=i=1P(Ai)P\left(\bigcup_{i=1}^\infty A_i\right) = \sum_{i=1}^\infty P(A_i)

Random Variable: X:ΩRX: \Omega \to \mathbb{R}

P(A)=AΩP(EF)=P(EF)P(F)P(AB)=P(A)P(BA)=P(B)P(AB)P(AE)=P(EA)P(A)P(E)\begin{align*} P(A) &= \frac{|A|}{|\Omega|} \\ P(E|F) &= \frac{P(E \cap F)}{P(F)} & P(A \cap B) &= P(A)P(B|A) = P(B)P(A|B) \\ P(A|E) &= \frac{P(E|A)P(A)}{P(E)} & \end{align*}

Bayes’ Theorem

P(AE)=P(EA)P(A)P(E)=P(EA)P(A)P(EA)P(A)+P(EAc)P(Ac)P(A|E) = \frac{P(E|A) \cdot P(A)}{P(E)} = \frac{P(E|A) \cdot P(A)}{P(E|A) \cdot P(A) + P(E|A^c) \cdot P(A^c)}

Independence

XX and YY are independent if one of the following is true:

FX,Y(a,b)=FX(a)FY(b)a,bfX,Y(x,y)=fX(x)fY(y), (continous RV)P(X=x,Y=y)=P(X=x)P(Y=y), (discrete RV)\begin{aligned} F_{X,Y}(a,b) &= F_X(a) F_Y(b) \quad \forall a,b \\ f_{X,Y}(x,y) &= f_X(x)f_Y(y) \quad \text{, (continous RV)} \\ P(X=x, Y=y) &= P(X=x)P(Y=y) \quad \text{, (discrete RV)} \end{aligned}

Consequences of Independence

P(EF)=P(E)P(EF)=P(E)P(F)E[XY]=E[X]E[Y]Cov(X,Y)=0Var(X+Y)=Var(X)+Var(Y)ϕX+Y(t)=ϕX(t)ϕY(t)\begin{align*} P(E|F) &= P(E) \\ P(E \cap F) &= P(E) \cdot P(F) \\ \mathbb{E}[XY] &= \mathbb{E}[X]\mathbb{E}[Y] \\ \operatorname{Cov}(X,Y) &= 0 \\ \operatorname{Var}(X+Y) &= \operatorname{Var}(X) + \operatorname{Var}(Y) \\ \phi_{X+Y}(t) &= \phi_X(t) \phi_Y(t) \end{align*}

Law of Total Probability

Expectation, Variance, Covariance, Correlation Coefficient (normalized Covariance)

E[X]=xP(X=x)E[X]=xfX(x)dxE[X2]=Var(X)+(E[X])2Var(X)=E[X2](E[X])2Var(aX+b)=a2Var(X)Cov(X,Y)=E[XY]E[X]E[Y]ρX,Y=Cov(X,Y)Var(X)Var(Y)[1,1]\begin{align*} \boldsymbol{\mathbb{E}[X]} &= \sum x P(X=x) & \boldsymbol{\mathbb{E}[X]} &= \int x f_X(x) dx \\ \boldsymbol{\mathbb{E}[X^2]} &= \text{Var}(X) + (\mathbb{E}[X])^2 & \\ \boldsymbol{\operatorname{Var}(X)} &= \mathbb{E}[X^2] - (\mathbb{E}[X])^2 & \boldsymbol{\operatorname{Var}(aX+b)} &= a^2 \operatorname{Var}(X) \\ \boldsymbol{\operatorname{Cov}(X,Y)} &= \mathbb{E}[XY] - \mathbb{E}[X]\mathbb{E}[Y] & \boldsymbol{\rho_{X,Y}} &= \frac{\operatorname{Cov}(X,Y)}{\sqrt{\operatorname{Var}(X)\operatorname{Var}(Y)}} \in [-1, 1] \end{align*}
E[aX+bY]=aE[X]+bE[Y]for any RVs X,Y and constants a,b\mathbb{E}[aX + bY] = a\mathbb{E}[X] + b\mathbb{E}[Y] \quad \text{for any RVs } X, Y \text{ and constants } a, b
Var(aX)=a2Var(X)Var(X+Y)=Var(X)+Var(Y)+2Cov(X,Y)Var(X+c)=Var(X)for constant c\begin{align*} \operatorname{Var}(aX) &= a^2 \operatorname{Var}(X) \\ \operatorname{Var}(X + Y) &= \operatorname{Var}(X) + \operatorname{Var}(Y) + 2\operatorname{Cov}(X, Y) \\ \operatorname{Var}(X + c) &= \operatorname{Var}(X) \quad \text{for constant } c \end{align*}
Cov(X,X)=Var(X)Cov(X,Y)=Cov(Y,X)Cov(aX+b,cY+d)=acCov(X,Y)Cov(X+Y,Z)=Cov(X,Z)+Cov(Y,Z)Cov(X,Y+Z)=Cov(X,Y)+Cov(X,Z)\begin{align*} \operatorname{Cov}(X,X) &= \operatorname{Var}(X) \\ \operatorname{Cov}(X,Y) &= \operatorname{Cov}(Y,X) \\ \operatorname{Cov}(aX + b, cY + d) &= ac \operatorname{Cov}(X,Y) \\ \operatorname{Cov}(X + Y, Z) &= \operatorname{Cov}(X,Z) + \operatorname{Cov}(Y,Z) \\ \operatorname{Cov}(X, Y + Z) &= \operatorname{Cov}(X,Y) + \operatorname{Cov}(X,Z) \end{align*}

Moment Generating Function

Let XX be a random variable with density function

fX(x)={e2x+12exif x>00otherwisef_X(x) = \begin{cases} e^{-2x} + \frac{1}{2}e^{-x} & \text{if } x > 0 \\ 0 & \text{otherwise} \end{cases}
ϕX(t)=E[etX]=0etx(e2x+12ex)dx=0(e(t2)x+12e(t1)x)dx\phi_X(t) = \mathbb{E}\left[e^{tX}\right] = \int_0^\infty e^{tx} \left(e^{-2x} + \frac{1}{2}e^{-x}\right) dx = \int_0^\infty \left(e^{(t-2)x} + \frac{1}{2}e^{(t-1)x}\right) dx

The moment generating function must have a finite integral to exist. For this integral to converge at xx \to \infty, both exponential terms must decay. The stricter condition is t<1t < 1, so the MGF is only defined for t<1t < 1.

Joint Distributions

Conditional Distributions & Expectation

DiscreteContinousPXY(xy)=P(X=xY=y)=P(X=x,Y=y)P(Y=y)fXY(xy)=fX,Y(x,y)fY(y)E[XY=y]=xxPXY(xy)E[XY=y]=xfXY(xy)dx\begin{align*} \textbf{Discrete} & & & \textbf{Continous} \\ P_{X|Y}(x|y) &= P(X = x | Y = y) = \frac{P(X = x, Y = y)}{P(Y = y)} & f_{X|Y}(x|y) &= \frac{f_{X,Y}(x,y)}{f_Y(y)} \\ \mathbb{E}[X|Y = y] &= \sum_x x P_{X|Y}(x|y) & \mathbb{E}[X|Y = y] &= \int_{-\infty}^{\infty} x f_{X|Y}(x|y) \, dx \end{align*}

Important: E[XY]\mathbb{E}[X|Y] is itself a random variable (function of YY)

Transformation of Random Variables

For a continuous RV XX with density fX(x)f_X(x) and a differentiable, strictly monotone function gg for yy in the range of gg; fY(y)=0f_Y(y) = 0 outside:

Y=g(X)    fY(y)=fX(g1(y))g(g1(y))Y = g(X) \implies f_Y(y) = \frac{f_X(g^{-1}(y))}{|g'(g^{-1}(y))|}

Example: Joint Density of XX and YY

Joint density function: fX,Y(x,y)={10x2y,if 0yx1,0,otherwisef_{X,Y}(x,y) = \begin{cases} 10x^2 y, & \text{if } 0 \leq y \leq x \leq 1, \\ 0, & \text{otherwise} \end{cases}

Law of Total Expectation

E[X]=E[E[XY]]\mathbb{E}[X] = \mathbb{E}[\mathbb{E}[X|Y]]

Conditional Variance

Var(XY=y)=E[X2Y=y](E[XY=y])2\operatorname{Var}(X|Y = y) = \mathbb{E}[X^2|Y = y] - (\mathbb{E}[X|Y = y])^2

Law of Total Variance

Var(X)=E[Var(XY)]+Var(E[XY])\operatorname{Var}(X) = \mathbb{E}[\operatorname{Var}(X|Y)] + \operatorname{Var}(\mathbb{E}[X|Y])

Distributions

PMF P(X=k)P(X=k)SupportE[X]\boldsymbol{\mathbb{E}[X]}Var(X)\boldsymbol{\operatorname{Var}(X)}MGF
Uniform (a,b),n=ba+1(a, b), n = b - a + 11n\frac{1}{n}k{1,,n}k \in \{1,\dots,n\}a+b2\frac{a+b}{2}n2112\frac{n^2-1}{12}eate(b+1)tn(1et)\frac{e^{at} - e^{(b+1)t}}{n(1 - e^t)}
Bernoulli (p)(p)pk(1p)1kp^k(1-p)^{1-k}k{0,1}k \in \{0,1\}ppp(1p)p(1-p)pet+(1p)pe^t + (1-p)
Binomial (n,p)(n, p)(nk)pk(1p)nk\binom{n}{k}p^k(1-p)^{n-k}k{0,,n}k \in \{0,\dots,n\}npnpnp(1p)np(1-p)(pet+1p)n(pe^t + 1-p)^n
Geometric (p)(p)(1p)k1p(1-p)^{k-1}pkNk \in \mathbb{N}1p\frac{1}{p}1pp2\frac{1-p}{p^2}pet1(1p)et\frac{pe^t}{1-(1-p)e^t}
Poisson (λ)(\lambda)λkeλk!\frac{\lambda^k e^{-\lambda}}{k!}kN0k \in \mathbb{N}_0λ\lambdaλ\lambdaeλ(et1)e^{\lambda(e^t-1)}
PDF fX(x)f_X(x)SupportE[X]\boldsymbol{\mathbb{E}[X]}Var(X)\boldsymbol{\operatorname{Var}(X)}MGF
Uniform (a,b)(a, b)1ba\frac{1}{b-a}x[a,b]x \in [a,b]a+b2\frac{a+b}{2}(ba)212\frac{(b-a)^2}{12}{etbetat(ba)for t01for t=0\begin{cases}\frac{e^{tb} - e^{ta}}{t(b-a)} & \text{for } t \neq 0 \\ 1 & \text{for } t = 0 \end{cases}
Exponential (λ)(\lambda)λeλx\lambda e^{-\lambda x}x0x \geq 01λ\frac{1}{\lambda}1λ2\frac{1}{\lambda^2}λλt\frac{\lambda}{\lambda - t}
Gamma (k,λ)(k, \lambda)λkΓ(k)xk1eλx\frac{\lambda^k}{\Gamma(k)} x^{k-1} e^{-\lambda x}, for Γ(n)=(n1)!\Gamma(n) = (n-1)!x0x \geq 0kλ\frac{k}{\lambda}kλ2\frac{k}{\lambda^2}(λλt)k\left(\frac{\lambda}{\lambda - t}\right)^k
Normal (μ,σ2)(\mu, \sigma^2)12πσ2e(xμ)22σ2\frac{1}{\sqrt{2\pi\sigma^2}} e^{-\frac{(x-\mu)^2}{2\sigma^2}}xRx \in \mathbb{R}μ\muσ2\sigma^2etμ+12t2σ2e^{t\mu + \frac{1}{2}t^2\sigma^2}

Normal Distribution

Limit Theorems

Given: XiX_i: i.i.d. RV with E[Xi]=μ\mathbb{E}[X_i] = \mu, Var(Xi)=σ2\text{Var}(X_i) = \sigma^2, then:

Example: Law of Large Numbers

Precise statement: limnP(Snn13ϵ)=0ϵ>0\lim_{n \to \infty} \mathbb{P}\left(\left|\frac{S_n}{n} - \frac{1}{3}\right| \geq \epsilon\right) = 0 \quad \forall \epsilon > 0

Weak Law of Large Numbers, as nn \to \infty: SnnPp=13\frac{S_n}{n} \xrightarrow{\mathbb{P}} p = \frac{1}{3}

Example: Central Limit Theorem Approximation

Given: SBinomial(n=160000,p=0.5)S \sim \text{Binomial}(n=160'000, p=0.5).

E[S]=80000\mathbb{E}[S] = 80'000, Var(S)=40000\text{Var}(S) = 40'000, σ=textVar(S)=200\sigma = \sqrt{'text{Var}(S)} = 200

P(S80,200)P(Z80,200.580,000200)=P(Z1.0025)Φ(1)0.841.\mathbb{P}(S \leq 80{,}200) \approx \mathbb{P}\left(Z \leq \frac{80{,}200.5 - 80{,}000}{200}\right) = \mathbb{P}(Z \leq 1.0025) \approx \Phi(1) \approx \boxed{0.841}.

Chebyshev’s Inequality

P(Xμε)σ2ε2\begin{align*} P(|X-\mu| \geq \varepsilon) &\leq \frac{\sigma^2}{\varepsilon^2} \end{align*}

Example: Chebyshev’s Inequality for S900S_{900}

Given: S900Binomial(n=900,p=1/3)S_{900} \sim \text{Binomial}(n=900, p=1/3).

E[S900]=300\mathbb{E}[S_{900}] = 300, Var(S900)=9001323=200\text{Var}(S_{900}) = 900 \cdot \frac{1}{3} \cdot \frac{2}{3} = 200

P(S90030020)1Var(S900)202=1200400=12.\mathbb{P}(|S_{900} - 300| \leq 20) \geq 1 - \frac{\text{Var}(S_{900})}{20^2} = 1 - \frac{200}{400} = \frac{1}{2}.

The probability is greater than or equal to 12\frac{1}{2}

Markov’s Inequality

For any non-negative random variable XX (i.e., X0X \geq 0) and any a>0a \gt 0, the following is always true:

P(Xa)E[X]aP(X \geq a) \leq \frac{\mathbb{E}[X]}{a}

Markov Chains

Markov Property: P(Xn+1Xn,,X0)=P(Xn+1Xn)Chapman-Kolmogorov: pij(m+n)=kpik(m)pkj(n)Stationary: π=πPConvergence: νPnπ\begin{align*} \textbf{Markov Property: } P(X_{n+1}|X_n, \ldots, X_0) &= P(X_{n+1}|X_n) & \textbf{Chapman-Kolmogorov: } p_{ij}^{(m+n)} &= \sum_k p_{ik}^{(m)} p_{kj}^{(n)} \\ \textbf{Stationary: } \vec{\pi} &= \vec{\pi} P & \textbf{Convergence: } \vec{\nu} P^n &\to \vec{\pi} \end{align*}

Transition Matrix

One-step transition probabilities pij=P(Xn+1=jXn=i)p_{ij} = P(X_{n+1} = j \mid X_n = i) form the transition matrix:

P=(p11p12p1kp21p22p2kpk1pk2pkk)Rk×kP = \begin{pmatrix} p_{11} & p_{12} & \cdots & p_{1k} \\ p_{21} & p_{22} & \cdots & p_{2k} \\ \vdots & \vdots & \ddots & \vdots \\ p_{k1} & p_{k2} & \cdots & p_{kk} \\ \end{pmatrix} \in \mathbb{R}^{k \times k}

Irreducibility

pij(n)>0p_{ij}^{(n)} > 0

Every state can be reached from every other state in a finite number of steps. The state space cannot be partitioned into disjoint subsets that the chain never leaves.

Aperiodicity

A Markov chain is aperiodic if all its states are aperiodic. The period of state ii is defined as:

d(i)=gcd{n1:pii(n)>0}d(i) = \gcd\{n \geq 1: p_{ii}^{(n)} > 0\}

An aperiodic chain can return to any state at irregular intervals, not just multiples of a fixed period.

Irreducibility & Aperiodicity Combined

If a finite-state Markov chain is both irreducible and aperiodic, then:

Example: Californian Weather Model

Time-homogeneous Markov chain {Xn:nN}\{X_n: n \in \mathbb{N}\} with initial distribution π(0):=(16,56)\vec{\pi}(0) := \left(\frac{1}{6}, \frac{5}{6}\right) and transition matrix

P=(0.50.50.10.9)\mathbf{P} = \begin{pmatrix} 0.5 & 0.5 \\ 0.1 & 0.9 \end{pmatrix}

Show for any nNn \in \mathbb{N}: π(n)=π(0)\vec{\pi}(n) = \vec{\pi}(0)

π(n+1)=π(n)P=(16,56)(0.50.50.10.9)=(160.5+560.1,160.5+560.9)=(16,56)\vec{\pi}(n+1) = \vec{\pi}(n) \mathbf{P} = \left(\frac{1}{6}, \frac{5}{6}\right) \begin{pmatrix} 0.5 & 0.5 \\ 0.1 & 0.9 \end{pmatrix} = \left(\frac{1}{6} \cdot 0.5 + \frac{5}{6} \cdot 0.1, \frac{1}{6} \cdot 0.5 + \frac{5}{6} \cdot 0.9\right) = \left(\frac{1}{6}, \frac{5}{6}\right)

Interpretation: The initial distribution (16,56)\left(\frac{1}{6}, \frac{5}{6}\right) is stationary for this chain.

Stochastic Processes

Mean: mX(t)=E[Xt]Variance: Var(Xt)=E[Xt2](E[Xt])2Covariance: CX(t1,t2)=RX(t1,t2)mX(t1)mX(t2)Correlation: RX(t1,t2)=E[Xt1Xt2]\begin{align*} \textbf{Mean: } m_X(t) &= \mathbb{E}[X_t] & \textbf{Variance: } \text{Var}(X_t) &= \mathbb{E}[X_t^2] - (\mathbb{E}[X_t])^2 \\ \textbf{Covariance: } C_X(t_1,t_2) &= R_X(t_1,t_2) - m_X(t_1)m_X(t_2) & \textbf{Correlation: } R_X(t_1, t_2) &= \mathbb{E}[X_{t_1} X_{t_2}] \end{align*}

zero-mean processes: RX(t1,t2)=Cov(Xt1,Xt2)R_X(t_1, t_2) = \operatorname{Cov}(X_{t_1}, X_{t_2})

DescriptionmX(t)\boldsymbol{m_X(t)}Var(Xt)\boldsymbol{Var(X_t)}RX(t1,t2)\boldsymbol{R_X(t_1, t_2)}
BernoulliXnX_n i.i.d. ±1\pm 1 valued2p12p-14p(1p)4p(1-p)(2p1)2(2p-1)^2 for t1t2t_1\neq t_2
Random WalkXn=i=1nBiX_n = \sum_{i=1}^n B_i0 (if p=1/2p=1/2)nnmin(t1,t2)\min(t_1, t_2)
Brownian MotionContinuous limit of RW0ttmin(t1,t2)\min(t_1, t_2)
PoissonCounts events in timeλt\lambda tλt\lambda tλmin(t1,t2)\lambda \min(t_1, t_2)
White NoiseXti.i.d.(0,σ2)X_t \sim \text{i.i.d.}(0, \sigma^2)σ2δt1,t2\sigma^2 \delta_{t_1,t_2} for δt1,t2\delta_{t_1,t_2} := if (t1=t2t_1 = t_2) 1 else 0
Wiener ProcessWtN(0,t)W_t \sim \mathcal{N}(0, t)min(t1,t2)\min(t_1, t_2)

Wide-Sense Stationary (WSS):

Example: Stochastic Process Yn=12(Xn+Xn1)Y_n = \frac{1}{2}(X_n + X_{n-1})

Given: XnX_n i.i.d., E[Xn]=2\mathbb{E}[X_n] = 2, Var(Xn)=3\text{Var}(X_n) = 3

Poisson Process

Models the number of events with {N(t):t0}\{N(t) : t \geq 0\}. It satisfies the following properties:

The number of events N(t)N(t) in an interval of length tt follows a Poisson distribution:

P(N(t)=k)=(λt)keλtk!,k=0,1,2,\mathbb{P}(N(t) = k) = \frac{(\lambda t)^k e^{-\lambda t}}{k!}, \quad k = 0, 1, 2, \dots

For N(t)Poisson(λt)N(t) \sim \text{Poisson}(\lambda t):

Example: Poisson Process (Rate λ=2\lambda = 2 per month)