[WP34s] A set of new quantile functions
|
05-29-2014, 12:43 PM
(This post was last modified: 05-29-2014 02:12 PM by Dieter.)
Post: #9
|
|||
|
|||
RE: [WP34s] A set of new quantile functions
(05-26-2014 10:45 AM)Paul Dale Wrote: The distribution changes aren't going to happen immediately. That's fine since another update may be required as well. I did some further tests with the recently suggested Student quantile function and found that close to zero the CDF of the calculated quantile often significantly differed from the original probability. Some tests with 42-digit precision showed that the quantile was fine (33 or 34 correct digits), while there are some issues with the WP34s t(x) function. Near t=0 the Student CDF should be roughly 0,5 + r·t where r is a factor between 1/pi and 1/sqrt(2·pi), i.e. somewhere between 0,3 and 0,4. So the double precision results for the Student CDF should look like this: Code: t CDF(t) But actually there is a much larger t below which a plain 0,5 is returned: Code: t WP34s t(x) function for 10 dof For further investigations I used a little program that provides a 34-digit t-value of the same magnitude as entered (pi/3 * input): Code: LBL A Since the true result is approx. 0,5 the returned error can be read as "units in the xth digit". So for t near 5 E–17 the error is 2 units in the 17th digit. In other words, accuracy degrades down to single precision level. I assume this happens due to digit cancellation when the argument x = n/(t²+n) for the incomplete Beta function is evaluated, since for very small t this rounds to 1. That's why I suggest that for small t the Student CDF should be evaluated using 1–x = t²/(t²+n), as shown in the routine above. BTW the recently posted Student quantile function is not affected by all this as it already uses the suggested method for |t| < 0,5. EDIT: I looked at the current Student CDF code in t.wp34s, and indeed it works as assumed. Here is a fix that uses a different method for small t less than 1: Code: ... Dieter |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 1 Guest(s)