Tips:Simulate generalized gamma distributed data for PROC LIFEREG

From sasCommunity
Jump to: navigation, search

The generalized gamma distribution can be used to model gamma distributed survival times in PROC LIFEREG as well as Weibull [where Shape=1], exponential [Shape=1, Scale=1] and lognormal [Shape=0] survival times.

To simulate a data set that will generate results in PROC LIFEREG with specific values for the shape, scale, intercept and other parameters, the following code can be used:

    a=1/(Shape**2);
    c=Scale/Shape;
    b=exp(xb)/(a**c);
    r=rangam(0,a);
    X=b*(r**c);

where X is the generated survival time and xb can be the intercept, for intercept-only models, or a linear combination of covariates, such as:

   xb = intercept + beta1*x1 + beta2*x2;

where x1 and x2 are covariates and beta1 and beta2 are the corresponding parameter estimates.