# xfip: xFIP In Sabermetrics: Sabermetrics Functions for Baseball Analytics

## Description

xFIP is a statistic that estimates a pitcher's expected run prevention independent of the performance of the defense.

## Usage

 `1` ```xfip(flyballs, lgHRFB, BB, HBP, K, ip, year) ```

## Arguments

 `flyballs` Fly balls allowed `lgHRFB` League HR/FB Percentage `BB` Balls Allowed `HBP` Hit By Pitches Allowed `K` Strikeouts `ip` Innings Pitched `year` Season

## Details

xFIP is almost exactly like FIP, except it uses the expected number of home runs taking the pitcher's fly balls allowed times the league average home run per fly ball rate.

## Value

Returns a numeric value equal to (13*(flyballs*lgHRFB)+(3*(BB+HBP))-(2*K))/(ip)+constant

## Note

Innings Pitched (IP) is commonly reported with .1 indicating 1/3 of an inning and .2 indicating 2/3 of an inning. In order for this function to be accurate, please change the decimal to .333 for 1/3 of an inning and .666 for 2/3 of an inning.

Peter Xenopoulos

## References

http://www.fangraphs.com/library/pitching/xfip/

 ```1 2 3 4 5 6 7 8 9``` ```## The function is currently defined as function (flyballs, lgHRFB, BB, HBP, K, ip, year) { constant <- linearWeights\$cFIP[which(linearWeights\$Season == year)] xfip <- (13 * (flyballs * lgHRFB) + (3 * (BB + HBP)) - (2 * K))/(ip) + constant return(xfip) } ```