The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.
|
 |
|
Dev Shed Forums
> Programming Languages - More
> Software Design
|
cumulative probability...
Discuss cumulative probability... in the Software Design forum on Dev Shed. cumulative probability... Software design forum discussing design principles and non-language specific algorithms. Get help with logic, algebraic, or relational concepts.
|
|
 |
|
|
|
|

Dev Shed Forums Sponsor:
|
|
|

April 30th, 2003, 10:11 AM
|
 |
Muhhnnn !!
|
|
|
|
|
cumulative probability...
Here is the problem.
One worker have a probability of 2% to deliver an item each hour.
The aim is to write a function that will calculate how much item would go out from factory during an hour if I have X workers.
Input would be X (number of worker) and a random value that will be compared to probability.
Example:
with 1 worker
0 item => 98%
1 item => 2%
if i call foo(X) 100 times, I will (theorically) get 98 times 0 and 2 times 1.
I actually have this function coded with looping over each worker, it is quite heavy and i would like to find a mathematical way to do it...
Actual function:
ItemAmount = 0
For (worker = 1 to X)
{
RandomValue = Random(0,99)
if (RandomValue < 2)
item++
}
// Quite heavy isn't it ?
|

April 30th, 2003, 04:23 PM
|
 |
Junior Member
|
|
Join Date: Apr 2003
Location: Italy -> Naples
Posts: 9
Time spent in forums: < 1 sec
Reputation Power: 0
|
|
Probability
Hi,
if a worker have a probability of 2% to deliver an item each hour, n workers have a probability of (2*n)% .
Because if every n independent event have a probability P(xi)=a the total probability is
P(X)=P(x1)+P(x2)+...P(xn)=n*a
So your function can be rewritten as:
Code:
rand_val=rand(0,99);
if(rand_val<=(n*2))
item++;
Good work 
|

May 1st, 2003, 06:11 PM
|
|
.
|
|
Join Date: Dec 2002
Posts: 296
Time spent in forums: < 1 sec
Reputation Power: 11
|
|
i'm quite interested in cumalitive probability at the moment. haven't got too far though yet. one useful phrase to look for is 'cumulative poisson'. here's something i found on it. i'm not going to pretend i understand it, but this may or may not be of use to you (free book though) :
6.2 Incomplete Gamma Function, Error
Function, Chi-Square Probability Function,
Cumulative Poisson Function -
http://www.ulib.org/webRoot/Books/N...s/bookcpdf.html
|

May 5th, 2003, 05:42 AM
|
 |
Muhhnnn !!
|
|
|
|
|
M3xican: They do are independant, but your formula simulation tell me if an item was built or not... I want to know How much items went out of production. Your formula says "At least one item went out".
Balance: Thanks, will take a look...
Others: Question still pending =)
|

May 8th, 2003, 09:01 AM
|
 |
Junior Member
|
|
Join Date: Apr 2003
Location: Italy -> Naples
Posts: 9
Time spent in forums: < 1 sec
Reputation Power: 0
|
|
Sorry...
.
Last edited by M3xican : July 2nd, 2003 at 12:56 PM.
|

May 8th, 2003, 11:08 AM
|
|
Contributing User
|
|
Join Date: Mar 2001
Location: Dublin
Posts: 413
Time spent in forums: 2 h 18 m 18 sec
Reputation Power: 13
|
|
|
M3xican, I don't mean to be rude, but I can't see any basis to your response - it makes no sense. Perhaps you could elaborate on how you came to it.
Balance is correct - use an inverse cumulative poisson function to generate your random value from the uniform value generated by rand(). If my memory serves me right then an inverse cumulative normal / gaussian distribution will also suffice where the number of workers is large enough (>=250 in this case).
|

May 8th, 2003, 01:43 PM
|
|
.
|
|
Join Date: Dec 2002
Posts: 296
Time spent in forums: < 1 sec
Reputation Power: 11
|
|
|
are markov chains even more useful for things like this? i've read a few bits and bobs on probability, and as soon as it gets into cumulative stuff in particular, markov chains seem to get mentioned. again, not going to pretend i actually understand what i'm talking about. would like to though, very much.
Last edited by balance : May 8th, 2003 at 01:45 PM.
|

May 8th, 2003, 03:06 PM
|
|
Contributing User
|
|
Join Date: Mar 2001
Location: Dublin
Posts: 413
Time spent in forums: 2 h 18 m 18 sec
Reputation Power: 13
|
|
|
likewise, i'm no expert but my answer would be no.
as i understand it, markov chains could only apply if the situation being modelled were to involved a sequence of non-independent tests - whereas the question above concerns a collection of simultaneous - and, i would assume, independent - tests.
for example if we modelled not just the increased number of workers but also an increased number of hours, we could modify our binary probability model so that the probability of delivery in a given hour is related to whether delivery was achieved in the previous hour - as might be the case in practise.
i don't know what other conditions would need to be met etc - like i say i'm not an expert
|

May 9th, 2003, 01:46 AM
|
 |
Muhhnnn !!
|
|
|
|
|
mmmh it seems that I will have to search after my class notes =(
__________________
"The ultimate knowledge is reached when it does not bring new questions..."
-- Usaphdas encyclopedia XV.4
|

May 9th, 2003, 01:12 PM
|
|
.
|
|
Join Date: Dec 2002
Posts: 296
Time spent in forums: < 1 sec
Reputation Power: 11
|
|
Quote: | as i understand it, markov chains could only apply if the situation being modelled were to involved a sequence of non-independent test |
would characters from usual text be applicable to that do you think?
|

May 9th, 2003, 01:16 PM
|
|
Contributing User
|
|
Join Date: Mar 2001
Location: Dublin
Posts: 413
Time spent in forums: 2 h 18 m 18 sec
Reputation Power: 13
|
|
|
i'm not sure if i get what you mean - but if the probability of a given character "coming next" was dependent on the previous character but independent of it's predecessors then i guess so.
|

May 9th, 2003, 06:00 PM
|
|
.
|
|
Join Date: Dec 2002
Posts: 296
Time spent in forums: < 1 sec
Reputation Power: 11
|
|
|
yes, that's what i was meaning. ok, thanks.
|
Developer Shed Advertisers and Affiliates
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Rate This Thread |
Linear Mode
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
|