I read your blog and found that given there was an extra Γ(p) term to divide after I compute the incomplete gamma function, the whole thing I had been calculating was nothing but the cumulative distribution function (CDF) of Γ(up,p). I tried the numerical integration method by the QUAD routine first and found out that for small values of p, the QUAD routine failed potentially as a result of lack of specification of the SCALE= option. I therefore read your blog and found out the conclusion I gave at the beginning of this thread.
Still, I encountered a problem when I was actually computing the CDF's. I directly applied the CDF function element-wise and found an error. The code looked like this:
proc iml;
Gamma=j(nrow(p),1,1);
up = {3, 4, 5};
p = {1.1, 2.2, 0.8};
do i=1 to nrow(p);
Gamma[i]=cdf('gamma',up[i],p[i]);
end;
print p up Gamma;
quit;
The code failed. The log read:
ERROR: (execution) Invalid argument to function.
operation : CDF at line 358 column 9
operands : *LIT1008, _TEM1001, _TEM1002
*LIT1008 1 row 1 col (character, size 5)
gamma
_TEM1001 1 row 1 col (numeric)
-2.326E19
_TEM1002 1 row 1 col (numeric)
-4.868E17
statement : ASSIGN at line 358 column 1
Why is it the case?
... View more