File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Programming Diversions and the fly likes Probability question. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Other » Programming Diversions
Bookmark "Probability question." Watch "Probability question." New topic
Author

Probability question.

Vikrama Sanjeeva
Ranch Hand

Joined: Sep 02, 2001
Posts: 756
Hi,

Here is one more:

Problem Objective: Probability of Mistake.

Explanataion:

There are two different cases. You have to calculate in which case probility of mistake is greater.

Case 1:

Person "P1" do task "T1" "400" times whith effeciency E1.

Suppose probability of mistake by P1 in doing task T1 is "X".

Case 2:

In case 2, the *number of task T1 is *equally divided into two Persons P1 and P2. That is, each person will do task "T1" "200" times with same effeciency "E1".

Probability of mistake by P1 is "Y" and by P2 is "Z".



My question is in which case (1 or 2) probability of mistake of doing task T1 is greater? In other words, which relation is true?

X > Y+Z
OR Y+Z > X
OR Y+Z = X

Bye,
Viki.


Count the flowers of your garden, NOT the leafs which falls away!
Prepare IBM Exam 340 by joining http://groups.yahoo.com/group/IBM340Exam/
Jayesh Lalwani
Ranch Hand

Joined: Nov 05, 2004
Posts: 502
Case 1:
Mistakes M1 = 400*X

Case 2:
Mistakes M2 = 200*Y + 200*Z

So for M1 > M2
400 X > 200Y + 200Z
2X > Y + Z
X > (Y + Z)/2

So,
if X > (Y+Z)/2; M1 > M2
X = (Y+Z)/2; M1 = M2
X<(Y+Z)/2; M1<M2
Bhau Mhatre
Ranch Hand

Joined: Jun 11, 2003
Posts: 199
Vikrama Sanjeeva--- Suppose probability of mistake by P1 in doing task T1 is "X".

Jayesh Lalwani--- Mistakes M1 = 400*X

Hmm, probability does not increase with repetition, does it?

E.g. Out of 100 balls in a box (1 red, 99 blue), the probablity of picking up a red ball randomly is 1/100.
If you repeat this process 400 times, the probability does not increase to 4.

Similarly, if you consider each individual "doing of the task" separately, then each time the probability of mistake is X. This will never change.
And the probability of NOT making a mistake = (1-X)

Repeating 400 times, the probability of 'always making' a mistake is (X)*(X)*(X)...400 times
Repeating 400 times, the probability of 'always not making' a mistake is (1-X)*(1-X)*(1-X)...400 times

M1_always = x^400
M1_never = (1-x)^400
M1_alteast_once = 1 - M1_never
Work done without mistakes atleast once = 1 - M1_always (never mind about this extra info)

For two people, suppose
M21 = probability of mistake by first guy and
M22 = probability of mistake by second guy

M21_always = y^200
M21_never = (1-y)^200
M21_alteast_once = 1 - M21_never
Work done without mistake atleast once = 1 - M21_always (never mind about this extra info)

M22_always = z^200
M22_never = (1-z)^200
M22_alteast_once = 1 - M22_never
Work done without mistake atleast once = 1 - M22_always (never mind about this extra info)

M21_alteast_once OR M22_alteast_once = (1 - M21_never) + (1 - M22_never) = (2 - ((1-y)^200 + (1-z)^200))

For M1 > M21+M22

1 - ((1-x)^400) > 2 - ((1-y)^200 + (1-z)^200)
((1-x)^400) > 1 - ((1-y)^200 + (1-z)^200)

((1-y)^200 + (1-z)^200) + ((1-x)^400) > 1

am lost here...


-Mumbai cha Bhau
Vikrama Sanjeeva
Ranch Hand

Joined: Sep 02, 2001
Posts: 756
Originally posted by Bhau Mhatre:
[b]E.g. Out of 100 balls in a box (1 red, 99 blue), the probablity of picking up a red ball randomly is 1/100.
If you repeat this process 400 times, the probability does not increase to 4.


u r making me lost too

anywayz.... this is true what u said. But what about the "number of successfull chances" ? Will it increase? If I am not geting u wrong, then consider this E.g: I asked u to fire a bottle placed on a top of pillar. Distance b/w u and pillar is 0.25KM. You have 5 chances (i.e. five bullets). Probability of hiting bottle on every chance will be 1/5; but what about the number of chances of hiting bottle? Will it be different if you have 10 bullets (chances)?

Bye,
Viki.
Bhau Mhatre
Ranch Hand

Joined: Jun 11, 2003
Posts: 199
Vikrama Sanjeeva--- But what about the "number of successfull chances" ? Will it increase?

Yes. Probability of a an outcome increases with the number of tries.
If x is the probability of a positive outcome in one single task and N is the number of tries, then
P_always = x^N
P_never = (1-x)^N
P_alteast_once = 1 - P_never

x being less than 1, powers of x get smaller and smaller.
As N increases, P_always decreases. It gets "more and more improbable" for the outcome to be always positive every time.
As N increases, P_never decreases too. It gets "more and more improbable" for the outcome to be always negative every time.
But as N increases, P_atleast_once increases.

That is, if you keep repeating the same task over and over again, the probability of a positive outcome atleast once increases.
And the probability of a negative outcome atleast once also increases.

Vikrama Sanjeeva--- If I am not geting u wrong, then consider this E.g: I asked u to fire a bottle placed on a top of pillar. Distance b/w u and pillar is 0.25KM.

First of all, the distance information is useful only if you provide a relation between the probability and the distance. E.g. P is inversely proportional to the sum of three times square root of distance and the tan of the angle of the wind and the direction of the bullet, keeping the speed of the wind constant, etc. or something like that. In the above case, the distance is not needed so long as it is within the possible range of shooting

Vikrama Sanjeeva--- You have 5 chances (i.e. five bullets). Probability of hiting bottle on every chance will be 1/5;

Second, how did you achieve that number? Probability of hiting bottle on ANY given chance for every chance will always be 1/2. That is, you either hit, or you miss.

Vikrama Sanjeeva--- but what about the number of chances of hiting bottle? Will it be different if you have 10 bullets (chances)?

Yes. If you keep shooting day in and day out, the chances of hitting more times increases. For this, we don't need the mathematical knowledge of probability, do we? Ask the telemarketers. Or the kids persuading their parents for more toys. They know this well

[Edit] That kind of contradicts my previous statement -- "Probability does not increases with repetition. " So I'll try and rephrase it:
Probability of an outcome for an event does not increase with repetition when each occurance of the event is considered separately.
Probability of an outcome happening atleast once does increase with increase in the number of chances taken togather.
[ April 19, 2005: Message edited by: Bhau Mhatre ]
Jim Yingst
Wanderer
Sheriff

Joined: Jan 30, 2000
Posts: 18671
[Vikrama Sanjeeva]: You have 5 chances (i.e. five bullets). Probability of hiting bottle on every chance will be 1/5;

[Bhau Matre]: Second, how did you achieve that number? Probability of hiting bottle on ANY given chance for every chance will always be 1/2. That is, you either hit, or you miss.


I'm not sure what Vikrama is thinking; the statement about 1/5 probability may be faulty reasoning (based on there being 5 bullets, which is irrelevant for each single shot), or it may simply be one fo the givens of the problem (the probability is 1/5 because Vikrama said it is). However Bhau Martre's statement here is definitely in error. You can not assume that just because there are two possibilities (hit or miss) the chance of each is 1/2. That's ludicrous. What about the many other variables: size of target, range, skill of shooter, accuracy of gun, vision of shooter, etc? All these have a significant influence on the chance of success, which may be much higher or much lower than 1/2.
[ April 19, 2005: Message edited by: Jim Yingst ]

"I'm not back." - Bill Harding, Twister
Bhau Mhatre
Ranch Hand

Joined: Jun 11, 2003
Posts: 199
JY--- That's ludicrous.
BM---

VS--- You have 5 chances (i.e. five bullets). Probability of hiting bottle on every chance will be 1/5;
JY--- I'm not sure what Vikrama is thinking; the statement about 1/5 probability may be faulty reasoning (based on there being 5 bullets, which is irrelevant for each single shot), or it may simply be one fo the givens of the problem (the probability is 1/5 because Vikrama said it is).
BM--- Ah! I assumed Vikrama arrived at 1/5 by faulty reasoning. I did not think of the possibility that it may be just one of the givens of the problem. My bad, if it is the later case.

JY--- That's ludicrous.
BM---

JY--- However Bhau Martre's statement here is definitely in error. You can not assume that just because there are two possibilities (hit or miss) the chance of each is 1/2. What about the many other variables: size of target, range, skill of shooter, accuracy of gun, vision of shooter, etc? All these have a significant influence on the chance of success, which may be much higher or much lower than 1/2.
BM---Yes, I understand that. Randomly picking a ball from a bag of two is different from shooting a gun. Didn't I mention the distance, wind, speed, and direction?

JY--- That's ludicrous.
BM---

BM---The more I think about it, the more it seems like there is no starting point for such a case. The probability, considering the skills, size, range, must be a given to start with. Is that correct?

JY--- That's ludicrous.
BM---
[ April 19, 2005: Message edited by: Bhau Mhatre ]
Jayesh Lalwani
Ranch Hand

Joined: Nov 05, 2004
Posts: 502
Originally posted by Bhau Mhatre:
Vikrama Sanjeeva--- Suppose probability of mistake by P1 in doing task T1 is "X".

Jayesh Lalwani--- Mistakes M1 = 400*X

Hmm, probability does not increase with repetition, does it?


E.g. Out of 100 balls in a box (1 red, 99 blue), the probablity of picking up a red ball randomly is 1/100.
If you repeat this process 400 times, the probability does not increase to 4.

You are confusing all of us. Probability of an event does not increase by number of repetitions, but the number of events increase with repetition, as long as you have lot of repetitions.

So, if you are tossing a coin, the probability of getting heads is 1/2. If you toss the coin 100 times, you will get 50 heads. If you toss 200 times, you will get 100 heads

I said number of Mistakes = 400* X, not probability of mistakes = 400 * X

In your example, if you keep picking a ball and putting it back, you will get the red ball 4 times.

Similarly, if you consider each individual "doing of the task" separately, then each time the probability of mistake is X. This will never change.
And the probability of NOT making a mistake = (1-X)

Repeating 400 times, the probability of 'always making' a mistake is (X)*(X)*(X)...400 times
Repeating 400 times, the probability of 'always not making' a mistake is (1-X)*(1-X)*(1-X)...400 times

But that's not the question. Vikrama was asking what is the probability of making mistakes in case 1 and 2. He is not asking about the probability of always making a mistake

So, let me show this differrently

Let P1 be the probability of making a mistake in case1
P1=X
M2(Mistakes made in case2) = 200*Y + 200*Z
So, P2(probaility of mistakes in case 2) = M2/400
P2 = (Y+Z)/2

So, if
X>(Y+Z)/2; P1>P2
X=(Y+Z)/2; P1=P2
X<(Y+Z)/2; P1<P2
fred rosenberger
lowercase baba
Bartender

Joined: Oct 02, 2003
Posts: 11169
    
  16

if you keep picking a ball and putting it back, you will get the red ball 4 times.


not true. or, not neccesarily true. as the number of selection (with replace) approaches infinity, the percent of reds selected approaches 1%. that does not mean that in 400 trials, i will get 4 reds every time.

i know this is what you meant, but i feel it's important to clarify.

What you have shown (and i like your approach) is the theoretical number of mistakes made each case, and used that to determine which is better. this is slightly different than calculating the probability of mistakes in each case, and picking the lesser.

your math is MUCH easier. Bravo!!!


There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
Jim Yingst
Wanderer
Sheriff

Joined: Jan 30, 2000
Posts: 18671
JY--- However Bhau Martre's statement here is definitely in error. You can not assume that just because there are two possibilities (hit or miss) the chance of each is 1/2. What about the many other variables: size of target, range, skill of shooter, accuracy of gun, vision of shooter, etc? All these have a significant influence on the chance of success, which may be much higher or much lower than 1/2.
BM---Yes, I understand that. Randomly picking a ball from a bag of two is different from shooting a gun. Didn't I mention the distance, wind, speed, and direction?


You did. But if you know this, then why did you say "Probability of hiting bottle on ANY given chance for every chance will always be 1/2. That is, you either hit, or you miss."?

JY--- That's ludicrous.
BM---


Would you prefer "severely misguided" or "flat-out wrong"? Or did you mean something different from the way I interpreted your statement? The rest of your post seems to make sense, so maybe there's a misunderstanding somewhere here...

BM---The more I think about it, the more it seems like there is no starting point for such a case. The probability, considering the skills, size, range, must be a given to start with. Is that correct?

I'd agree with that. There are so many variables, I think it would be nearly impossible to determine the probability for one shot - except by trying it repeatedly, and counting the results. Or by having the probability provided as a given.
Jayesh Lalwani
Ranch Hand

Joined: Nov 05, 2004
Posts: 502
Originally posted by fred rosenberger:


not true. or, not neccesarily true. as the number of selection (with replace) approaches infinity, the percent of reds selected approaches 1%. that does not mean that in 400 trials, i will get 4 reds every time.

i know this is what you meant, but i feel it's important to clarify.

What you have shown (and i like your approach) is the theoretical number of mistakes made each case, and used that to determine which is better. this is slightly different than calculating the probability of mistakes in each case, and picking the lesser.

your math is MUCH easier. Bravo!!!


I agree. I think I mentioned that repetitions have to be high, but I should have mentioned that in that sentence.

Also, IMO, in this case, you have to use thereotical values, because there is no way you can say for certain how many mistakes can be made before hand. Even if you want to guess the number of mistakes, you can never be 100% sure. We can calculate the probability P of M mistakes happenning in a sample size of N, but for every M from 0 to N, P will always be less than 100%. (In fact the integeration of all P will be 100%). The only thing you can be 100% sure of is that 0 to N mistakes will be made, which doesn't tell you anything

If you want to get complicated, you could draw a graph with number of mistakes M on the X axis, and probability P on the Y axis. You would get an inverted bell curve. My gut feeling is that the peak will be at the theoritical value; ie; M=N*X, but I'm not sure. That much math is beyond me If you want to compare the 2 cases this way, you should limit yourself to comparing the 2 cases based on the number of mistakes that have the highest probability of occuring, which should be N*X. I might be wrong. No way of telling unless we figure out the graph.
Bhau Mhatre
Ranch Hand

Joined: Jun 11, 2003
Posts: 199
JY--- You did. But if you know this, then why did you say ...
Would you prefer "severely misguided" or "flat-out wrong"? Or did you mean something different from the way I interpreted your statement? The rest of your post seems to make sense, so maybe there's a misunderstanding somewhere here...

BM--- Since no other information was given as a starting point, I supposed we could
1. Either use 1/2 as a starting point (neither in favor of a hit nor in favor of a miss) if we were to calculate further for five or ten chances.
(I was thinking more about the binary nature of the outcome. If the event had three possible outcomes, I would have chosen 1/3 as a starting point in the absence of information about external factors.)
2. Or not calculate at all.
but certainly not 1/5 if that was arrived at based on the number of bullets.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Probability question.
 
Similar Threads
finding closest point
Short-Circuit Logical Operators
How to group these JLabels?
Variables in Java
How to display Text String at the bottom of JLabel??