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-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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
  • 2012 views
  • 2 likes
  • 3 in conversation