MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi
Learn moreOpportunities for recent engineering grads.
Apply TodayMATLAB Central > MATLAB Newsreader > What is the probability that random integers sum t... 

Subject: What is the probability that random integers sum to a given value? From: David Heslop Date: 30 Jun, 2009 16:21:02 Message: 1 of 24 
Can anybody suggest an efficient method to approach this problem? 
Subject: What is the probability that random integers sum to a given value? From: John D'Errico Date: 30 Jun, 2009 17:02:01 Message: 2 of 24 
"David Heslop" <david_heslop@xyz.com> wrote in message <h2de1d$sgb$1@fred.mathworks.com>... 
Subject: What is the probability that random integers sum to a given value? From: Bruno Luong Date: 30 Jun, 2009 21:20:02 Message: 3 of 24 
"David Heslop" <david_heslop@xyz.com> wrote in message <h2de1d$sgb$1@fred.mathworks.com>... 
Subject: What is the probability that random integers sum to a given value? From: Bruno Luong Date: 30 Jun, 2009 21:29:01 Message: 4 of 24 
Note that I assume W draw from *0* to n. It is trivial use my method after shifting by 1. 
Subject: What is the probability that random integers sum to a given value? From: Bruno Luong Date: 30 Jun, 2009 21:48:01 Message: 5 of 24 
A slighly cleaner code 
Subject: What is the probability that random integers sum to a given value? From: Bruno Luong Date: 1 Jul, 2009 06:14:01 Message: 6 of 24 
Also important note: my method is correct for n>=m (actually m1). So far I fail to find a method of calculation for n<m. 
Subject: What is the probability that random integers sum to a given value? From: David Heslop Date: 1 Jul, 2009 07:02:01 Message: 7 of 24 
Thanks for your input, the sampling it assumed to be without replacement. The problem derives from attempting to form significance levels for rank statistics where replacement is not allowed, 
Subject: What is the probability that random integers sum to a given value? From: Bruno Luong Date: 1 Jul, 2009 07:55:02 Message: 8 of 24 
"David Heslop" <david_heslop@xyz.com> wrote in message <h2f1l9$4fo$1@fred.mathworks.com>... 
Subject: What is the probability that random integers sum to a given value? From: David Heslop Date: 1 Jul, 2009 08:14:01 Message: 9 of 24 
Hi Bruno, 
Subject: What is the probability that random integers sum to a given value? From: tristram.scott@ntlworld.com (Tristram Scott) Date: 1 Jul, 2009 09:35:17 Message: 10 of 24 
David Heslop <david_heslop@xyz.com> wrote: 
Subject: What is the probability that random integers sum to a given value? From: John D'Errico Date: 1 Jul, 2009 10:29:02 Message: 11 of 24 
tristram.scott@ntlworld.com (Tristram Scott) wrote in message <p5G2m.8$AX1.0@newsfe20.ams2>... 
Subject: What is the probability that random integers sum to a given value? From: David Heslop Date: 1 Jul, 2009 10:56:01 Message: 12 of 24 
Dear All, 
Subject: What is the probability that random integers sum to a given value? From: John D'Errico Date: 1 Jul, 2009 11:16:01 Message: 13 of 24 
"David Heslop" <david_heslop@xyz.com> wrote in message <h2ffc1$1t0$1@fred.mathworks.com>... 
Subject: What is the probability that random integers sum to a given value? From: David Heslop Date: 1 Jul, 2009 12:59:02 Message: 14 of 24 
Thanks John, that is an extremely demonstrative piece of code, 
Subject: What is the probability that random integers sum to a given value? From: dpb Date: 1 Jul, 2009 12:59:50 Message: 15 of 24 
John D'Errico wrote: 
Subject: What is the probability that random integers sum to a given value? From: Bruno Luong Date: 1 Jul, 2009 13:52:01 Message: 16 of 24 
It seems very difficult to get the exact probability for nonreplacement case. I would go with John : try to ignore the nonreplacement assumption. The question is how much error we make by this approximation. In any case I'm with John, it's probably a better way than Monte Carlo simulation. 
Subject: What is the probability that random integers sum to a given value? From: dpb Date: 1 Jul, 2009 13:56:39 Message: 17 of 24 
Bruno Luong wrote: 
Subject: What is the probability that random integers sum to a given value? From: Bruno Luong Date: 1 Jul, 2009 14:25:03 Message: 18 of 24 
dpb <none@non.net> wrote in message <h2fqan$ooa$1@news.eternalseptember.org>... 
Subject: What is the probability that random integers sum to a given value? From: David Heslop Date: 1 Jul, 2009 14:36:01 Message: 19 of 24 
The question of how far I need to go into the tails is a bit of an open one. I'm using this approach in an attempt to identify anomalous events within a time series. Rather than saying that a given event passes a certain threshold, for example 95 or 99, I have been trying to assign specific probabilities. This means that sometimes I'm visiting the extremes of the tails and often with the MC approach a zero probability is returned. 
Subject: What is the probability that random integers sum to a given value? From: dpb Date: 1 Jul, 2009 14:43:10 Message: 20 of 24 
David Heslop wrote: 
Subject: What is the probability that random integers sum to a given value? From: tristram.scott@ntlworld.com (Tristram Scott) Date: 1 Jul, 2009 15:44:49 Message: 21 of 24 
David Heslop <david_heslop@xyz.com> wrote: 
Subject: What is the probability that random integers sum to a given value? From: tristram.scott@ntlworld.com (Tristram Scott) Date: 1 Jul, 2009 16:35:17 Message: 22 of 24 
Tristram Scott <tristram.scott@ntlworld.com> wrote: 
Subject: What is the probability that random integers sum to a given value? From: John D'Errico Date: 1 Jul, 2009 16:58:02 Message: 23 of 24 
tristram.scott@ntlworld.com (Tristram Scott) wrote in message <RvL2m.1720$HE6.725@newsfe27.ams2>... 
Subject: What is the probability that random integers sum to a given value? From: Bruno Luong Date: 1 Jul, 2009 21:03:01 Message: 24 of 24 
For fun, I compute the probability for case for of m=50, n=500 WITH replacement, using John's VPI 
A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.
Anyone can tag a thread. Tags are public and visible to everyone.