Calculating the first and second moments for the sum of functions of random variables

85 Views Asked by At

I am trying to calculate the first and second moments of a sum of $M$ functions, where each function $f(x_{m})$ takes a random variable $x_{m}$ as an argument. I would like to compare the calculations to the first and second moments obtained from some experimental data, where I approximate the expectation as the arithmetic mean over $N$ replicates of the experiment, $ \left< ... \right> = \frac{1}{N} \sum_{n=1}^{N} ...$.

The issue is that the probability distribution of the random variable is conditional on an a priori known parameter specific to each of the $N$ experiments, $P(x_{m} | y_{n}, z_{m}) $. There is also a parameter for each of the $M$ random variables, $z_{m}$, but these are also known a priori. It just means that each of the $M$ random variables are not identically distributed, but they are independent.

An important detail, the random variable $x_{m}$ can only take on a value in the range $0,...,y_{n}$. Because there are these lower and upper bounds I thought that expectations of $x_{m}$ had to be taken using the definite integral $\int_{0}^{y_{n}} dx_{m}$.

Calculating the first moment seemed straightforward, which I performed as follows

$$ \left< \sum_{m}^{M} f(x_{m}) \right> = \frac{1}{N} \sum_{n=1}^{N} \sum_{m=1}^{M} \left< f(x_{m}| y_{n}, z_{m}) \right> $$

where $\left< f(x_{m}) | y_{n}, z_{m}\right> = \int_{0}^{y_{n}} f(x_{m}) P(x_{m} | y_{n}, z_{m}) dx_{m} $

This seems to be correct. The calculation matches estimates from the experiment and is also close to values obtained from simulations.

I am getting tripped up when it comes to calculating the second moment however.

$$ \left< (\sum_{m=1}^{M} f(x_{m}))^{2} \right> = ? $$

I am familiar with the law of total expectation and how the second moment of a function of a random variable can be calculated. But here I am looking at the sum of many functions, each of which is the result of a random variable.

Thank you for reading this question. Apologies if my terminology is inaccurate or if I am confusing the mathematical expectation with the task of estimating the expected value from the data.