1. Alright. I've been playing Texas hold-em online quite a bit recently, and I've collected about 150 hands worth of data. (Just my cards, unfortunately.)

All of the tests I've done on it so far have shown the cards to be random, except one, which I'm having some trouble with. So, rather than assume the game's rigged, I thought I should ask if I'm doing it right. (Especially since I'd need at least 1000 hands to reach statistical significance with this test.)

The test in question is checking the distribution of the high card. For those that don't know, a hand in Texas hold-em is only 2 cards, drawn from one normal poker deck. That other cards are drawn for the community cards and for the other players shouldn't affect the distribution of my two cards (right?).

Well, the equation I'm using to get the expected values is as follows. (I'm counting kings as 13s and aces as 1s.)

Arg. At this point, I realized that I was tallying up the wrong thing on my spreadsheet. Now I get a result of 0.69 instead of 4.5E-15. Still, I'm not certain my math is right, and I haven't done the math for the low card yet (though it should be similar), so maybe someone still has something to add.

For completeness, if anyone's interested, the actual count's are (from king to ace):
22, 16, 16, 15, 16, 18, 16, 10, 8, 2, 3, 2, 0

Edit: Oh yeah, while I'm here, can anyone think of any other good tests for a hand of just two cards?

2.

3. Hmm...so are you trying to obtain the frequencies at which you can expect certain high cards? I'm taking statistics right now so I could work on this. I kind of need a little better understanding of what you want though.

4. Yeah. From a two card hand, I'm looking for the frequency of each rank being the high card. I think my math may be right actually. Now that the counts are right, they seem to match.

5. I don't unnderstand what he is saying.
"The test in question is checking the distribution of the high card."

So a the high card is a king, so you are checking is you get the right number of kiings? Which would be 1 in every 13 cards.
so didvide the number of cards dealt by the number of kings you got and it will be 1 in 13

6. No, given two random cards, what's the probability of the higher of the two being a king (or queen, etc.)? Like I said, I'm pretty sure I've actually got the math right.

7. Originally Posted by MagiMaster
No, given two random cards, what's the probability of the higher of the two being a king (or queen, etc.)? Like I said, I'm pretty sure I've actually got the math right.
OK so you need a king or a queen.

If x is K or Q and 0 is lower than a K or Q you can have
xx =8/52 x 7/51 =0.0211161

x0 =8/52 x 40/51=0.1206637

0x =8/52 x 40/51=0.1206637

So adding them you get 0.2624434 or 26.2%

Edit -

What he actually said is
"From a two card hand, I'm looking for the frequency of each rank being the high card."

Which is hard to comprehend as to what he means?
" the frequency of each rank " - what does this mean?
presumably how often he gets a particualar card rank.

But how can a frequencey be a high card?

I guess it is a bit much to ask for people to make comprehendible posts!

8. I guess it's too much to ask for people to comprehend a clearly presented math question is a math forum. Actually, maybe it's just you. Even if I'm, by chance, using the word frequency slightly wrong, anyone who knows anything about probability should be able to make some sense of that question.

A frequency can't be a high card, but a high card can have a frequency. And no, I wasn't asking for a king or a queen. I ask, what is the frequency of X being the highest rank in a random two-card hand.

Given a ace-low ranking, there is exactly one hand with ace high: a pair of aces. Including the suits, that's actually 6 possibilities.

For 2 high, there's 3 hands: 2 A, A 2, and 2 2. With suits, the first two have 16 possibilities each, and the last has 6, for a total of 38.

For 3, there's 5 hands: 3 A, 3 2, A 3, 2 3, and 3 3. Again, with suits, that's, I think, 70 possibilities.

Etc.

To turn those into probabilities, divide by 52*51. To find the expected frequencies, given a number of trials, multiply the probabilities by the number of trials. That's what I was asking for.

(It looks like there might be a simpler formula for it, unless I made some mistake in those examples. It'd work out to . That seems way too simple, but I haven't tested it in anyway yet, and it looks like my previous formula could be simplified greatly.)

9. Originally Posted by MagiMaster
I guess it's too much to ask for people to comprehend a clearly presented math question is a math forum. Actually, maybe it's just you. Even if I'm, by chance, using the word frequency slightly wrong, anyone who knows anything about probability should be able to make some sense of that question.

A frequency can't be a high card, but a high card can have a frequency. And no, I wasn't asking for a king or a queen. I ask, what is the frequency of X being the highest rank in a random two-card hand.

Given a ace-low ranking, there is exactly one hand with ace high: a pair of aces. Including the suits, that's actually 6 possibilities.

For 2 high, there's 3 hands: 2 A, A 2, and 2 2. With suits, the first two have 16 possibilities each, and the last has 6, for a total of 38.

For 3, there's 5 hands: 3 A, 3 2, A 3, 2 3, and 3 3. Again, with suits, that's, I think, 70 possibilities.

Etc.

To turn those into probabilities, divide by 52*51. To find the expected frequencies, given a number of trials, multiply the probabilities by the number of trials. That's what I was asking for.

(It looks like there might be a simpler formula for it, unless I made some mistake in those examples. It'd work out to . That seems way too simple, but I haven't tested it in anyway yet, and it looks like my previous formula could be simplified greatly.)
Half the prolem is trying to figure out what the hell you are trying to ask!

For start you make an ace a low card when it is the highes card and you use the word frequency when proability is the right word, then I have to wonder what other 'mistakes' you have made in your description.
I am certainly unwilling to thy and figure out what you are saying from you maths - it's not worth it eseially if it is and eror and odity prone as your explaination.

"what is the frequency of X being the highest rank in a random two-card hand."

So you are asking what is the chance that a two ard hand dealt with have no car higher than a particular rank, for example no card higher than a jack.

And using the correct rank of cards in poker with an Ace high.
100% of hands will have no cad higher than an ace as there are no higher cards.

So for a king, there is one higher card, an ace (well four suited aces) so each hole card must not contain those 4 cards. 52 -4 =48 so there are 48 'allowable cards.
for the first card dealt and 47 for the second card dealt.
SO it is 48/52 x 47/51 =0.85

For a queen there are 8 higher cards so it is
44/52 x 43/51= 0.7134238

So to simplify it a bit 52 x 51 = 2652.0 is the denominator and the numerator is
4, 8 12 16 20 24 28 32 36 40 44 48.....etc for the cards
2 3 4 5 6 7 8 9 10 j q k ...(rank)

So if the rank is n the numerator is 4(n-1) x (4(n-1) -1)

=(4n-4 ) x (4n -1)

Dividing by the denominator = (4n-4 ) x (4n -4)-1/2652

So for an 8 it is 28x 27/2652 = 0.285 or 28.5% which I know is about right,
you would expect 2 cards 8 and lower 28% of the time.

10. Probability is good enough, but like I said, I'm looking for the frequency, which is just the probability times the number of trials.

Also, I'm not looking for the chance of a two card hand having no card higher than a given rank. I'm looking for the chance of a two card hand such the the high card has exactly a given rank. It's easy enough to get one form the other, but they aren't the same thing.

Finally, do you really think it matters whether I pick ace high or ace low? The numbers will be the same, just matched to different cards. Since all I care about is consistency, I took ace low since it makes some of the math a little easier.

11. so, you are trying to find the frequency that you will get the highest card in the deck?

if so, then by my understanding, it should be something like:

+

I think.

and for your purposes, then the probability of drawing any given card, will be

and only the other players will affect that probability, and likewise, the frequency of your draw. but assuming you get both of your cards first, that will be the probability that you get one of those cards to be a king, or even both. The probability that the first is a king, plus the probability that, assuming the first wasn't, the second is. and it will work for any and all cards you wish to test. the odds that you draw the higher card than anyone else though, is much more complex.

12. No.

Ok, look. Given any two card hand, there will be a highest rank. Given many such hands, you can count up how many there were with X being the highest rank (how many king-high hands, how many queen-high hands, etc.). The question is, given such a count, what numbers should you expect? That is, [what is the expected probability of a given suit being highest in a two card hand] times [the number of hands counted].

If yall still can't get it, I really doubt I can do anything more than repeat myself... :?

Edit: Ok wait, there's one more way I can possibly describe it. Going back to why I was doing this in the first place...

To test whether the game is fair I chose to use Pearson's chi-square test, since that's what I'm familiar with. To use this test, at least the way I know how to use it, each sample needs to be placed into exactly one bin. For example, you could make a bin for each rank and place each hand in based on the first card dealt, or the second, or the highest, or the lowest, etc. To actually test these numbers though, you need to know what the counts theoretically should be. For the first or the second card, it's just the number of hands divided by 13. For the highest or lowest card, it's not so simple, hence my original question.

13. OK so one card must be a particular suit (x) the other must be no higher (y).

So you can have xy or yx

My example did yy

SO I think you can simply change it to turn the first y into x.

I had ((4n-4 ) x (4n -4)-1)/2652

So I think you can change it to 4 x ((4n-4)-1)/ 2652

I need to check that.

14. you must take into account everyone else hand, sadly

I tend to use lower mathematics over the derived methods. the number of players and your position on the table(order you are dealt cards) affect the odds and, subsequently, the frequency.

and with this, the odds that , for a table of people with you sitting in the seat, you are dealt the and the cards. To figure out the odds that you get the highest, you look at draws, with all but and being the 'undesirable' lesser cards and either or or both being the high card, but not higher. or are you trying to figure the odds that you have at least the highest, because thats a bit trickier.

15. 4/52 x 3+4(n-1)/51

= [12 + 16n -16]/2652

That is the answer I believe.

Seems to work for 1 and 13 anyway.

I had a it of a problem understanding why it is not twice that
becasue it can happen 2 ways ut maybe that is explained
by that it will happen each way 50% of the time?

I'm stil not sure.
May bit is twice that but AA( 1,1) is a special case

Anyway I worked it out when playing poker so I was not fully concentrating.

16. that doesn't work for 13, because a king high card hand is:

K,W
E,K

where K=king=13, W=whatever=1 through 13, and E=everything else=1 through 12 is the probability of getting K,W + E,K which, if I'm not mistaken is
which reduces to
which reduces to

unless I'm horribly horribly wrong

Edit1: but judging from his hands, mine is closer for the king:

and mine
and yours

Edit2: you have half of it, it should be

where n is the value, from , of the card you want to test

frequency being

where g=# of games played

and this only applies to if no other players are considered

17. Ok say n= high rank.

you can n n or n y or y n where y=lower than n.

nn= 4/52 x 3/51

ny= 4/52 x 4(n-1)/51

yn= 4(n-1)/52 x 4/51

Note ny=yn.

So for both you can put

32(n-1)/2652

So the total is 4/52 x 3/51 +32(n-1)/2652

Now that works for 1 as (n-1)=0.

Now for 13 we get 0.0045249 +0.1447964 =0.1493213

And 1/0.1493213=6.6969691

So you get king or higher every 6.6969691 hands?

Or should it be 6.5? basically 13/2?

I am not sure but I think I can do a computer simulation it would have been
qucker to do that in the first place!!

18. My computre simulation gave a value of 6.8257988
Which is closer to yours but still not good enouogh to agreee.

19. that's wrong

the way to do this properly is H,W and L,W
where H=high card, W=anything of at most the value of the High card, and
L= anything lesser than the high card.

you get
( or ) + ( or ) =

20. Okay. This is going to suck.
first I will define all of my variables;
=total number of players positions
C=the magnitude of the card you are finding

for this, we get, the cards and , which are the ones we care about.

+

plugging in your position and the total positions will give you a nice equation to solve for your likelyhood of getting the card you want.

I think.

21. Originally Posted by Arcane_Mathamatition
that's wrong

So what is right - not you apparently!!

http://www.learn-texas-holdem.com/te...babilities.htm
A in hand preflop 16 1 in 6.25 - 5.25:1

22. Actually I think there was an error in my simulation
the latest answer it gives is 6.693454

Which is qute close to a value I got earlier - might just be chance though.

Running it even longer I get:-

Count 200000000 Pairs 29868961 ratio 6.695914

Which is quite close to the 6.6969691 I calculated earlier.

I'd be surprised if I made the same error as it is a different method.

I am doing an even longer run but it will take quite a while aout 10 minutes of more.

23. Originally Posted by esbo
Originally Posted by Arcane_Mathamatition
that's wrong

So what is right - not you apparently!!

http://www.learn-texas-holdem.com/te...babilities.htm
A in hand preflop 16 1 in 6.25 - 5.25:1
I'm sorry, I've edited my post. and it assumes there are other players, which we are not, plus other variables

24. Result of the really long run gives:-

Count 2000000000 Pairs 298646791 ratio 6.696874

Which is almost spot on the value I calculated.

6.6969691
6.696874

I was trying an even longer run but the computer won't hold an integer much bigger.

So either I got it right or I got it wrong by two different methods!!

Code:
#include <stdio.h>

main(argc,argv)
int  argc;
char *argv[];
{
int cards[52]={1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52};
int a,x,y, z;
int c, pair;
srand(1);
for(c=0;c<2000000000;c++){
x=(rand())%52;
while((y=(rand())%52)==x);
//		printf("x %d y %d\n",cards[x],cards[y]);
if (cards[x]>=49 ||cards[y]>=49  )
{
pair++;
//			printf("Pair x %d y %d\n",cards[x],cards[y]);

}

}
printf("\nCount %d Pairs %d ratio %f",c,pair, (double)c/pair);
}
I get a random number betwen 1 and 52 then I get another, if it is the same (same card) I discard it and try again untill I get a different card.

Then I test if either number is one of the top four cards 49 50 51 52.

I don't think I made an error but it is possible, however it matches my calculated value very closely.

Interesting problem!!

25. you are right. its just an odd way to go about it, imo. I had a reduction problem, my bad, but my expanded version was still correct. it should come out to which, will give the infinitely repeating decimal of

26. Here it gives the odds as 0.1666667

http://www.rivered.co.uk/poker_percentages.html
# 1 or more aces
- 6/1 - 15%

Which is close but not the same.

27. Originally Posted by Arcane_Mathamatition
you are right. its just an odd way to go about it, imo. I had a reduction problem, my bad, but my expanded version was still correct. it should come out to which, will give the infinitely repeating decimal of

Yes I expect mine would be the same but for rounding errors in my calculator.

Ayway I like to do a simulation to check I have not made a mistake, if they agree I can be pretty sure its the right answer!!

28. you also have to take into account that this all assumes more than one player. we are only assuming that one person gets cards

Originally Posted by esbo
Yes I expect mine would be the same but for rounding errors in my calculator.
and that's why I always do the math before I use a calculator, to get the "exact" answer.

29. Actually, assuming you don't know anything about any other cards, it shouldn't actually change the probabilities. I'd have collected information on the community cards too, but that's a lot harder to do in the middle of playing the game (not to mention the problems of not seeing all of them all the time).

30. the community is irrelevant, but, if you are dealing with more players than you, it matters, because, the deal goes; , , , then , and depending on where you are in the deal, alters the odds that you will get the card that you want. Because if you are the third person, 2 people get a card before you, meaning your first card is chosen out of 50 instead of 52, and your second card is the dealt and is, justly, dealt from a deck now of 48 instead of 51

31. The number of people at the table is irrelevent.
For example I could take three random cards out of my simulation
and it would ot make any difference. My cards are still picked at random.

32. Originally Posted by Arcane_Mathamatition
the community is irrelevant, but, if you are dealing with more players than you, it matters, because, the deal goes; , , , then , and depending on where you are in the deal, alters the odds that you will get the card that you want. Because if you are the third person, 2 people get a card before you, meaning your first card is chosen out of 50 instead of 52, and your second card is the dealt and is, justly, dealt from a deck now of 48 instead of 51
The thing is, unless you know what those other cards are, all the different possibilities add up and cancel out.

33. These are my simulated results for runs of 20 million hands per rank, more than
most pokers players would play in a lifetime!!

Code:
Rank  1 ratio 0.1494 odds   6.6942-1
Rank  2 ratio 0.1371 odds   7.2923-1
Rank  3 ratio 0.1252 odds   7.9881-1
Rank  4 ratio 0.1131 odds   8.8389-1
Rank  5 ratio 0.1011 odds   9.8920-1
Rank  6 ratio 0.0890 odds  11.2395-1
Rank  7 ratio 0.0769 odds  13.0010-1
Rank  8 ratio 0.0649 odds  15.4029-1
Rank  9 ratio 0.0528 odds  18.9385-1
Rank 10 ratio 0.0408 odds  24.5319-1
Rank 11 ratio 0.0287 odds  34.8895-1
Rank 12 ratio 0.0166 odds  60.2228-1
Rank 13 ratio 0.0045 odds 220.0365-1
Run Count 20000000

34. That agrees with the formula , and with my counts from the game. (My second formula is apparently off by a factor of 2.)

35. Originally Posted by MagiMaster
That agrees with the formula , and with my counts from the game. (My second formula is apparently off by a factor of 2.)
The factor of two probably comes from the fact that your hand is the same which ever order your hand is dealt ie AH JD or JD AH.
Doing a simulation can help avoid certain type of error but may perhaps introduce others it's probaly quicker than doing the maths too!
Quite amazing that my computer can deal about a billion hands in a few seconds!

I hope to extend it to do some more complicated poker stuff.

36. are you trying to find the likelyhood that YOU will get the high card or just the occurences per hand? because, in a real game, I don't care what program you run, the other players matter. your program doesnt factor that, and it doesn't cancel.

if there are two people, and the card order goes 1st Player 2nd Player 1st Player 2nd Player, then it does change the odds that YOU (say, the first player) get a king, or whatever, and have the highest card. it becomes which gives the odds to be or, approximately 1:7.5790873. It's still random, but the odds are slightly different, as you MUST consider all variables preflop.

37. All I care about for the moment is the highest card in my hand, regardless of whether or not someone else has higher. In such a case, the other players' cards will cancel out.

For example, let's compare the probabilities of getting a king in two cards, versus getting a king on cards 1 or 3 in 3 cards.

King in two cards is (king)+(whatever) or (not a king)+(king):

King on cards 1 or 3 of 3 cards would be (king)+(whatever)+(whatever), (not a king)+(king)+(king) or (not a king)+(not a king)+(king):

If you don't make any assumptions about the other players' cards, they won't change the probabilities of your cards. If you do assume something (like whether or not you have the highest card overall) then it will make a difference.

38. I was under the impression that you wanted the highest card overall, not just the frequency of getting a specific card being the highest. My fault.

39. As much as I'd love to collect all the information to test that, just getting my cards is hard enough in the middle of the game.

I'm wondering if the nature of the community cards (not always getting to see all of them) would disturb their randomness? I'm assuming that it would, but I don't know how to prove that.

40. by community, you mean the flop, river, and turn cards? or the other players? just trying to be clear

41. Community cards would be those that belong to everyone, so the flop/river/turn.

42. ah, okay. The flop/river/turn do not affect yours nor any other person's hand, but, those hands will affect the flop/river/turn. and whether or not you know what everyone else has doesn't change the impact that those hands have on the community cards, but it I understand that it becomes hard to gather all of that data to test the odds of, say, getting a straight flush or a four of a kind. It would be interesting to test these hands odds to see how realistic they really are.

43. Well, by testing, in this case, I meant testing to see if the online game was playing fair.

44. I understand that, and that's kind of what I meant. it is a computer program, and by such isn't truly random. It would be interesting to see how the results match up

45. Well, ok. I know it's not actually random, but it there are good PRNGs and there are bad PRNGs and then there are games that simply cheat. I'm more worried about the last case since I pretty much know which PRNG they're using (Java's Random class, which is good enough since real money isn't really involved).

 Bookmarks
##### Bookmarks
 Posting Permissions
 You may not post new threads You may not post replies You may not post attachments You may not edit your posts   BB code is On Smilies are On [IMG] code is On [VIDEO] code is On HTML code is Off Trackbacks are Off Pingbacks are Off Refbacks are On Terms of Use Agreement