Independent and identically distributed random variables (source code)

= Independent and identically distributed random variables
{title2=$X_i\overset{\mathrm{iid}}{\sim}\nu$}
{wiki}

= Independent and identically distributed
{synonym}

= IID random variable
{c}
{synonym}

= IID sample
{c}
{synonym}

= Random sample
{synonym}

= IID sequence
{c}
{synonym}

= Independent and identically distributed sequence
{synonym}

= i.i.d.
{synonym}

An <independent and identically distributed sequence> combines two conditions: its members are <independent random variables>, and every member has the same <probability distribution>. For a finite <sequence> $X_1,\ldots,X_n$ with common law $\nu$, this means that for all <measurable sets> $B_1,\ldots,B_n$,
$$
\boxed{\mathbb P(X_1\in B_1,\ldots,X_n\in B_n)=\prod_{i=1}^n\nu(B_i).}
$$
For an infinite <sequence>, require this condition for every finite collection of distinct indices. Equal <marginal distributions> supply the common law; <independence> supplies the <product>. Neither condition supplies the other. Grinstead and Snell call the combination an independent trials process.<Introduction to Probability by Charles M. Grinstead and J. Laurie Snell>[§4.1, Definitions 4.4–4.5, printed pp. 143–144: mutual independence and a common distribution]{ref}

Choose a <Bernoulli distribution> with success <probability> $1/2$. Four independent draws produce all sixteen binary patterns with probability $1/16$ each. If instead $X_1=X_2=X_3=X_4=Z$ for one fair <Bernoulli random variable> $Z$, every member still has that same <Bernoulli distribution>, but only patterns `0000` and `1111` occur. Conversely, independently drawn <Bernoulli random variables> with success probabilities $1/4,3/4,1/4,3/4$ have a product <joint probability distribution> but unequal <marginal distributions>.

\Image[/iid-sample-assumption-models.png]
{title=IID sampling combines a common distribution with separate independent draws}
{description=Original constructions of four <Bernoulli random variables>. Separate arrows in the first and third panels represent explicitly independent source draws; the middle panel copies one shared draw. Dependence and marginal laws are specified by the chosen models.}

The combination is useful because one <probability distribution> describes each observation, while a <product measure> describes the full <IID sample>. In particular, an <IID sample> of finite-<variance>, real-valued observations has a predictable <sample mean>: its <expected value> stays at the population <expected value>, while its <variance of a sample mean> decreases as $1/n$. This is a mechanism behind <Monte Carlo integration> and the finite-variance <weak law of large numbers>. Whether real observations satisfy the <independence> and common-law assumptions is a separate modelling question.