March 24, 2015

FIP v. xFIP

\[ FIP = cFIP+\frac{3 \cdot (BB+HBP)+13 \cdot HR -2 \cdot SO}{IP} \]

\[ xFIP = cFIP+\frac{3\cdot (BB+HBP)+13 \cdot FB \cdot \frac{HR_{league}}{FB_{league}}-2 \cdot SO}{IP} \]
\(cFIP\) is a constant that depends on the season

Which is the better predictor of itself?

FIP!

But is this a fair comparison?

Enter paxFIP and pnFIP

pnFIP \(=\) \[cFIP+\frac{3 \cdot (BB+HBP)+13 \cdot \frac{HR}{HR~PF} -2 \cdot SO}{IP} \]

paxFIP \(=\) \[cFIP+\frac{3\cdot (BB+HBP)+13 \cdot FB \cdot \frac{HR_{league}}{FB_{league}} \cdot {HR~PF} -2 \cdot SO}{IP} \]
\(cFIP\) is a constant that depends on the season

Sample Split Data

pitcher starter season split IP HR SO BB FB
1 105 1 2013 0 56.00 6 32 27 45
2 105 1 2013 1 61.67 12 40 41 54
3 126 1 2013 0 56.33 6 59 29 80
4 126 1 2014 0 42.00 5 38 12 62
5 126 1 2013 1 77.67 10 71 37 93
6 126 1 2014 1 30.67 5 26 16 43
7 206 0 2013 0 26.67 3 19 7 25
8 206 0 2013 1 22.33 3 21 8 21
9 225 1 2013 0 108.33 17 75 24 125
10 225 1 2014 0 89.33 6 60 16 94

SQL CODE part 1

select c.*
, round(cFIP+(3*(BB+HBP)+13*FB*`lg_HR/FB`-2*SO)/IP,4) as xFIP
, round(cFIP+(3*(BB+HBP)+13*FB*`lg_HR/FB`*HR_PF-2*SO)/IP,4) as paxFIP
, round(cFIP+(3*(BB+HBP)-2*SO+13*HR/`HR_PF`)/IP,3) as pnFIP
from
(select a.*, b.`lg_HR/FB` from
(select s.season, starter, split, teamid, pitcher as playerid, IP, HR
, BB, HBP, SO, FB, round(cFIP+(3*(BB+HBP)-2*SO+13*HR)/IP,3) as FIP
, cFIP from steamer_test.jt_split_data s left join 
steamer.fangraphs_season_constants f on s.season=f.season
where s.season>=2002) a left join 
(select season, sum(HR)/sum(FB) as `lg_HR/FB` from 
steamer_test.jt_split_data group by season having season>=2002) b
on a.season=b.season) as c left outer join
tht.season_pf pf on c.teamid=pf.teamid and c.season=pf.season
;

SQL CODE part 2

select *, 2/(1/z.IP + 1/o.IP) as harmonic_IP from
(select * from steamer_test.split_paxFIP_pnFIP 
where split=0) as z
left join 
(select * from steamer_test.split_paxFIP_pnFIP 
where split=1) as o
on z.playerid=o.playerid and z.starter=o.starter 
and z.season=o.season;