# Thread: Need Help figuring out a statistics problem

1. After further research I think it is a Poisson distribution, but it's the CDF of the Poisson distribution we're looking for, I'm trying to figure out how to set it up.

As I have it now, that is correct assuming every swing occurred at the same time.

2. Apparently this is a lot more complicated than I thought:

Hi, <Aggathon's Real Name>:

This problem is known as the "runs" problem and has tabulated values often
in an appendix of a textbook.
I haven't thought about how the runs table was constructed, perhaps one of
the ideas posed in your email.
What I do know is that there is a statistical solution. f there are, say,
20 random numbers, there is a 95% probability that the number of runs is
between 6 and 13. This doesn't give the probability that any run is exactly
five in length.

I have a runs table somewhere in my books. Let's take a look at it.

Dr. <professor's name>

PS: This exact problem was posed during a probability course I took so long
ago.
I recall that it was also included in a Homework Set 3 early in the courses
I taught.
Also, and probably most important, I used this concept to solve a
consulting problem for <company name edited>, using an expanded version of the
idea and a short (20 line or so) computer program. I may be able to find
those results.

3. Tank & occassional peon
Join Date
May 2009
Posts
381
I just did a quick test in Excel with 100 000 swings and 38,32% chance of a miss. I then checked how many times 5 hits in a row landed and got a number around 9000 after several resets of the random numbers so I am guessing the number is somewhere around 9%. The only thing I wasnt sure about is whether say 9 hits in a row should be counted at beeing hit 5 times in a row 10 times (which it is in my spread sheet).

Dont have a nice formula for it though but the number should be right.

4. wouldn't ~9% just be the odds of getting hit 5 times in a row at any given point in time? I'm talking about the odds of getting hit 5 times in a row just once, which after 100,000 swings the odds of not getting hit 5 times in a row at least once is ridiculously small since it happened roughly 9000 times in your simulation.

5. Ooohh double post.

What about, running a simulation of Y times of getting hit total, so like in my scenario 100. Then run that simulation 100,000 times, for every run of 100 that there are at least 5 hits in a row, increase the counter by 1 (so regardless of if you get hit more than 5 times in a row, or hit 5 times in a row more than once per 100, you only increase the counter once). Then you divide that counter by the total 100,000 runs, and that would give you the percent of time you will get hit 5 times in a row in 100 swings, right?

6. Tank & occassional peon
Join Date
May 2009
Posts
381
Ok missunderstod the question a bit but yes now I can see what you are trying to get at. Give X avoidance and a sample fight which consists of 100 boss swings, you are wondering how likely you are to get hit 5 times in a row (in other words die)? Without getting an answer from you I will go ahead and sim it asap :-)

7. Tank & occassional peon
Join Date
May 2009
Posts
381
Ok ran the hit-5-times-in-a-row-in-a-100-swing-fight test 10 million times to get a nice number. Assuming I did it the correct way, it comes out to happening in 98.5% of the fights. Not as often as what you got from the start but a very high number.

Increasing the avoidance to 50% instead of 38.32% the number goes down to 81%

8. Fascinating, that seems far more accurate though. Is there a way you could get that spreadsheet to me?

9. Tank & occassional peon
Join Date
May 2009
Posts
381
I couldnt do this in Excel so I wrote a quick java app to sim it but I have pasted the results for avoidance from 0 to 99% in a spreadsheet instead. Not sure it will let me upload it but lets see.

Here is also a graph showing how it looks and all this assuming 100 swings and whether or not 5 swings in a row landed even once during 100 swings. I had to decrease the sample size to 10 000 times per avoidance number to get this done fairly quick.

&#53;&#45;&#116;&#105;&#109;&#101;&#115;&#45;&#100;&#105;&#97;&#103;&#114;&#97;&#109;&#46;.jpg

10. Fascinating! Wow this is great stuff man! I really appreciate it!

11. Tank & occassional peon
Join Date
May 2009
Posts
381
No problem but remember its all given very specific circumstances (100 swings and 5 hits). Checking for say 3 swings in a row instead would give a less obvious point where avoidance really starts to be dependable upon.

12. Originally Posted by Winterburn
Ok, here's a set of equal probabilities of miss, let's call them P1, P2, P3, P4, and P5. What you propose is taking all pairs (or sets of X), calculating the probability within the set and multiplying it by the total number of sets, i.e.: (P1*P2)*(P2*P3)*(P3*P4)*(P4*P5).

That is basically your (chance of failure)^(number of tries) or (chance of miss squared)^(4), since each pair represents a try and each formula in brackets is the chance of two consecutive misses (they are all equal, obviously). This is not correct, as I've stated numerous times before, because you multiply dependent events. Two pairs will have the same event as part of their probability. For instance, event 2 is in probabilty of two pairs (P1*P2) and (P2*P3). And multiplication of probabilities is not a valid way to find cummulative probability of dependent events.
But it is correct.
P1, P2, P3 and P4 each have a chance of starting a 2-string of successes - what happened before or what happens after is irrelevant to this chance.
We know the number of attempts, we know the chance of success. Easy math.

Let's assume I'm wrong and see what the math would give us. Assume avoidance is 50% here (you can replace it with X later, I like using numbers.)
First, we check (P1, P2) and (P3, P4) - those are simple, each set has a chance of (50%)^2=25% of being 2 hits.
Then, we check (P2, P3). Now, there's a 50% chance that P2 will be avoided, and so we wouldn't have to check these at all. For the rest, we'd have 50% 2-string hits, ending up with 25% (50% of 50%.)
Then, we check (P4, P5). The same happens. There's a 50% chance we need to check it at all, and if we need to check it, 50% of the sets end up double hits.

So, condensing this math, we find out that for (P1, P2) and (P3, P4), the chance is (50%)^2 For (P2, P3) and (P4, P5), we also find out the chance is (50%)^2.

If you still think I'm wrong, tell me why I'm wrong, and where the error in my logic or math is.
Last edited by Martie; 05-03-2010 at 02:15 PM.

13. Originally Posted by PatrikL
I couldnt do this in Excel so I wrote a quick java app to sim it but I have pasted the results for avoidance from 0 to 99% in a spreadsheet instead. Not sure it will let me upload it but lets see.

Here is also a graph showing how it looks and all this assuming 100 swings and whether or not 5 swings in a row landed even once during 100 swings. I had to decrease the sample size to 10 000 times per avoidance number to get this done fairly quick.

Attachment 1516
Mind posting the app as well? (Or at least the code for it, shouldn't be overly complex.)

14. Tank & occassional peon
Join Date
May 2009
Posts
381
Originally Posted by Martie
Mind posting the app as well? (Or at least the code for it, shouldn't be overly complex.)
Ofc not, its very short and you can check it quickly that there arent any major flaws in how I did it. Not taking any resposibilty for it beeing pretty though:

Code:
```import java.text.DecimalFormat;

public class Main {

public static void main(String[] args) {
DecimalFormat format = new DecimalFormat("0.0000");

double avoidance = 0.0;

for(int f = 0; f < 100; f++) {
int deathCount = 0;

for(long index = 0; index < 100000; index++) {
if(simpleFight(avoidance)) deathCount++;
}

System.out.println(format.format(avoidance)+"\t"+format.format((double)deathCount/(double)100000));

avoidance += 0.01;
}
}

public static boolean simpleFight(double avoidance) {
int hitCount = 0;
for(int index = 0; index < 100; index++) {
if(Math.random() > avoidance) hitCount++;
else hitCount = 0;

if(hitCount == 5) return true;
}

return false;
}
}```

15. Runs in Bernouilli Trials is indeed what you are looking for. As your professor pointed out. The expression given in the link that Felhoof provided works well for these calculations. Simulations are generally the best recourse for these type of things if you're unsure about the mathematics. And generally far easier to do.

Here is the expression, from Dr Math link, plotted in attachment

16. Established Registrant
Join Date
Sep 2009
Posts
721
That sounds more reasonable to me, and goes with what I read.

What's interesting is that increasing your avoidance by 10% nearly doubles that chance that it doesn't happen. It still doesn't matter, since you're still going to die 81% of the time, but it's interesting.

Of course, this presupposes that the choice is between avoidance and stamina such that you can survive that 5th hit. That's a bit different of a problem, but the solution seems obvious; you always want to gear to survive that xth hit if you can, but if you can't it's better to reduce the risk of dying.

17. So I'm coding retarded, what program can I use to run that code? I want to make a bunch of tables and stuff for reference points for the article I'm going to be posting soon. I'll probably make a table ranging anywhere from 2 hits to 7 hits or so to give an idea of how avoidance helps.

And felhoof, I cover that in what I've been writing, idk if I'll be able to finish it/post it until Wednesday though. I have a big powerpoint presentation for my radar class that I have to give on Wednesday, and most of my free time is going to go into that for the next few days.

18. Double post again.

Real quickly, how viable do you guys think a number such as a "survivability quotient" is. TGM and I kinda made one up ( SQ = (minTTDwHeals + AvgTTD)/(minTTDwHeals*AvgTTD) ) and basically that formula takes into account avoidance, ehp, HPS, avg DTPS, and max DTPS and the closer it gets to 0 the better it would be. I liked the results because it gave eitrigg's oath a smaller delta SQ from our base test values than essence of gossimir (implying that ~100 stam is > just under 2% dodge). But to be honest, I'm not sure there is a mathematical way to come up with a "Survivability Quotient" that measures survivability in 1 number. So I tossed the idea and took it out of my spreadsheets, but idk... what do you guys think?

19. OM NOM NOM
Join Date
Sep 2009
Location
Waco Texas
Posts
417
I like it is a rough number to use but i think it cuold go the way of GS being an ingame script raid leaders macro and approve deny based off that.

20. Established Registrant
Join Date
Sep 2009
Posts
721
You can use java to do the above code. I played with it some in C# to do the 2-7 hit variation; I can send you that code if you like and would make things easier.

As to a survivability quotient, I think it's not a bad idea, but it's hard to use well. Survivability is so variable and so dependent on specific scenarios that having one all-encompassing number isn't hugely useful some of the time and could be somewhat misleading. When you start factoring in magical damage, burst damage sources, add damage, blocked hits, etc it becomes a bit confusing why (for instance) Eitrigg's Oath would help you survive Soul Reapers better.

I think for Cataclysm, given what we know, it's probably more valuable to do something like SQ with a caveat, which is required HPS. Ideally tanks will be forced to maximize both, after all.