Skip to main content
8 events
when toggle format what by license comment
Jul 26, 2015 at 0:47 vote accept Chris Idzerda
Nov 22, 2012 at 0:01 comment added whuber It is because they are very rapidly decreasing, extremely smooth, and the derivatives don't get terribly large. You don't have to integrate from $-\infty$ to $\infty$, either: you can compute, say, each of the $\mu_i \pm k \sigma_i$ for a suitable constant $k$ (around $6$ should do fine, perhaps a little larger for larger $n$) and integrate from the least to the greatest of those values, knowing that essentially all the action must take place in that range (towards the upper part of it, actually). Your biggest problem may be checking for underflow :-).
Nov 21, 2012 at 23:50 comment added Chris Idzerda Thank you, @whuber, I appreciate your attention. I'm surprised it takes so few intervals to get such a good result. I suppose that's because the tails of the Gaussian are sufficiently small.
Nov 21, 2012 at 22:41 comment added whuber Chris, The integration can go very quickly, because the integrand is so nicely behaved. For instance, applying Simpson's Rule in my example over the range $[-1,5]$ with intervals of $1/10$ (just $61$ evaluations, 0.006 seconds) agreed with the correct result to more than five significant figures (and using just $13$ evaluations with a spacing of $1/2$, equal to a typical SD of the $X_i$, still got the answer correct almost to four sig figs--as good as the simulation). @Dilip That's right, but even slight deviations from iid can create enormous variation among the answers when $n$ is sizable.
Nov 21, 2012 at 22:36 comment added Dilip Sarwate It is also worth noting that if all the $X_i$'s are iid continuous random variables, then the probability is $\frac{1}{n}$ without the need for numerical integration or simulation
Nov 21, 2012 at 22:01 comment added Chris Idzerda I started with a simulation, written in Python, and it didn't perform very well for $n = 12$. My preference is to use your numerical integration solution. Perhaps I can use numpy since most of my other work is in Python. Otherwise, I'll probably use Octave or R (or perhaps even C).
Nov 21, 2012 at 20:58 comment added whuber For future reference: this answer generalizes to the case where the $X_i$ may have entirely different distributions altogether, provided they are continuous. (Care is needed in dealing with ties for distributions that are not continuous.) The independence assumption is still essential. (Without this assumption, solutions can still be obtained with numerical integration or simulation, but both are more difficult to carry out and require the dependence to be explicitly represented.)
Nov 21, 2012 at 20:23 history answered whuber CC BY-SA 3.0