Group Abstract Group Abstract

Message Boards Message Boards

0
|
8.5K Views
|
9 Replies
|
0 Total Likes
View groups...
Share
Share this post:

How to get accurate results of InverseCDF function in Mathematica 9?

POSTED BY: Otto Linsuain
9 Replies

Hello Jim,

Thanks very much for providing the article. I wrote to Wolfram, and they replied back. They thanked me and said they will work on the issue (contrary to some comments I have read on the web that they ignore bug reports). Of course, they have not fixed it yet.

I will read the article in detail and will probably use it. I found another article (which I have in my work computer, but which I can send if you are interested). That article provided two good approximations which I could then use as a starting point in FindRoot to get fairly good results. We need these values at work and what is published in tables is not always enough or is too inconvenient.

I looked into the issue myself and it is fairly technical. Some features of this distributions are known exactly, for others only bounds are known, but those could be used as a first guess or bracketing step in a solution method. I am not surprised that someone devoted a fundamental article just to the handling of this problem. I am a bit surprised that Wolfram let it slip. They could have been rushing through that development. Hopefully they will flush it out; they got smart people there.

Thanks a lot,

OL.

POSTED BY: Otto Linsuain
Posted 11 years ago
Posted 11 years ago
POSTED BY: Jim Baldwin

Good, thanks. I will practice pasting code next time. I think this is a bug. I just sent it to Wolfram support and I attached that notebook (btw, I see that one could attach files here too). I noticed the underscores, but I thought I had fixed them by hand.

I am not sure this is pushing the function too far. It is odd, but sometimes I get better results for larger numbers (Mathematica seems to change its mind about the method to use, I recall seeing an example to this effect somewhere in the 'Help'). I have plotted the time it takes to make similar calculations (as a function of n, say) and it does very strange things, not random, but difficult to explain.

I am pretty sure Mathematica can do better. I often work with the regression model functions (LinearModelFit and NonlinearModelFit). These functions can provide tables with statistical summaries of the regression models (p-values for F- and t-statistics, etc.). It is quite challenging (but possible) to reproduce the results in those tables using the CDF and InverseCDF functions, but those Fit functions evaluate quickly and print the tables in a heartbeat. It seems clear that there are statistical packages with more efficient versions of the CDF functions somewhere in the code.

Anyway, thanks for your attention and feedback. Wolfram sent me an automated reply saying they will get back to me within 3 business days. I will update this post if they provide any useful work-around.

OL.

POSTED BY: Otto Linsuain

Thanks again. You are right that it takes less than a tenth of a second. It is also interesting that the message prints when calculating the CDF rather than the inverse (first time I see it that way).

You are also right that my original posting was long.

I still think that if I can improve this with a simple bisection code, then there should be room for further improvement.

Thanks,

OL.

POSTED BY: Otto Linsuain
POSTED BY: Otto Linsuain
Posted 11 years ago
POSTED BY: Jim Baldwin
Posted 11 years ago

To make a specific example, does the following capture the issue? (This is with Mathematica v. 10.1)

(* Set values *)
\[Nu] = 4200;
\[Alpha] = 0.95;

(* Get t-value *)
t = N[InverseCDF[NoncentralStudentTDistribution[\[Nu], 0], \[Alpha]], 50]

(* Plug value back into CDF function *)
N[CDF[NoncentralStudentTDistribution[\[Nu], 0], t], 50]

with output

1.64522

NIntegrate::ncvb: NIntegrate failed to converge to prescribed accuracy after 9 recursive bisections in
Statistics`NoncentralDistributionsDump`z$163348 near {Statistics`NoncentralDistributionsDump`z$163348} = {64.8939}.
NIntegrate obtained 1.746085001809244`15.954589770191005*^6694 and 6.297643634774244`15.954589770191005*^6690
for the integral and error estimates. >>

0.95
POSTED BY: Jim Baldwin
POSTED BY: Otto Linsuain
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard