Simulate CDF of sum of i.i.d. F distributions

I have trouble on simulating the CDF of a random variable Y, where $Y = \sum_{i=1}^{12} X_i$, and $X_i$ are i.i.d. F-distribution.

I am doing this in MATLAB, the problem is that small instance of Y hardly occurs. I don't think I can use Importance Sampling since I don't know the density function of Y(I doubt there is an analytic formula). Central Limit Theorem won't work since 12 isn't very large.

What should I do? Thanks!

• Could you clarify what an "F-distribution" is? Are you referring to the central F distribution or just to some generic distribution? (Your remark about not knowing the density of $Y$ suggests the latter.) – whuber Nov 16 '17 at 22:14
• $X_i = \frac{U_1/d_1}{U_2/d_2}$, where $U_1$ and $U_2$ are independent Chi-Square distributions with degree of freedom $d_1$and$d_2$ respectively. – CQNKZX Nov 16 '17 at 22:53
• Then you do know the density and there is a simple closed formula for it: please visit the link I gave you. – whuber Nov 16 '17 at 22:57
• @whuber: do you mean there is a density for the $F$ distribution or for the sum? An eleven dimension convolution seems daunting. – Xi'an Nov 18 '17 at 7:05

I am not certain what you mean by "simulating the cdf of Y". From a simulated sample of $Y$'s you can certainly plot the empirical cdf. For instance,

y=apply(matrix(rf(12*1e5,df1=3,df2=7),ncol=12),1,sum)
plot(ecdf(y))


returns an empirical cdf in R. The precision of this approximation is provided by the Binomial nature of the empirical cdf, namely$$N\hat{F}(x)\sim\mathcal{B}(N,F(x))$$To show this precision I plotted 100 independent realisations of the above code on the same graph: the variability is of the order of the thickness of the lines used to draw the cdf.

The issue of not getting samples of $Y$ close to zero is an altogether different question that you should rephrase with more details.

However, one generic remark about the density of $Y$ being unavailable for basic importance sampling is that one can use Monte Carlo (de)marginalisation to get around the issue. Given that the density of $(X_1,\ldots,X_{12})$ is available as $$\prod_{i=1}^{12} \mathfrak{f}(x_i|\nu_1,\nu_2)$$it suffices to choose an importance function (density) on $(X_1,\ldots,X_{12})$ that produces small values of $(X_1,\ldots,X_{12})$, $$\prod_{i=1}^{12} \mathfrak{g}(x_i)$$ and to use the importance ratio $$\prod_{i=1}^{12} \mathfrak{f}(x_i|\nu_1,\nu_2)/\mathfrak{g}(x_i)$$

• That what I did. But is there a way to check how accurate is the empirical distribution function. I don't have any analytic result to compare with. Neither can I artificially get samples near 0 (like the trick in importance sampling). So I am not very confident about the empirical distribution function. – CQNKZX Nov 16 '17 at 22:50
• CQNKZX, by questioning this solution, you are suggesting either R's implementation of rf may be erroneous or that R does not add correctly. Let's assume you are willing to trust its addition. To verify the result, then, all you have to do is check that rf generates variates independently and according to the specified F distribution. Since you do know the density for that, the distribution check is straightforward to do: you may use QQ plots, compare a histogram to the density, and even run goodness of fit tests. There are many ways to check independence, too. – whuber Nov 16 '17 at 23:02
• The Monte Carlo marginalization you mentioned sounds very interesting, could you give me a reference about it, a book or paper will be great. Thank you! – CQNKZX Nov 17 '17 at 22:21
• We mention the notion of de-marginalisation in our book with George Casella, Monte Carlo Statistical Methods. – Xi'an Nov 18 '17 at 7:04
• @Xi'an Your answer is excellent! I just learnt how to accept your answer, thank you! – CQNKZX Nov 18 '17 at 22:44