Probability Background: Expectations
$$
\[ \mathop{\mathrm{E}}[X] = \sum_x \textcolor[RGB]{239,71,111}{x}\textcolor[RGB]{17,138,178}{P(X=x)} \]
\[ \begin{aligned} \mathop{\mathrm{\mathop{\mathrm{V}}}}[X] &= \mathop{\mathrm{E}}\qty[ (X - \mathop{\mathrm{E}}X)^2 ] \\ \mathop{\mathrm{sd}}[X] &= \sqrt{\mathop{\mathrm{\mathop{\mathrm{V}}}}[X]} \end{aligned} \]
\[ \mathop{\mathrm{E}}[Y] = \sum_{j=1}^m \underset{\text{response}}{y_j} \times \underset{\text{probability}}{\frac{1}{m}} = \frac{1}{m}\sum_{j=1}^m y_j = \bar y \]
These are repeated in the next lecture.
\[ \begin{aligned} E[ a Y + b Z ] &= E[aY] + E[bZ] \\ &= aE[Y] + bE[Z] \\ & \text{ for random variables $Y, Z$ and numbers $a,b$ } \end{aligned} \]
\[ \small{ \begin{aligned} \mathop{\mathrm{E}}\qty[ a Y + b Z ] &= \sum_{y}\sum_z (a y + b z) \ P(Y=y, Z=z) && \text{ by definition of expectation} \\ &= \sum_{y}\sum_z a y \ P(Y=y, Z=z) + \sum_{z}\sum_y b z \ P(Y=y, Z=z) && \text{changing the order in which we sum} \\ &= \sum_{y} a y \ \sum_z P(Y=y,Z=z) + \sum_{z} b z \ \sum_y P(Y=y,Z=z) && \text{pulling constants out of the inner sums} \\ &= \sum_{y} a y \ P(Y=y) + \sum_{z} b z \ P(Z=z) && \text{summing to get marginal probabilities from our joint } \\ &= a\sum_{y} y \ P(Y=y) + b\sum_{z} z \ P(Z=z) && \text{ pulling constants out of the remaining sum } \\ &= a\mathop{\mathrm{E}}Y + b \mathop{\mathrm{E}}Z && \text{by definition} \end{aligned} } \]
The expectation of a product of independent random variables is the product of their expectations. \[ \mathop{\mathrm{E}}[YZ] = \mathop{\mathrm{E}}[Y]\mathop{\mathrm{E}}[Z] \qqtext{when $Y$ and $Z$ are independent} \]
This comes up a lot in variance calculations. Let’s prove it. It’ll be good practice.
\[ \begin{aligned} \mathop{\mathrm{E}}[YZ] &= \sum_{yz} yz \ P(Y=y, Z=z) && \text{by definition of expectation} \\ &= \sum_y \sum_z yz \ P(Y=y) P(Z=z) && \text{factoring and ordering sums } \\ &= \textcolor[RGB]{17,138,178}{\sum_y y \ P(Y=y)} \textcolor[RGB]{239,71,111}{\sum_z z \ P(Z=z)} && \text{pulling factors that don't depend on $z$ out of the inner sum} \\ & \textcolor[RGB]{17,138,178}{\mathop{\mathrm{E}}[Y]} \textcolor[RGB]{239,71,111}{\mathop{\mathrm{E}}[Z]} && \text{by definition of expectation} \end{aligned} \]
Claim. The sample mean is an unbiased estimator of the population mean when we use sampling with replacement, sampling without, randomized circular sampling, etc. \[ \mathop{\mathrm{E}}[\hat\mu] = \mu \qqtext{ for} \hat\mu = \frac1n\sum_{i=1}^n Y_i \qand \mu = \frac1m\sum_{j=1}^m y_j \]
Proof.
\[ \begin{aligned} \mathop{\mathrm{E}}\qty[\frac1n\sum_{i=1}^n Y_i] &= \frac1n\sum_{i=1}^n \mathop{\mathrm{E}}[Y_i] && \text{ via linearity } \\ &= \frac1n\sum_{i=1}^n \frac{1}{m}\sum_{j=1}^m y_j \times \frac{1}{m} && \text{ via equal-probability sampling } \\ &= \frac1{n} \mu &&\text{ by definition } &= \frac1n \times n \times \mu = \mu. \end{aligned} \]
This is what the central limit theorem says.
This is due to the linearity of expectation.
This is what the law of large numbers says.