To calculate the Gamma Inverse. I am using the phpExcel library :
https://github.com/PHPOffice/PHPExcel/blob/develop/Classes/PHPExcel/Calculation/Statistical.php
I use this library and compare it to the result from Excel. For both in Php and Excel I have tested with the same values but got different results:
Php: GAMMAINV(0.999 , 21.054, 1/0.266) Result : 395.75187969925
In Excel : =GAMMA.INV(0.999 , 21.054, 1/0.266) Result : 143.076
Tests with the BETA.INV and BETAINV worked perfectly. So I don't understand what is going wrong here. Could someone explain and or point out a correct library?
In R I get: qgamma(0.999, 21.054, 1/0.266) = 10.13834 Very different from the Excel result: GAMMA.INV(0.999, 21.054, 1/0.266)= 143.2859273
Trusting R, I think Excel computes incorrectly, but not always; For example: Excel: GAMMA.INV(0.025,10,1) = 4.795388696 R: qgamma(.025,10,1) = 4.795389
It looks therefore to me that both Excel and phpExcel give unreliable quantiles for the gamma function!