Quote:
Originally Posted by Alan Anderson
That formula is only relevant for district events. It converts ranking to "District Qualification Points". A comprehensive explanation of the Inverse Error Function belongs in an advanced statistics class. All you need to know is that it is built in to tools like Matlab.
|
I was curious about the function, did a little digging found someone already made one for Excel VBA. I hope this helps.
http://www.mrexcel.com/forum/excel-q...ml#post1146833
Code:
Function invERF(y As Double) As Double
Dim pi As Double, x As Double, d As Double
pi = 3.14159265358979
If y < 0 Then
invERF = 0 'interval includes the mean only
Exit Function
ElseIf y >= 1 Then
invERF = 10 'makes the interval include everything
Exit Function
'for my purposes, I only want the function to process input from 0 to 1
ElseIf y < 0.596 Then
x = sqr(pi) / 2 * y * (1 + (pi / 12) * y * y)
Else
x = sqr(-Log((1 - y) * sqr(pi)))
End If
d = (y - ERF(x)) / (2 * Exp(-x * x) / sqr(pi))
x = x + d
Do While Abs(d) >= 0.00000001
d = (y - ERF(x)) / (2 * Exp(-x * x) / sqr(pi))
x = x + d
Loop
invERF = x
End Function
Function ERF(x As Double) As Double
Dim f As Double, c As Double, pi As Double
Dim j As Integer
c = 0
pi = 3.14159265358979
If 1.5 < x Then
c = 2 - c
j = 3 + Int(32 / x)
f = 0
Do While j <> 0
f = 1 / (f * j + x * sqr(2))
j = j - 1
Loop
f = f * c * (3 - c * c) * Exp(-x * x) / sqr(2 * pi) + (c - 1) * (3 * c * c + c - 8) / 6
Else
j = 3 + Int(9 * x)
f = 1
Do While j <> 0
f = 1 + f * x * x * (0.5 - j) / j / (0.5 + j)
j = j - 1
Loop
f = c + f * x * (2 - 4 * c) / sqr(pi)
End If
ERF = f
End Function