Bet and Fold when meets aggression

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

Bet and Fold when meets aggression

Postby preparac » Sun Sep 13, 2009 6:50 pm

I want to create a stat

Fold % to aggresion When Bet = Percentage of the time a player eventually folded to aggression (i.e. to a single raise or a bet on a later street) when they made some bet.

I would build the value expression like this:

((cnt_fold_toaggression_when_f_bet + cnt_fold_toaggression_when_t_bet + cnt_fold_toaggression_when_r_bet) / (cnt_f_bet_face_aggression + cnt_t_bet_face_aggression + cnt_f_bet_face_aggression)) * 100

where

cnt_fold_toaggression_when_f_bet =
sum( if[ tourney_holdem_hand_player_statistics.flg_f_bet AND (tourney_holdem_hand_player_detail.amt_f_bet_facing > 0 OR
tourney_holdem_hand_player_detail.amt_t_bet_facing > 0 OR tourney_holdem_hand_player_detail.amt_r_bet_facing > 0) AND NOT (tourney_holdem_hand_player_statistics.flg_won_hand) AND NOT (tourney_holdem_hand_player_statistics.flg_showdown), 1, 0])

and

cnt_f_bet_face_aggression

sum(if[ tourney_holdem_hand_player_statistics.flg_f_bet AND (tourney_holdem_hand_player_detail.amt_f_bet_facing > 0 OR
tourney_holdem_hand_player_detail.amt_t_bet_facing > 0 OR tourney_holdem_hand_player_detail.amt_r_bet_facing > 0), 1, 0])

But I thik like this I will not exactly count the cases whre the betting player folds to a single raise or a bet on a later street ....?

Thanx for your help
preparac
 
Posts: 323
Joined: Thu May 15, 2008 6:23 am

Re: Bet and Fold when meets aggression

Postby WhiteRider » Mon Sep 14, 2009 4:38 am

Just to confirm - you only want to count times the player folds to a single raise after they have bet or to a single bet on a later street?

To do this you'll need to use the action strings as well, I think.

cnt_fold_toaggression_when_f_bet =
sum( if[ tourney_holdem_hand_player_statistics.flg_f_bet AND (lookup_actions_f.action = 'BF' OR (tourney_holdem_hand_player_detail.amt_t_bet_facing > 0 AND lookup_actions_t.action SIMILAR TO '(F|XF)') OR (tourney_holdem_hand_player_detail.amt_r_bet_facing > 0 AND lookup_actions_r.action SIMILAR TO '(F|XF)') ), 1, 0 ])

This says you bet the flop (same as you already have) and
Your actions were bet/fold on the flop
OR
You faced a bet on the turn and either folded or check/folded
OR the same on the river.

You'll need to be careful doing this with separate columns like that because you might end up counting some hands twice - for instance if you bet the flop and bet the turn then fold to a single bet on the river that hand would count in both the flop and turn versions of your columns - you would probably be better having a single column for all cases.
WhiteRider
Moderator
 
Posts: 54025
Joined: Sat Jan 19, 2008 7:06 pm
Location: UK

Re: Bet and Fold when meets aggression

Postby kraada » Mon Sep 14, 2009 8:34 am

I noticed you also said fold to a raise. With WhiteRider's definition the following hand wouldn't come up:

You raise preflop, and get called, bet the flop, and get called, bet the turn and get raised and fold to the raise.

If you want that to count (and the river variant as well)you need this expression instead:

cnt_fold_toaggression_when_f_bet =
sum( if[ tourney_holdem_hand_player_statistics.flg_f_bet AND (lookup_actions_f.action = 'BF' OR (tourney_holdem_hand_player_detail.amt_t_bet_facing > 0 AND lookup_actions_t.action SIMILAR TO '(F|XF)') OR (tourney_holdem_hand_player_detail.amt_r_bet_facing > 0 AND lookup_actions_r.action SIMILAR TO '(F|XF)') OR (tourney_holdem_hand_player_detail.amt_t_raise_facing > 0 AND tourney_holdem_hand_player_statistics.enum_folded = 'T') OR (tourney_holdem_hand_player_detail.amt_r_raise_facing > 0 AND tourney_holdem_hand_player_statistics.enum_folded = 'R') ), 1, 0 ])
kraada
Moderator
 
Posts: 54430
Joined: Wed Mar 05, 2008 2:32 am
Location: NY

Re: Bet and Fold when meets aggression

Postby WhiteRider » Mon Sep 14, 2009 8:38 am

Yeah, that's kind-of what I was getting at here:
WhiteRider wrote:You'll need to be careful doing this with separate columns like that because you might end up counting some hands twice - for instance if you bet the flop and bet the turn then fold to a single bet on the river that hand would count in both the flop and turn versions of your columns - you would probably be better having a single column for all cases.

The column preparac built originally, and my update, are both just for flop bets - I think the original intention was to have a column for each street and sum the results to get a total stat.
WhiteRider
Moderator
 
Posts: 54025
Joined: Sat Jan 19, 2008 7:06 pm
Location: UK

Re: Bet and Fold when meets aggression

Postby preparac » Mon Sep 14, 2009 2:13 pm

Ok, thank you very much.

I didn't know the function lookup_actions_r.action SIMILAR TO '(F|XF)') before. What exactly does 'SIMILAR TO' do?
preparac
 
Posts: 323
Joined: Thu May 15, 2008 6:23 am

Re: Bet and Fold when meets aggression

Postby kraada » Mon Sep 14, 2009 2:45 pm

SIMILAR TO does regular expressions pattern matching. See this page in the PostgreSQL documentation for more details.
kraada
Moderator
 
Posts: 54430
Joined: Wed Mar 05, 2008 2:32 am
Location: NY

Re: Bet and Fold when meets aggression

Postby preparac » Tue Sep 15, 2009 4:05 pm

Ok, very interesting link. But this is definitly leading to far for me at the moment. Who knows, some day I will take som SQL-classes and then … perhaps.
So I will stick with the LIKE-function, which I also don’t claim to understand but at least I know how to use it, I think.

So …. I when I want to calculate the percentage of times when a player bet the flop, and then folded to a single raise on the flop or to the first bet on later streets, I can build the nominator like this:

cnt_fold_toaggression_when_f_bet =

sum( if[ tourney_holdem_hand_player_statistics.flg_f_bet AND lookup_actions_f.action = 'BF') OR
(tourney_holdem_hand_player_statistics.flg_f_bet AND NOT tourney_holdem_hand_player_detail.amt_f_bet_facing > 0 AND (lookup_actions_t.action = 'XF' OR lookup_actions_t.action = 'F') OR
(tourney_holdem_hand_player_statistics.flg_f_bet AND NOT tourney_holdem_hand_player_detail.amt_f_bet_facing > 0 AND lookup_actions_t.action = 'X' AND (lookup_actions_r.action = 'XF' OR lookup_actions_r.action = 'F')

correct?

And the denominator like this:

sum( if[ tourney_holdem_hand_player_statistics.flg_f_bet AND tourney_holdem_hand_player_statistics.flg_f_face_raise) OR
(tourney_holdem_hand_player_statistics.flg_f_bet AND NOT tourney_holdem_hand_player_detail.amt_f_bet_facing > 0 AND (lookup_actions_t.action = 'X%' OR tourney_holdem_hand_player_detail.flg_t_float_def_opp) OR
tourney_holdem_hand_player_statistics.flg_f_bet AND NOT tourney_holdem_hand_player_detail.amt_f_bet_facing > 0 AND lookup_actions_t.action = 'X' AND (lookup_actions_r.action = 'X%' OR tourney_holdem_hand_player_detail.flg_r_float_def_opp)

… is this accurate???
preparac
 
Posts: 323
Joined: Thu May 15, 2008 6:23 am

Re: Bet and Fold when meets aggression

Postby preparac » Tue Sep 15, 2009 5:10 pm

To exclude cases where ther is no Turn and River action at all, canI formulate the denominator better like this (lookup_actions_r.action = 'X%' AND NOT lookup_actions_r.action = 'X'):

sum( if[ (tourney_holdem_hand_player_statistics.flg_f_bet AND tourney_holdem_hand_player_statistics.flg_f_face_raise) OR
((tourney_holdem_hand_player_statistics.flg_f_bet AND NOT tourney_holdem_hand_player_detail.amt_f_bet_facing > 0 AND (lookup_actions_t.action = 'X%' OR tourney_holdem_hand_player_detail.flg_t_float_def_opp) OR
(tourney_holdem_hand_player_statistics.flg_f_bet AND NOT tourney_holdem_hand_player_detail.amt_f_bet_facing > 0 AND lookup_actions_t.action = 'X' AND ((lookup_actions_r.action = 'X%' AND NOT lookup_actions_r.action = 'X') OR tourney_holdem_hand_player_detail.flg_r_float_def_opp))

??
preparac
 
Posts: 323
Joined: Thu May 15, 2008 6:23 am

Re: Bet and Fold when meets aggression

Postby WhiteRider » Wed Sep 16, 2009 5:32 am

These look basically right.

A couple of points..

tourney_holdem_hand_player_statistics.flg_f_bet AND NOT tourney_holdem_hand_player_detail.amt_f_bet_facing > 0

If you bet the flop then you can never face a bet on the flop, so the amt_f_bet_facing can NEVER be > 0.
i.e. you don't need the second part.
Ah - I think you are probably trying to check for facing a raise?
In which case you want: tourney_holdem_hand_player_detail.amt_f_raise_facing = 0

I would build your column: cnt_fold_toaggression_when_f_bet
..like this:

sum( if[ tourney_holdem_hand_player_statistics.flg_f_bet AND (lookup_actions_f.action = 'BF' OR (tourney_holdem_hand_player_detail.amt_f_raise_facing = 0 AND (lookup_actions_t.action = 'XF' OR lookup_actions_t.action = 'F') OR (lookup_actions_t.action = 'X' AND (lookup_actions_r.action = 'XF' OR lookup_actions_r.action = 'F')))), 1, 0 ] )

NOTE: if you use % in the string comparison then you are using "pattern matching" (you're checking for a pattern, not an exact string) and you need to use LIKE instead of =.
lookup_actions_r.action = 'X%'
..will NOT work - you need to do:
lookup_actions_r.action LIKE 'X%'

To answer your question:
To exclude cases where ther is no Turn and River action at all, can I formulate the denominator better like this (lookup_actions_r.action = 'X%' AND NOT lookup_actions_r.action = 'X'):

You could use this instead:
lookup_actions_r.action LIKE 'X_%'
The _ represents exactly one character, so this means check and at least one more action.

I would do your denominator like this:

sum( if[ tourney_holdem_hand_player_statistics.flg_f_bet AND (tourney_holdem_hand_player_detail.amt_f_raise_facing > 0 OR
(NOT tourney_holdem_hand_player_statistics.flg_t_bet AND NOT tourney_holdem_hand_player_statistics.flg_r_bet AND (tourney_holdem_hand_player_detail.amt_t_bet_facing > 0 OR tourney_holdem_hand_player_detail.amt_r_bet_facing > 0) )), 1, 0 ] )

This does not include times you face a raise on the turn or river as you might count that as a different situation, but that's easy to add if you do want it.

NOTE: I haven't actually tested these columns - they validate, but I haven't verified that they do exactly what you want so double check them before you use them.
WhiteRider
Moderator
 
Posts: 54025
Joined: Sat Jan 19, 2008 7:06 pm
Location: UK

Re: Bet and Fold when meets aggression

Postby preparac » Wed Sep 16, 2009 7:04 am

Ok

tourney_holdem_hand_player_detail.amt_f_raise_facing = 0 .... yes indeed, I wantet to take this one

LIKE instead of = ... thanks

lookup_actions_r.action LIKE 'X_%' .... looks nicer

Thank you very much again. I will let you know, if this stat really works fine
preparac
 
Posts: 323
Joined: Thu May 15, 2008 6:23 am

Next

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

Who is online

Users browsing this forum: No registered users and 0 guests