Run Ex

79 views
Skip to first unread message

jamesgentile

unread,
Apr 10, 2013, 7:22:41 PM4/10/13
to baseball-sq...@googlegroups.com
To address Matt's question about a Run Expectancy database:

There may be easier or better ways to do it with Retrosheet, but this is how I set up mine.

First I generated my own RE values using the method described at Chances Is (which Colin also mentioned).

Then I created a new table where I manually entered each of those values using start_bases_cd and outs_ct to define the base/out RE at the start of an event.
Like this:

create table RUN_EX_1a as 
 (case  when e.start_bases_cd = 0 and e.outs_ct = 0 then .539   
 when e.start_bases_cd = 1 and e.outs_ct = 0 then .929
 <etc...>
 END) as start_re
 
Then I added an RE value for the end of the event using end_bases_cd and a customized "end_outs_ct":

, (e.outs_ct + e.event_outs_ct) as end_outs_ct
,    (case
    when e.end_bases_cd = 0 and (e.outs_ct + e.event_outs_ct) = 0 then .539
    when e.end_bases_cd = 1 and (e.outs_ct + e.event_outs_ct) = 0 then .929
<etc...>
     END) as end_re
    from events e 
;

Then I subtracted the start_re from the end_re in a second table to calculate the change in RunEx for an event:

    create table RUN_EX as
    select r.*
    , r.event_runs_ct + r.end_bases_re - r.start_bases_re as RE24
    from RUN_EX_1a r




Reply all
Reply to author
Forward
0 new messages