Post Reply 
HP17bII+ Programming t-distribution
07-25-2015, 08:06 AM (This post was last modified: 07-25-2015 08:11 AM by Dieter.)
Post: #8
RE: HP17bII+ Programming t-distribution
(07-23-2015 09:52 PM)Don Shepherd Wrote:  Daisy, according to the formula given at Wikipedia, this should work,

No, it shouldn't. ;-)

(07-23-2015 09:52 PM)Don Shepherd Wrote:  but doesn't,

Of course it doesn't.

The problem is in the Gamma function. Yes, for integer (!) arguments Γ(x) can be replaced by the factorial of x–1. But Student's t-distribution always deals with half-integers, either in the nominator or in the denominator. You always have to evaluate something like Γ(2.5)/Γ(2) or Γ(7)/Γ(6.5). That's why you cannot simply remove the fractional part by using IP.

As far as I can see the 17BII does not offer a Gamma function (unlie many other HPs). But there is a way: Γ(x+0.5) can be calculated from Γ(x), and there even is a simple way to evaluate Γ(x+0.5)/Γ(x). Thomas' solution uses such an approach (that's the part with "2^(N-1)").

On calculators without Gamma function (e.g. the '41) I like the following method for evaluating the quotient g = Γ(n+0.5)/Γ(n):

Code:
Let [n] = IP(n)
Let  q  = (2[n]-1)! / 2^(2[n]-1) / ([n]-1)!^2 * sqrt(pi)

If n = [n]
   THEN g = q
   ELSE g = [n]/q

Please note that in our case (Student's distribution) n equals half the number of degrees of freedom, i.e. n = ν/2.

For very large n (that may cause overflow) another approach can be useful: a few terms of a simple power series will do.

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


Messages In This Thread
RE: HP17bII+ Programming t-distribution - Dieter - 07-25-2015 08:06 AM



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