P values for Normal Inverse Gaussian Distribution
Show older comments
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.
Can I use the nigcdf() function http://www.mathworks.com/matlabcentral/fileexchange/10934-normal-inverse-gaussian-nig-distribution-updated-version/content/nigcdf.m to calculate the P values?
Thanks
Mel
Answers (2)
Star Strider
on 15 Aug 2012
Edited: Star Strider
on 15 Aug 2012
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
Mel
on 15 Aug 2012
Star Strider
on 15 Aug 2012
Edited: Star Strider
on 15 Aug 2012
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.)
Mel
on 15 Aug 2012
Star Strider
on 15 Aug 2012
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.
Mel
on 15 Aug 2012
Mel
on 15 Aug 2012
Star Strider
on 15 Aug 2012
Edited: Star Strider
on 15 Aug 2012
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.
Gabriel Bruneau
on 15 Aug 2012
0 votes
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.
Categories
Find more on Inverse Gaussian Distribution in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!