# Sample Size for Exponential Distribution

I'm having a bit of trouble with a simple question.

I have data for a product, amount and days on which it was sold, that when plotted as a cumulative histogram follows an exponential cdf. I want to predict how many items are sold in the next x days. For this I sample my exponential cdf x times and sum up the result.

I would now like to reduce the deviation by repeating the above process a number of times and taking the mean of the different results. Until now I have used a large hard-coded number but there has to be a formula for calculating my sample size, i.e. the minimum number of times I need to rerun my simulation to obtain a certain confidence interval.

Any help is appreciated.

• My understanding: you have historical observations that you assume are iid from an exponential distribution. Correct? You wish to have an estimate for the sum of $k$ samples from this distribution, if possible with a confidence interval. Also correct? Commented Mar 30, 2020 at 12:51
• @StephanKolassa Yes, exactly.
– anon
Commented Mar 30, 2020 at 13:32
• OK, thanks. In that case, the mean of the sum of $k$ iid variables is just $k$ times the mean of each variable, so you can simply take the expectation of your fitted exponential distribution and multiply by $k$. Any particular reason why you are not doing this? Commented Mar 30, 2020 at 14:37
• If you are interested in confidence intervals for this mean, the uncertainty comes exclusively from the uncertainty in your estimates for the exponential. I don't think there is a closed formula for how this carries through, and in any case, if I understand you correctly, you are treating your fitted exponential as fixed, so under this assumption, there is no relevant CI any more. If you want to relax that assumption (and you probably should), then I would bootstrap the entire estimation procedure before taking means. Commented Mar 30, 2020 at 14:40
• It may also be helpful to note that the sum of $k$ iid exponentials with mean $\lambda$ is Erlang distributed with parameters $k$ and $\lambda$. The quantiles from the Erlang may be what you are looking for. Commented Mar 30, 2020 at 14:41

The mean of the sum of $$k$$ iid variables is just $$k$$ times the mean of each variable, so you can simply take the expectation of your fitted exponential distribution and multiply by $$k$$.

If you are interested in confidence intervals for this mean, the uncertainty comes exclusively from the uncertainty in your estimates for the exponential. I don't think there is a closed formula for how this carries through, and in any case, if I understand you correctly, you are treating your fitted exponential as fixed, so under this assumption, there is no relevant CI any more. If you want to relax that assumption (and you probably should), then I would bootstrap the entire estimation procedure before taking means.

It may also be helpful to note that the sum of $$k$$ iid exponentials with mean $$\lambda$$ is Erlang distributed with parameters $$k$$ and $$\lambda$$. The quantiles from the Erlang may be what you are looking for.

Finally, I do a lot of demand forecasting. My first reaction was, to be honest, that assessing CIs for an iid assumption is not what you should be doing. In sales, you typically have strongly nonstationary series, which include all kinds of , price/promotion as a driver etc. Are you sure you are complexifying your approach in the right direction?