Post Reply 
F distribution on the 41C
12-25-2015, 02:54 PM (This post was last modified: 12-25-2015 03:00 PM by Dieter.)
Post: #39
RE: F distribution on the 41C
(12-21-2015 07:24 PM)Dieter Wrote:  This is what I currently use in Excel for calculating the upper F integral.

Addendum: here is a slightly more compact version of the regularized Beta function. While in the previous implementation one loop calculates both the odd and even terms of the continued fraction, here is a version that computes them separately:

Code:
Function ibeta(ByVal x, ByVal a, ByVal b)

tiny = 1E-300
c = 1
d = 1 - (a + b) * x / (a + 1)
If (Abs(d) < tiny) Then d = tiny
d = 1 / d
h = d
k = 2

Do
   m = k \ 2
   r = x / ((a + k - 1) * (a + k))
   If k Mod 2 = 0 Then
      aa = m * (b - m) * r
   Else
      aa = -(a + m) * (a + b + m) * r
   End If
   c = aa / c + 1
   If (Abs(c) < tiny) Then c = tiny
   d = aa * d + 1
   If (Abs(d) < tiny) Then d = tiny
   d = 1 / d
   adj = c * d
   h = h * adj
   k = k + 1
Loop Until (adj = 1) Or (m > 200)

If m > 200 Then
   ibeta = -1
Else
   ibeta = h * x ^ a * (1 - x) ^ b / a / betaf(a, b)
End If

End Function

In this particular case I think the underflow tests (if abs(x)<tiny then x=tiny) follow an addition of 1, so maybe they can be replaced with "if x=0 then...". Maybe the floating point experts can comment on this.

Dieter
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
F distribution on the 41C - quantalume - 12-16-2015, 05:02 PM
RE: F distribution on the 41C - Dieter - 12-16-2015, 06:05 PM
RE: F distribution on the 41C - quantalume - 12-16-2015, 07:55 PM
RE: F distribution on the 41C - Dieter - 12-16-2015, 08:22 PM
RE: F distribution on the 41C - quantalume - 12-16-2015, 09:03 PM
RE: F distribution on the 41C - Dieter - 12-16-2015, 09:08 PM
RE: F distribution on the 41C - Namir - 12-17-2015, 12:52 AM
RE: F distribution on the 41C - quantalume - 12-17-2015, 03:31 PM
RE: F distribution on the 41C - Dieter - 12-18-2015, 10:25 PM
RE: F distribution on the 41C - Namir - 12-19-2015, 02:37 PM
RE: F distribution on the 41C - Dieter - 12-20-2015, 05:02 PM
RE: F distribution on the 41C - Namir - 12-20-2015, 11:15 PM
RE: F distribution on the 41C - Dieter - 12-21-2015, 07:24 PM
RE: F distribution on the 41C - Namir - 12-21-2015, 09:52 PM
RE: F distribution on the 41C - Dieter - 12-25-2015 02:54 PM
RE: F distribution on the 41C - quantalume - 12-17-2015, 03:36 PM
RE: F distribution on the 41C - Dieter - 12-17-2015, 07:37 PM
RE: F distribution on the 41C - Dieter - 12-17-2015, 09:32 PM
RE: F distribution on the 41C - quantalume - 12-17-2015, 10:35 PM
RE: F distribution on the 41C - Dieter - 12-17-2015, 10:53 PM
RE: F distribution on the 41C - quantalume - 12-17-2015, 11:05 PM
RE: F distribution on the 41C - Dieter - 12-18-2015, 08:38 PM
RE: F distribution on the 41C - quantalume - 12-18-2015, 11:26 PM
RE: F distribution on the 41C - rprosperi - 12-19-2015, 01:39 AM
RE: F distribution on the 41C - Dieter - 12-19-2015, 09:00 AM
RE: F distribution on the 41C - Dieter - 12-19-2015, 09:18 AM
RE: F distribution on the 41C - quantalume - 12-19-2015, 06:22 PM
RE: F distribution on the 41C - Dieter - 12-19-2015, 09:16 PM
RE: F distribution on the 41C - quantalume - 12-20-2015, 12:28 AM
RE: F distribution on the 41C - Dieter - 12-20-2015, 01:17 PM
RE: F distribution on the 41C - Gene - 12-26-2015, 03:38 PM
RE: F distribution on the 41C - Dieter - 12-26-2015, 04:56 PM
RE: F distribution on the 41C - Gene - 12-26-2015, 06:04 PM
RE: F distribution on the 41C - Namir - 12-22-2015, 05:54 AM
RE: F distribution on the 41C - Dieter - 12-22-2015, 07:00 AM
RE: F distribution on the 41C - Paul Dale - 12-22-2015, 07:30 AM
RE: F distribution on the 41C - Dieter - 12-22-2015, 07:50 PM
RE: F distribution on the 41C - Paul Dale - 12-22-2015, 09:34 PM
RE: F distribution on the 41C - Dieter - 12-26-2015, 10:09 PM
RE: F distribution on the 41C - Namir - 12-26-2015, 03:03 PM
RE: F distribution on the 41C - Dieter - 12-26-2015, 05:19 PM
RE: F distribution on the 41C - Gene - 12-30-2015, 05:54 PM



User(s) browsing this thread: 12 Guest(s)