Date: Feb 1, 2013 2:40 AM Author: Jennifer Murphy Subject: Help with discount function I'm stuck. I've reached the limit of my meager math skills. I could use

some help.

I am planning a little football pool for a Super Bowl party. Each person

will submit predictions for the score at the end of each quarter. I will

construct a spreadsheet to calculate the winner.

My plan is to award 10 points for each correct prediction and something

less for incorrect predictions according to how close they are. For

example, if the actual score is 14, a guess of 14 would get 10 points,

13 or 15 might get 9 points, 12 or 16 might get 8, and so on.

In this table, the points are discounted from a maximum of 10 by one

point for each point of error (linear discount).

Guess Points Actual Score = 14

11 7

12 8

13 9

14 10

15 9

16 8

17 7

I didn't like this method for a couple of reasons. (1) I don't want

negative points, so all guesses that are off by more that 10 points get

zero. (2) There is a one point penalty for missing by one point a score

of 3 (33% error) and one of 50 (2%) error.

An exponential decay function looked like a good choice. I chose to use

it in the half-life form:

pts = MP * 2^(-error/h)

Where:

pts = The points to be awarded

MP = The maximum points (10)

error = The error in the guess (abs(score-prediction))

h = The half life parameter.

When:

MP = 10

Actual Score = 0

h = 10.00

The results are:

Prediction Error Points

0 0 10.00

1 1 9.33

2 2 8.71

3 3 8.12

4 4 7.58

5 5 7.07

When:

MP = 10

Actual Score = 21

h = 10

The results are:

Prediction Error Points

17 4 7.58

18 3 8.12

19 2 8.71

20 1 9.33

21 0 10.00

22 1 9.33

23 2 8.71

24 3 8.12

25 4 7.58

This solves the problem of the points going to zero and below, but it

still has the problem of a one point error on a small score being the

same as a one point error on a large score.

One solution to that problem is to relate the half life parameter to the

actual score. My first test was to let

h = score

If the score is 10, h is 10. If the score is 50, h is 50.

When the score is 21, h is also 21:

MP = 10

Actual Score = 21

h = 21

The results are:

Prediction Error %Error Points %Points

16 5 23.81% 8.48 15.21%

17 4 19.05% 8.76 12.37%

18 3 14.29% 9.06 9.43%

19 2 9.52% 9.36 6.39%

20 1 4.76% 9.68 3.25%

21 0 0.00% 10.00 0.00%

22 1 4.76% 9.68 3.25%

23 2 9.52% 9.36 6.39%

24 3 14.29% 9.06 9.43%

25 4 19.05% 8.76 12.37%

26 5 23.81% 8.48 15.21%

Now the percent loss of points is roughly equal to the percent loss in

the prediction.

And when:

MP = 10

Actual Score = 3

h = 3

The results are:

Prediction Error %Error Points %Points

0 3 100.00% 5.00 50.00%

1 2 66.67% 6.30 37.00%

2 1 33.33% 7.94 20.63%

3 0 0.00% 10.00 0.00%

4 1 33.33% 7.94 20.63%

5 2 66.67% 6.30 37.00%

6 3 100.00% 5.00 50.00%

7 4 133.33% 3.97 60.31%

8 5 166.67% 3.15 68.50%

A 1-point error when the score is 21 gets a 0.32 point penalty, whereas

for a score of 3, it gets 2.06 point penalty. I don't know if this

mathematically sound, but it feels about right. A 1-point error for a

score of 21 is 4.76%. A 0.32 point loss from 10 points is 3.25%, which

is comparable. The two percentages are slightly less comparable when the

score is "3".

The problem arises when the score is zero. This results in a division by

zero error (-error/h).

I am not sure how to solve this one. I would appreciate some help.

One idea I had is to add something to the halflife calculation.

h = ActualScore + n

I have no idea how to calculate "n".

Another idea I had was to discount the points in the same proportion as

the predictions.

pts = (abs(prediction-actualscore)/actualscore) * maxpoints

This has the same divide by zero problem when the score = 0.

Summary: I need a way to assign points to football scoree predictions

that reward accuracy in some consistent manner.