Statistics of an opening hand
General forum
Posted on April 8, 2015, 4:12 p.m. by ainumelkor
I have this Statistics project for which I am calculating the odds of obtaining an 'ideal' opening hand for my Marchesa EDH deck. Then I must figure out a way to analyze the effectiveness of partial mulligans on the hand.
For simplicity's sake I am ignoring CMC and color, grouping cards into
Land (40)Creatures (33) including artifacts and planeswalkersInstants/sorceries (18)Enchantments (10)I have defined an "ideal" hand as any one containing any 3 lands, 2 creatures, 1 instant/sorcery and 1 enchantment.
To find the probability of getting any 3 lands in my opening handI believe I am supposed to use nCr(7,3) x 0.43 x 0.64 = 0.29 ish
for 2 creatures: nCr(7,2) x 0.332 x 0.675 = .38 ish and etc. for the other card types.
I am not sure how to combine these numbers to find the probability of obtaining an ideal opening hand, and from there finding a way to determine whether mulligans can improve the hand or not.
Any help with the math involved would be great, as the magic aspect of the project is confusing my teacher.
Are you remembering to use the powers in your equation?
P(X = r) = nCr p(to the power of r) (1 p) (to the power of nr)
April 8, 2015 4:36 p.m.
ainumelkor says... #4
the equations seem to not have gone through. Here is what they actually are:nCr(7,3) x 0.43 x 0.64 = 0.29
April 8, 2015 4:55 p.m.
ainumelkor says... #5
ah. didn't realize that the caret doesn't go through.nCr(7,3) x 0.4 cubed x 0.6(to the 4th) = 0.29and nCr(7,2) x 0.33 squared x 0.675 (to the 5th) = .38
April 8, 2015 4:56 p.m.
Programmer_112 says... #6
Marking this for later. Sorry, I'm on my iPhone right now.
April 8, 2015 5:05 p.m.
To get 3 lands, 2 creatures, 1 instant/sorcery and 1 enchantment, would maybe be:
(40/99)x(39/98)x(38/97)x(33/96)x(32/95)x(18/94)x(10/93) = 0.00015 ~ 0.015%.
I'm no big mathematician, but I don't think this is totally false.
The chance of getting 3 lands in hand must be:
(40/99)x(39/98)x(38/97)x(60/95)x(59/95)x(58/94)x(57/93) = 0.0093 ~ 9,3%. One in ever 10 game, you are going to have exactly 3 lands in your hand!
Maybe I'm missing something! Let me know :)
April 8, 2015 5:08 p.m.
That's an oversimplification because what you've calculated is the chance of getting those cards in that particular order. What you have to do is calculate getting those cards in any order. This is why you have to use nCr which looks at the total number of combinations of something. For example - there are 7 ways of getting one creature in your hand. It could be the first card you draw, it could be the second card you draw, it could be the third etc. You need to factor that in.
The above isn't entirely wrong, but it is quite wrong.
Also 0.009 isn't 9% it's 0.9% (ie. under 1).
April 8, 2015 5:14 p.m.
ainumelkor says... #9
@NorthernRaven,I think you calculated a permutation, which takes into account the order in which I draw the cards, specifying that the first, second and third cards I draw will be lands, which doesn't matter in this situation.
April 8, 2015 5:16 p.m.
ainumelkor says... #10
turns out I have 17 instants/sorceries, not 18I calculated P(3 lands)= .2903 P(2 creatures)= .3088P(1 instant/sorcery)= .3891P(1 enchantment)= .3720To combine these: 7!/(3!2!1!1!).4 cubed * .33 squared * .17 * .10 = .0497 which seems to be a reasonable probability.alternatively, I could multiply all these probabilities together to get .01297 which also seems reasonable.
April 8, 2015 5:25 p.m.
Programmer_112 says... #11
The problem with the above is that the probabilities are conditional. Once you have "chosen" your 3 lands, there are only 4 slots left (5 if you count your first draw), so you are accounting for too much.
Also, I'd like to see your method of calculating probabilities, because I think you might be slightly low.
April 8, 2015 5:28 p.m.
Yeh it does seem low. It's a shame you can do the power sign on this site.
April 8, 2015 5:28 p.m.
ainumelkor says... #14
Combination calculations: nCr * p%r * (1-p)%(1-r) where %=caret
P(3 lands)= nCr(7,3) multiplied by p to the 3 which is .4.4.4, multiplied by (1-p) to the 4th which is .6.6.6.6 = .2903.P(2 creatures)= nCr(7,2) multiplied by p squared which is .33.33, multiplied by (1-p)to the 5th which is .67.67.67.67.67 = .3088.P(1 instant)= nCr(7,1) multiplied by p which is .17 multiplied by (1-p) to the 6th which is .83.83.83.83.83.83= .3891.P(1 enchantment)= nCr(7,1) multiplied by p which is .1 multiplied by (1-p) to the 6th which is .9.9.9.9.9.9= .3720
April 8, 2015 5:39 p.m.
ainumelkor says... #16
ikr? If only I could get a hang of this formatting.
I'm also trying to figure out how to create an algorithm for calculating the effect of partial mulligans, since the number of each card type will be different in different trials.
April 8, 2015 5:44 p.m.
Programmer_112 says... #17
So you have 101 cards, 1 of which is your commander. Should we assume that the commander is in the deck or in the command zone?
I'm pretty sure I know how to solve this, but I'm not sure how much stuff I should tell you. Basically, do you want hints or solutions?
April 8, 2015 9:32 p.m.
ainumelkor says... #18
@programmer_112
the card numbers in the original post are incorrect, i have 40L, 32C, 19 I/S, and 9E.
I'd just like to know if one of my methods in post #9 is correct/on the right track.
If you have a way I could factor in partial paris mulligans, I'd appreciate it as well.April 8, 2015 9:49 p.m.
Programmer_112 says... #19
I think your probability function is slightly off. You should be getting P(3 lands)=(7 choose 3)*(93 choose 37)/(100 choose 40), which is about 30.097%.
I can't tell what probabilities you're trying to multiply in post 9. 7!/(3!2!1!*1!) seems like it could go somewhere, but it also seems like it will be really tedious to account for the dependency.
The method I'm using for probabilities is super basic (I'm just counting number of desirable results/number of possible results), but it works very smoothly for this problem, because it allows you to account for dependent probability. Once you have P(3 lands), you can calculate P(2 Dudes given 3 lands), because you have 60 total slots left in your deck and 4 left in your hand, so you just modify the equation a tiny bit, and so you get probabilities that you can actually multiply. This is also good with Partial Paris because you know which cards are left in your deck.
April 8, 2015 10:10 p.m.
ainumelkor says... #20
but since the order in which I draw the cards doesn't matter, do I have to worry about dependency?
April 8, 2015 10:12 p.m.
Programmer_112 says... #21
Yes, you do, although it's kind of hard to explain why. Think of it this way: You draw a hand, and it's a 3-lander with 1 dude. Now, you shuffle all of your lands back in and draw a new 3. Again, shuffle all of your lands in and draw that many. Continue until you have no lands. Now, your expected number of dudes has increased, because each land has some probability of becoming one. The reason you have to account for dependency is because although order in your hand doesn't matter, the order of cards in the deck does matter, and since the hand is part of the deck at some point, its order is still relevant to the problem, even if changing the order of the hand doesn't really matter.
Yeah, this stuff is weird. It's a lot like the problem where you roll 2 dice and see that one die is a 4, which makes the probability that the other die is a 6 become 2/11, which doesn't make any sense but is true.
To show that we need to use dependent probabilities, we can use the fact that P(A and B) = P(B) * P(A given B). P(A given B) is a dependent probability, so P(A and B) must be as well.
April 8, 2015 10:36 p.m.
Programmer_112 says... #22
Also, if you want to determine whether or not to mulligan a hand, you should come up with a way to "score" hands. Maybe something like S=(-3)abs(lands-3) + (-2)abs(creatures-2) - abs(instants/sorceries - 1) - abs(enchantments - 1) + 14 (which gives your "perfect" hands the maximum score of 14). Once you have a formula, you can calculate the expected "score" of your hand if you mulligan, and determine whether or not to keep.
April 8, 2015 10:44 p.m.
ainumelkor says... #23
Ok, so if I use nCr(7,3)nCr(93,37)/nCr(100,40) to find the lands, do I need to incorporate this card loss into my creature calculations i.e. nCr(7,2)
nCr(91,30)/nCr(100,32) or would I start each calculation fresh, making the creature calculation
nCr(7,2)*nCr(98,30)/nCr(100,32)
April 8, 2015 10:48 p.m.
Programmer_112 says... #24
So, once you've found the probability for the lands, you've already decided which 40 slots the lands fill, so only 60 slots still exist for the purposes of the problem, 4 of which are in your hand. Thus, the creature calculation is (4 choose 2)*(56 choose 30)/(60 choose 32).
Make sure you understand what this calculation is doing. We are placing 2 creatures in the 4 hand slots (4 choose 2), the remaining 30 creatures in the remaining 56 deck slots (56 choose 30), then dividing by the total number of ways to arrange these 32 creatures in the 60 total slots (60 choose 32)
April 8, 2015 10:55 p.m.
ainumelkor says... #25
@#21 so the equation would look like
Score = 14 - 3x|L-3| - 2x|C-2| - |i-1| - |E-1|is the 14 point max an arbitrary number?
so a hand with 7 lands would score a -4, and a hand with 4 land, 1 creature, 1 inst, and 1 enchantment would score 9?
April 8, 2015 10:58 p.m.
Programmer_112 says... #26
Yeah, 14 is just arbitrary. You can tweak the numbers if you want (if you really need the right land count, for example, make the -3 into a -5 or something to make the wrong land count a lot more punishing). You could also change the asbsolute values to quadratics so that the difference between a 3 lander and a 4 lander is smaller than the difference between a 0 lander and a 1 lander. It's your project; do whatever fits.
April 8, 2015 11:03 p.m.
ainumelkor says... #27
@#25
ok I was wondering about the weighings, but that makes sense.
@#23I understand now what the calculations are doing, but what is preventing me from doing the enchantment calculation before the land one and changing the later proportions? for example I could do
nCr(7,1)x nCr(99,8)/nCr(100,9) = .63and a subsequent calculation of land probability would result in
nCr(6,3)x nCr(85,37)/nCr(91,40) = .308
April 8, 2015 11:18 p.m.
ainumelkor says... #28
to clarify my last post, are the numbers .300 and .308 coincidentally similar or is this an approximation that will always be close to the intended number?
April 8, 2015 11:29 p.m.
Programmer_112 says... #29
They are close because the one enchantment makes almost no difference in the probability of getting 3 lands. The difference between the land-after-enchantment probability and the land-before-enchantment probability is the difference in the probability of getting 3 lands given a random 1-enchantment hand and a random no-enchantment hand. Since (6 choose 3)(85 choose 37)/(91 choose 40) is about 0.0077 less than (7 choose 3)(93 choose 37)/(100 choose 40), we know that any given 1-enchantment hand is about 0.77% less likely to have 3 lands than a given no-enchantment hand
April 9, 2015 12:41 a.m.
Programmer_112 says... #30
To clarify - a "no-enchantment" hand in the above post means that no enchantments have been assigned yet.
April 9, 2015 12:42 a.m.
ainumelkor says... #31
Ok, so If I multiply all these probabilities together will I end up with the same result, no matter what order I calculate/select the card types to be drawn?
April 9, 2015 12:57 a.m.
ainumelkor says... #33
Ok, thanks for your help. I decided to change my goal a bit and instead find the probability that a mulligan will improve the viability of my hand. I used the equation
Score = 14 - 3x|L-3| - 2x|C-2| - |S-1| - |E-1| + 2Nwhere N is the hand size.for a size 6 hand:
Score = 14 - 2x|L-3| - 2x|C-2| - |S-1| + 2Nfor a size 5 hand:
Score = 14 - 2x|L-3| - 2x|C-1| - |S-1| + 2Nfor a size 4 hand:
Score = 14 - 2x|L-2| - |C-1| - |S-1| + 2Nand for a size 3 and lower I prioritized lands.
I'll probably do about 50 trials in which I'll mulligan away till 0. Then I'll hopefully be able to determine the probability that any mulligan'd hand will be better than the previous hand easily by comparing their scores.
April 9, 2015 5:41 p.m.
Programmer_112 says... #34
Looks like a good way to do it. You could also dynamically calculate the expected score of your hand if you mulligan, and use that, but either way should be good. Good luck!
ChiefBell says... #2
Not entirely sure but it's usually a case of multiplying.
April 8, 2015 4:32 p.m.