0

I'm trying to reverse engineer a Stata program into SAS, and I'm having trouble with the gammap function in Stata and what it correlates to in SAS. From Stata documentation, it appears that the gammap function returns the cumulative gamma distribution.

Test Data:

PSCORE  PALPHA  PBETA
0.032352097 21.4639 0.002864125
0.030794526 21.4639 0.002864125
0.032952468 21.4639 0.002864125
0.041141297 21.4639 0.002864125
0.033376449 21.4639 0.002864125
0.032352097 5.7865  0.005516187
0.030794526 5.7865  0.005516187
0.032952468 5.7865  0.005516187
0.041141297 5.7865  0.005516187
0.033376449 5.7865  0.005516187

So in the Stata program, I have:

RESULT = gammap(PALPHA,PSCORE/PBETA)

I translated this in SAS as part of the CDF function:

RESULT = CDF('GAMMA',PALPHA,PSCORE/PBETA);

However, the results are not matching up so my theory is wrong.

Stata:

0.0045025
0.0025791
0.0055082
0.0474779
0.0063245
0.5680494
0.5214182
0.5854155
0.7804033
0.5974566

SAS:

0.99394
0.99605
0.99291
0.95694
0.99209
0.54212
0.58959
0.52384
0.29454
0.51097

Could someone offer insight on what the correct correlating SAS code might be and where I'm going wrong in using the CDF function? Should I not use the CDF function?

4

1 回答 1

1

SAS CDF 函数采用 2 个参数用于 Gamma 分布。

data have;
input PSCORE  PALPHA  PBETA;

datalines;
0.032352097 21.4639 0.002864125
0.030794526 21.4639 0.002864125
0.032952468 21.4639 0.002864125
0.041141297 21.4639 0.002864125
0.033376449 21.4639 0.002864125
0.032352097 5.7865  0.005516187
0.030794526 5.7865  0.005516187
0.032952468 5.7865  0.005516187
0.041141297 5.7865  0.005516187
0.033376449 5.7865  0.005516187
;

data want;
set have;
result = cdf('gamma',pscore,palpha,pbeta);
run;

WANT 中的结果似乎与您的 STATA 结果一致。

于 2016-04-19T20:15:07.630 回答