Path: news.mathworks.com!newsfeed-00.mathworks.com!kanaga.switch.ch!switch.ch!news.in2p3.fr!in2p3.fr!news.ecp.fr!gegeweb.org!de-l.enfer-du-nord.net!feeder.news-service.com!cyclone01.ams2.highwinds-media.com!news.highwinds-media.com!npeersf01.ams.highwinds-media.com!newsfe20.ams2.POSTED!7564ea0f!not-for-mail
Sender:  <tristram@cow.quantmodels.co.uk>
From: tristram.scott@ntlworld.com (Tristram Scott)
Subject: Re: What is the probability that random integers sum to a given value?
Newsgroups: comp.soft-sys.matlab
References: <h2de1d$sgb$1@fred.mathworks.com> <h2dvi2$sn3$1@fred.mathworks.com> <h2e02t$4bt$1@fred.mathworks.com> <h2e16h$hfr$1@fred.mathworks.com> <h2eur9$db8$1@fred.mathworks.com> <h2f1l9$4fo$1@fred.mathworks.com> <h2f4om$s57$1@fred.mathworks.com> <h2f5s9$bnl$1@fred.mathworks.com>
User-Agent: tin/1.7.7-20041215 ("Scalpay") (UNIX) (SunOS/5.10 (i86pc))
Lines: 38
Message-ID: <p5G2m.8$AX1.0@newsfe20.ams2>
NNTP-Posting-Host: 82.6.102.58
X-Complaints-To: http://netreport.virginmedia.com
X-Trace: newsfe20.ams2 1246440917 82.6.102.58 (Wed, 01 Jul 2009 09:35:17 UTC)
NNTP-Posting-Date: Wed, 01 Jul 2009 09:35:17 UTC
Organization: virginmedia.com
Date: Wed, 01 Jul 2009 09:35:17 GMT
Xref: news.mathworks.com comp.soft-sys.matlab:551924


David Heslop <david_heslop@xyz.com> wrote:
> Hi Bruno,
> sorry if this led to confusion, I hoped that I had made this aspect
> explicit in the original problem when stating that the integers had to be
> "unique".  I must have got mixed up with my stats terminology,
> Dave

Unique does imply that the sampling is without replacement, but it would
have avoided some confusion if you had been explicit on this.

In practice, though, I can't see it making much difference at all for the
problem you describe.  The exception is going to be right at the tails of
the distribution.

For the orders of magnitude that you suggest, integers between 1 and 500,
sampling 50 times, I would go with John's suggestion as use the central
limit theorem.

If you think of a very small number of samples, 2, then what you have is a
discrete triangular distribution.  You have 500^2 possible combinations,
each equally likely.  Of those, only 500 are the non-unique ones, and so
not allowed.  Now, if your range were integers between 1 and 10,
replacement might be relevant, but for the orders of magnitude you
describe, I don't think it is.

n = 500;
x0 = (1:n)';
p0 = ones(n,1)/n;
x2 = (2:2*n)'; % The sums
p2 = conv(p0,p0); % The probabilities
x2a = 2*x0; % The sums where we used the same number twice
p2a = p0.^2; % The probabilities
plot(x2,p2,x2a,p2a,'.')
grid on

-- 
Dr Tristram J. Scott
Energy Consultant