2.1 Random Variable
A random variable is a variable whose value is subject to variations due to chance.
Note: Mathematically, a random variable \(X:\Omega\rightarrow E\) is a measureable function from the set of of possible random outcomes \(\Omega\) to some set \(E\) where usually, \(E = \mathbb{R}\).
A discrete random variable is a random variable that can take only a countable number of distinct values (so the set \(E\) is countable).
- Example: A Binomial random variable is a discrete random variable \(X\) where \(X\) can take values \(0,1,2,...,n\) and \(P(X = x) = {n \choose x} p^x(1-p)^{n-x}\)
- Example: A Poisson random variable is a discrete random variable \(X\) where \(X\) can take values \(0,1,2,...\) and \(P(X = x) = \frac{\lambda^ke^{-\lambda}}{x!}\)
The distribution of a discrete random variable is described as a list of values and their associated probabilities, usually described with a probability mass function, \(p(x) = P(X = x)\).
A continuous random variable is a random variable that can take an uncountable (think infinite) number of distinct numerical values (the set \(E\) is a subset of \(\mathbb{R}\)).
The distribution of a continuous random variable is described with probabilities of intervals of values (rather than distinct values) through the cumulative distribution function (cdf), \(F(x) = P(X < x)\).
For most of the distributions we will talk about, the distribution can also be described with a probability density function (pdf) such that the cdf is defined as an integral over the pdf, \(F(x) = \int^x_{-\infty}f(y)dy\) where \(f(y) \geq 0\) is the pdf.
- Example: Uniform distribution on \([a,b]\) where \(f(x) = \frac{1}{b-a} \text{ if } a\leq x \leq b; 0\text{ otherwise }\).
- Example: Gaussian distribution on the real line, \(\mathbb{R}\), where \(f(x) = \frac{1}{\sigma\sqrt{2\pi}}e^{-\frac{1}{2}\left(\frac{x - \mu}{\sigma}\right)^2}\).
- Example: Beta distribution on \([0,1]\) where \(f(x) = \frac{\Gamma(\alpha+\beta)}{\Gamma(\alpha)\Gamma(\beta)}x^{\alpha-1}(1-x)^{\beta-1}\).