P values for Normal Inverse Gaussian Distribution

I would like to calculate P values for data with a Normal Inverse Gaussian Distribution. I have looked at options for the normal distribution and this post has been useful... http://www.mathworks.com/matlabcentral/newsreader/view_thread/298645
My data's distribution was best fit to a normal inverse gaussian distribution by the allfitdist() function.
Thanks
Mel

Answers (2)

If I understand your question correctly, the core MATLAB function erfc can do what you want, with a slight modification:
P = @(z) erfc(-z/sqrt(2))/2;
This is absolutely not original — I copied the idea directly from the documentation. This is equivalent to the normcdf function in the Statistics Toolbox.

7 Comments

Hi Star Strider
I have just modified my question a bit after some reading. The normal inverse gaussian distribution is new to me. Can you generate z scores in the same way as you do for data in a normal distribution? Will have a look at the erfc function- thank you for the pointer.
Mel
If you want to generate z-scores from p-values, use this:
Z = @(P) -sqrt(2) * erfcinv(2*P/2);
You can also use it to test the various functions. I adapted it directly from the documentation as well. (There's a link to erfrcinv on the erfc page.)
What about generating z-scores from raw data, i.e. for a normal distribution z=(x-mu)/sigma. What is the equivalent for normal inverse gaussian distribution? Thank you
The purpose of the inverse Gaussian distribution is to generate z-scores (also known as ‘critical values’) from p values for the purpose of calculating confidence intervals for a given probability. So if you want to know which of your data lie outside the normal 95% confidence interval, and you have their z-scores, first calculate the z-score for a p-value of 0.025 (since your are excluding the middle 0.95 of the normal distribution, leaving to equal ‘tails’ of 0.025 on either end). That z-score is ±1.96. The z-scores from your data that are outside ±1.96 are therefore outside the 95% confidence limits, and then so are the data that generated them.
The inverse Gaussian distribution isn't used to calculate anything directly from data, at least in my experience, unless those data are themselves probabilities taken from the normal distribution.
This is a very short discussion of a very detailed topic. I refer you to a good textbook on test statistics for a full discussion.
Thank you for the explanation. I have gotten my wires crossed interpreting the output from the allfitdist() function. My data best fit an 'inverse gaussian' distribution, I interpreted this as a normal inverse gaussian distribution. I believe that the two things are actually different http://en.wikipedia.org/wiki/Inverse_Gaussian_distribution
Excuse the wikipedia reference but it provides a reasonably clear explanation of the two distributions. Perhaps I am still incorrect, are the distributions different?
If I am concerned with the 'inverse gaussian' distribution then the functions provided above should do what I want to do (identify which data values lie outside 99.7% of the data). I am was concerned though that my data wasn't normally distributed, hence exploration into the allfitdist() function and the 'normal inverse gaussian distribution'.
Thank you
"The normal inverse Gaussian distribution is a mixture of normal and inverse Gaussian distributions." Clearly they are different distributions
I admit that I never encountered any of those. They're not in any of my reference texts on random processes, mathematical biology, experiment design, or Kalman filters. When you mentioned z-scores and getting p-values from them, I thought you were referring to the standard normal distribution and its inverse.
I'm not quite sure what you're doing, but my only caution is to be sure that your data meet the assumptions of the distribution you choose. The fact that a distribution ‘fits’ does not imply that it is correct for your data or your application.

Sign in to comment.

If I understand correctly your question, I think that the function norm_prb.m in the Econometrics Toolbox by James P. LeSage does exactly what you want.

1 Comment

Thank you Gabriel. Looks like this also uses one of the erf family of functions.Seems like the way to go.

Sign in to comment.

Asked:

Mel
on 15 Aug 2012

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!