The ERA Equation

Fictional Fantasy Baseball – The Studyball Kurmudgeons

Rarely do I freely venture into the land of mathematics, but as that pertains to statistics, one could say there is love, not anger, death and PAIN. I’m not sure my endeavors serves any other purpose other than to fascinate my brain and make it work in a different way to figure out the solution to a problem, but regardless of notoriety, the task is noble. Back in the good ol’ days I was writing equations while manic that Excel couldn’t resolve, because they were written stupidly and abhorrently complex, ah yes, sweet memory… wait, this is a not good memory… however, I was able to do most of what I wanted, but not all. Fortunately I have found a middle ground between epiphany and practicality. The mechanism of my learning has been a logical argument within Microsoft Excel (or Google Sheets): IF/AND.

Excel allows one to look at or through data in a variety of ways, and boy is there a lot of data around Baseball. I take real 7-day MLB sums from players across the league and the results tell me something about how my own scoring configuration might balance, or scale in certain areas, as appropriate. The things that are hard to write equations for are those that modify or scale a result, or have an array of possible outcomes but somehow need to all be accounted for. Building a massive array by entering all the possible outcomes is not practical when dealing in hundreds. Equations need to be sleek, quick and able to return a sensible answer under any circumstances.

My task over the last couple of days was to make a logical equation using AND, IF or both, and try to weight the ERA over a game period like ranking the scoring/yardage surrendered by NFL team defenses. ERA becomes a scaling reward for low totals, and becomes a worthless (or a negative total) after 4. I had a similar equation already written for the NFL spreadsheet but all the values and references had to be changed.

=SUM[this is just the mechanism that will total the result as an integer]

(IF([condition/test],[result if Y],[result if N]

IF(AND[condition/test],[result if Y],(IF(AND[nested IF as negative response triggers second criteria in the next argument while building off the previous argument, as long as AND is present]

My initial equation looked like this:

=SUM(IF(D1=0,””,(IF(D1<.001,[value cell 0],(IF(D1=0,[value cell 1](AND(D1<.99,D1>.001,[value cell 2],(IF(AND(D1<1.99,D1…….. so on and so forth, moving the needle higher as the ranges of ERA are graded as they fall between one of the equations areas. But I was acting like there was a value below zero I had to be worried about, which is a product of using the equation from the NFL Fantasy Scorecard where those values are possible in the net yardage equation. After taking notice of the parameter change, I rewrote the beginning. 

There is a little “housekeeping” to settle up front, taking into account all numbers that COULD BE RENDERED on the spreadsheet. The D1, lets just say is the cell where the manual ERA will be entered on the sheet.

This specific line means, if D1 has no value in it, show nothing (represented by a text quote with no text “”) since zero is an ERA value there should be nothing to render if the cell is empty. 

After the above action, the next is to squarely assign a value to 0, since bridging ranges on it is problematic. The, the lowest value in the first range, mathematically expressed in greater-than less-than form. This can be repeated over and over, laying one on top of the other as the N condition until a result is returned.

The whole equation on the spreadsheet itself looks like this:

 

=SUM(IF(C21=“”,0,(IF(AND(C21=0),Rules!B40,(IF(AND(C21>0,C21<1),Rules!B40,(IF(AND(C21>0.99,C21<2),Rules!B41,(IF(AND(C21>1.99,C21<3),Rules!B42,(IF(AND(C21>2.99,C21<4),Rules!B43,(IF(AND(C21>3.99,C21<5),Rules!B44,(IF(AND(C21>4.99,C21<6),Rules!B45,(IF(C21>5.99,Rules!B46))))))))))))))))))

Those values triggered a result dependent on the integer in the cell, and were located on a separate page within the file:

The parallel between the NFL DEF/ST is undeniable because it is pretty much the same fucking thing. Beautiful how those two very different stats have a parallel in that scale, plus the way that can be whittled until bare at times, much like watching one’s team getting tired in the 4th quarter,defending the lead… this should give something additional for my nonexistent owners to fuss about. I wish there was someone who would fuss.

Making the equation and seeing the result it had on the scorecard was very rewarding, adding a boom-or-bust possibility to the pitcher’s slots on the roster. I like potential, and I like unexpected, crushing agony. Both remind me of how nice normal is.

 

 

Now I have a new scaling toy to play with, but another though I had is that pitchers aren’t the only ones with an ERA these days. Position players are now often used as a bullpen if a game is out of reach for example, and the manager wants to save his relief bullets. This could be hell for your average owner, when suddenly your 2B throws 17 pitches and has 4 ER with zero K, HR allowed and a 9.00 ERA!!