A very simple question about the variance!
I'm interested in the variance of an expression with a random variable inside it.
For an expression of this form:
$a = \sum_{i=1}^{m}(x_i \cdot y_i - z_i)$
where $y_i$ is a random variable with an expectation $\mathbb{E}(y_i)$, would the expectation of the whole function simply be:
$\mathbb{E}(a)=\sum_{i=1}^{m}(x_i \cdot \mathbb{E}(y_i) - z_i)$
Since variance is $Var(a)=\mathbb{E}(a^2)-(\mathbb{E}(a))^2$, I assume I can simply plug this expression (if correct) into this variance formula. Is this correct?
Thanks!
If $x_i$ and $z_i$ are deterministic constants for each $i = 1, \ldots, m$, and $m$ is also a known constant--that is to say, $y_i$ for $i = 1, \ldots, n$ are the only random variables involved, and they are independent--then the variance of $a$ is better calculated as $$\operatorname{Var}[a] \overset{\text {ind}}{=} \sum_{i=1}^m x_i^2 \operatorname{Var}[y_i].$$ This is because $z_i$, being deterministic, has zero variance. If the $y_i$ are not independent, then the variance of $a$ will require knowing the covariances between each $y_i$, $y_j$ for $1 \le i \ne j \le m$ in addition to the variances of each $y_i$.