[WP34s] A set of new quantile functions
|
06-02-2014, 08:32 PM
Post: #12
|
|||
|
|||
RE: [WP34s] A set of new quantile functions
It's me again. Here is the third reply to my own post. #-)
(06-01-2014 01:18 PM)Dieter Wrote:(05-30-2014 06:13 AM)Dieter Wrote: Recent tests showed that a similar behaviour may also occur with the Student quantile function. Final update: there is another solution. The original (shorter) TQF version can be used with a slight modification. The program uses two different estimates. One for the central region and another for p close to 0 or 1. At least one of these seems to be good enough to ensure reasonably fast convergence. But in some cases, especially for very high dof values, choosing the one or the other is quite tricky since there is just a narrow corridor of probabilities where both approximations work equally well. So the crucial point is the decision whether to use the central or the tail estimate. Up to now this was done by checking whether the input is greater or less than 12–n. This mostly works well, but it is not sufficiently exact for a few critical cases. After some tests I can suggest a different threshold that seems to work fine: simply replace the constant 12 with the term sqrt(n) + 7,5. So these lines near the beginning of TQF... Code: ... ...are replaced with these: Code: ... And that's it. So there are essentially two ways of solving the problem of slow convergence in some extreme cases: 1. The safe method: use a robust algorithm. This is the approach of the second version I posted, i.e. solving ln(cdf/p) = 0. However, this requires more code and memory. 2. Since the initial estimates are good enough, the threshold for switching between the two may be fine-tuned. With the suggested fix the original shorter version of TQF should work fine. I could not find a case where more than four iterations were required. Dieter |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 1 Guest(s)