question about stats

Forum for users that want to write their own custom queries against the PT database either via the Structured Query Language (SQL) or using the PT3 custom stats/reports interface.

Moderator: Moderators

question about stats

Postby jaxx » Sun Jun 21, 2009 6:36 pm

Hello
Does PT3 have these 2 stats:

- the percent of time when someone tries a steal when folded to him in SB
- the percent of time the BB raises when all fold and SB completes
?
jaxx
 
Posts: 87
Joined: Thu Oct 09, 2008 3:37 pm

Re: question about stats

Postby kraada » Sun Jun 21, 2009 8:58 pm

The first stat is there, at least you can display it for the HUD in Beta 28.1 - use attempt to steal and set it for Blinds. The only time you can attempt to steal is when folded to in the small blind.

The percent of the time the BB raises when only the SB has put money in and he completed is buildable, it's just a bit tricky.

You'd need these two columns:

cnt_p_bb_raise_facing_sb_limp: sum(if[holdem_hand_player_statistics.position = 8 and holdem_hand_player_detail.val_p_raise_made_pct > 0 and (100 / holdem_hand_player_detail.val_p_raise_made_pct) * holdem_hand_player_detail.amt_p_raise_made = 2 * holdem_hand_player_detail.amt_blind, 1, 0])

cnt_p_bb_open_opp_facing_sb_limp: sum(if[(holdem_hand_player_statistics.position = 8 and holdem_hand_player_detail.val_p_raise_made_pct > 0 and (100 / holdem_hand_player_detail.val_p_raise_made_pct) * holdem_hand_player_detail.amt_p_raise_made = 2 * holdem_hand_player_detail.amt_blind)) or (holdem_hand_player_statistics.position = 8 and lookup_action_p.action LIKE 'X' and holdem_hand_player_statistics.flg_f_has_position), 1, 0])

Let me take a moment to explain this one for you as it is in fact tricky.

First, the case where you actually raise in the bb facing a sb limp. position = 8 means you're in the BB. That val_p_raise_made_pct > 0 means you raised preflop. All well and good. Now let's look at the other equality:
(100 / holdem_hand_player_detail.val_p_raise_made_pct) * holdem_hand_player_detail.amt_p_raise_made = 2 * holdem_hand_player_detail.amt_blind

The right side of the equality is pretty simple, twice the big blind (since you're in the BB and you put in one big blind, amt_blind is always 1bb). So what is equal to twice the big blind? Recall that val_p_raise_made_pct is the percentage of the pot that you raised preflop. You could also express this as:
(amount of raise / amount of pot) * 100 (if the pot is 2 and you raise 1, you raised 1/2 * 100 or 50% of the pot). So we have 100 over val_p_raise_made_pct, which then gives:
1 / (amount of raise / amount of pot), or (amount of pot / amount of raise). We multiply by amount of raise, which causes it to cancel. All that's left is the amount of the pot.

So we are saying the pot is equal to two big blinds. The only time the pot can be equal to two big blinds is when the SB completes and it's to you in the BB. In all other cases if someone else puts money in the pot is bigger.

So you can see this picks out the times when the SB has limped and you raised.

Moving on to the opportunity column, we have two cases: (a) where you were in the BB, had the chance to raise the SB limper and raised, or (b) you had the chance to raise the SB limper, and checked. We already have (a) from the piece for seeing when you did actually in fact raise. So we have that, OR the following setup: (holdem_hand_player_statistics.position = 8 and lookup_action_p.action LIKE 'X' and holdem_hand_player_statistics.flg_f_has_position)

In this case again we are in the SB, our preflop action is just checking. That means we could not have been facing a preflop raise, so all people in the pot must have limped. We also add that we must have position on the flop (note: if we check in the BB there will always be a flop), but the only time we can have position on the flop and there have been no preflop raise is if the SB limped.

And that covers all cases.

(Then you just need to build the statistic using these two columns.)
kraada
Moderator
 
Posts: 54430
Joined: Wed Mar 05, 2008 2:32 am
Location: NY

Re: question about stats

Postby jaxx » Mon Jun 22, 2009 6:57 pm

Thanks for the explanation.
I have some questions however:

holdem_hand_player_statistics.position = 8 - why does this mean that we are on a BB in a 10 handed table?

lookup_action_p.action LIKE 'X' - what does this mean exactly? i did not find it in the docs. X = checking? why 'LIKE'?
jaxx
 
Posts: 87
Joined: Thu Oct 09, 2008 3:37 pm

Re: question about stats

Postby WhiteRider » Tue Jun 23, 2009 4:37 am

The BB is always position 8 at any size of table. The SB is always 9.
This is so that you can always identify the blind positions explicitly.

LIKE is a string comparison (pattern matching) function used in postgres.
LIKE 'X' means that the string is exactly X, but you can make less exactly comparisons, for instance LIKE 'R%' means the first action was raise followed by any other actions.
See the postgres documentation or the custom stats and reports FAQ.
WhiteRider
Moderator
 
Posts: 54025
Joined: Sat Jan 19, 2008 7:06 pm
Location: UK


Return to Custom Stats, Reports, and SQL [Read Only]

Who is online

Users browsing this forum: No registered users and 0 guests