BookmarkSubscribeRSS Feed
openatom
Calcite | Level 5

I am trying to do a simple simulation where I create several different replication datasets (replicating a known dataset I have).   I'm using SAS 9.4 and here is the code I'm trying to use for simulation (found on: http://sas-and-r.blogspot.com/2010/03/example-730-simulate-censored-survival.html😞

 

data simcox;
beta1 = 2;
lambdat = 0.002; *baseline hazard;
lambdac = 0.004; *censoring hazard;
do i = 1 to 1000;
x1 = rand("Bernoulli",0.5);
linpred = exp(-beta1*x1);
t = rand("WEIBULL", 1, lambdaT * linpred);
* time of event;
c = rand("WEIBULL", 1, lambdaC);
* time of censoring;
time = min(t, c); * which came first?;
censored = (c lt t);
output;
end;
run;

 

I am having trouble figuring out the values to use (bold in red).  How do I know what to specify beta and lambdas as? Is there a way to find estimates of these values by running a Cox model on my known data, then using these estimated values of beta and lambdas for my simulation? If so, please explain in detail how to find these.

 

Thank you.

 

 

3 REPLIES 3
Rick_SAS
SAS Super FREQ

I'm away from my reference materials (in my office), but I believe the answer is that you can run PROC LIFEREG and use the DIST=WEIBULL option to get these values. One of them (possibly lambdat) is estimated by exp(Intercept) and the other (lambdac?) by 1/shape (look for "Weibull Shape" in the output. If 1/shape doesn't work, try just shape.... it depends on how you parameterize the Weibull survival model.

 

HTH

openatom
Calcite | Level 5

Thank you, this is helpful.  I noticed that LIFEREG will also output something it calls "shape" and "scale," but they appear to be inverses and not directly related to the Weibull PDF in SAS (https://documentation.sas.com/?cdcId=pgmsascdc&cdcVersion=9.4_3.5&docsetId=fedsqlref&docsetTarget=p1...) where a=shape and lambda=scale.

 

In LIFEREG, I assume that the "scale" is lambda? 

 

(shape) a = exp(Intercept) ?

(scale) lambda = lambdac ?

 

Does this seem correct?

Rick_SAS
SAS Super FREQ

Yes. I thought it was lambdac = 1/lambda, but I could be wrong. As I said, it depends on the parameterization of the distribution. Some use scale and others use rate (=1/scale).

 

Since your goal is a simulation, it should be easy to check. In your simulation, set the scale parameter in your simulation to 4 and generate a large data set (like, 5,000 observations). LIFEREG will either report scale=4 or scale=0.25. If it reports 4, then the formulas in your simulation match those in the PROC. If it reports 0.25, then in your simulation you need to replace the scale parameter by (1/scale) in order to match the parameterization in the PROC. Then rerun to make sure.

sas-innovate-white.png

Missed SAS Innovate in Orlando?

Catch the best of SAS Innovate 2025 — anytime, anywhere. Stream powerful keynotes, real-world demos, and game-changing insights from the world’s leading data and AI minds.

 

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
  • 3 replies
  • 1022 views
  • 0 likes
  • 2 in conversation