BookmarkSubscribeRSS Feed
Maya1
Fluorite | Level 6

Good afternoon,

 

I need to calculate the incomplete gamma function for a sample size calculation regarding advanced survival analysis with correlated frailties. Do you have any hint, how I can calculate the incomplete gamma function in SAS?

 

Thanks in advance!

2 REPLIES 2
Rick_SAS
SAS Super FREQ

Applied mathematicians and physicists call the function an "incomplete gamma function," but a statistician calls it the CDF of the gamma distribution.  For the definition, see the doc for the CDF function. (For an explanation of the ideas, see this article on the incomplete beta function.)

 

If you are asking for a plot of the empirical distribution of the data overlaid with a gamma CDF, you can use PROC UNIVARIATE:

proc univariate data=have;

var  x;

cdfplot x / gamma;

run;

 

If you have censored observations or some other constraint, please provide an example of your data.

JacobSimonsen
Barite | Level 11

You can just use the product: cdf('gamma',x,alpha)*gamma(alpha),

where alpha is the shape parameter and x is the value you want to evaluate the incomplete gammafunction in.

 

That product gives the same value as the integral that define the incomplete gammafunction:

 

data _null_;
  alpha=2;

  delta=2**(-20);
  integral=0;
  do t=delta to 3 by delta;
    integral+t**(alpha-1)*exp(-t)*delta;
  end;

  y=cdf('gamma',3,alpha)*gamma(alpha);
  put y=  / integral=;
ruN;

 

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!

What is ANOVA?

ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 2 replies
  • 2241 views
  • 2 likes
  • 3 in conversation