Expectation, Variance, and Moments
Expectation summarizes the center of a distribution; variance measures spread. Higher moments and moment-generating functions characterize shape and convergence.
Key Points
- Expectation is linear even when variables are dependent.
- Variance is $\operatorname{Var}(X) = \mathbb{E}[(X-\mu)^2]$.
- Covariance measures linear association between two random variables.
Formulas
Variance
$$\operatorname{Var}(X) = \mathbb{E}[X^2] - (\mathbb{E}[X])^2$$
Covariance
$$\operatorname{Cov}(X,Y) = \mathbb{E}[(X-\mu_X)(Y-\mu_Y)]$$
Chebyshev's inequality
$$P(|X-\mu| \ge k\sigma) \le \frac{1}{k^2}$$
Code Example
import numpy as np
X = np.random.randn(10000)
Y = 2*X + np.random.randn(10000)
print(np.cov(X, Y))