Expectation of random sum of non-random numbers I have a continuous random variable $\tau$ and I want to evaluate
$$
E\left(\sum_{i=1}^{\lfloor \tau \rfloor} Y_i\right),
$$
where $Y_i$ are known, non-random, and $\lfloor . \rfloor$ is the floor function. If $Y_i$s were iid I know I could use Wald's equation, for instance, but that is not the case. I am able to solve this through Monte Carlo, as I can simulate different $\tau$s. However, this will be very time-consuming since $Y_i$ can be big and the Monte Carlo samples can be large. It would be significantly easier if I could approximate the expectation above with
$$
\sum_{i=1}^{\lfloor E(\tau) \rfloor} Y_i.
$$
Is there a theoretical guarantee of this approximation?
Note on support: The vectors $Y_i$ are typically not large in magnitude, but they can be large in dimensions. The domain of $\tau$ is fixed to be $(1,N)$, where $N$ is known in advance, and it is unimodal.

Answer: Part 1 (Expectation of the $E(\tau)$ will not work)
To add to the previous answers about why the expectation will not work.
Consider the following, let us assume:

*

*$\tau$ uniformly distributed ~ Unif([1,3]) (i.e. p($\tau$=1)=p($\tau$=2)=p($\tau$=3)=$\frac{1}{3}$) [I.e. you will have to redefine your continuous distribution as a discrete one]

*$Y_1=1$,  $Y_2=5$,  $Y_3=100$
Then,

*

*$E(\tau)=2$

*$\Sigma_i^{E(\tau)} Y_i$ = 1+5 = 6

However, the real expectation is:

*

*$\frac{1}{3}(1) + \frac{1}{3}(1+5) + \frac{1}{3}(1+5+100)$ = 38


Answer: Part 2 (Explicit Formula for the expectation)
Starting with $E(\Sigma_{i=1}^{\lfloor\tau\rfloor}Y_i)$, we have:
$E(\Sigma_{i=1}^{\lfloor\tau\rfloor}Y_i)$ = $\Sigma_{i=1}^N p(\tau \geq i) Y_i$ = $\Sigma_{i=1}^N (1-p(\tau < i)) Y_i$ = $\Sigma_{i=1}^N (Y_i) - \Sigma_{i=1}^N p(\tau < i) Y_i$ = $\Sigma_{i=1}^N (Y_i) - \Sigma_{i=1}^N CDF_{\tau}(i) Y_i$
Where CDF is the Cumulatative Distribution Function.

I apologise for any mistakes I have made as this is my first post. Hope this helps.
