Hello, everyone
I managed to estimate the parameters for a Weibull accelerated failure time model from the PROC LIFEREG procedure. I have the point and interval estimations for predictor coefficients. In addition, I have the estimations for the Weibull shape parameter.
After I get these estimations, I would like to simulate the cumulative incidence curve/survival curve. I know I should use the point estimation of these coefficients and the shape parameter in the prediction model. But I am not sure whether to use the interval estimation of coefficients, or the shape parameter.
You answer is much appreciated!
Hi, Gris
Thank you very much for the suggestion. I see, and I think I should paste part of my code below.
After the PROC LIFEREG procedure, I got the estimation of parameters. Then, I used PROC DATA to simulate projections before I used these data to plot the CDF.
The shape parameter is rho, along with its confidence interval of rho_l and rho_u.
As you can see in the PROC DATA procedure, I did not use the confidence interval of model coefficients to simulate, instead, I only used that of the shape parameter. I don't know if this is the standard of art, or if I should have used the confidence interval of coefficients too.
data hazard; do t = 0 to 14 by 0.01; /* Adjust the range and increment as appropriate for your data */ lambda = exp( - 0.0105*65 + 0.49*1.75 + 0.04*45 + 0.29*0 + 0.70*0 + 0.29*1); /* Replace `intercept` with your actual intercept value */ rho = 2.3531; /* Shape parameter from PROC LIFEREG output */ rho_l = 2.0850; rho_u = 2.6557; h_t = rho/lambda * ((t/lambda)**(rho - 1)); /* Calculate hazard */ loght = log(rho/lambda * ((t/lambda)**(rho - 1))); lower_h_t = rho_u/lambda * ((t/lambda)**(rho_u - 1)); upper_h_t = rho_l/lambda * ((t/lambda)**(rho_l - 1)); suriv = 1 - exp(-(t/lambda) ** rho); suriv_u = 1 - exp(-(t/lambda) ** rho_u); suriv_l = 1 - exp(-(t/lambda) ** rho_l); output; end; *drop lambda rho rho_l rho_u; run; data hazard2; do t = 0 to 14 by 0.01; /* Adjust the range and increment as appropriate for your data */ lambda = exp( - 0.0105*65 + 0.49*1.75 + 0.04*45 + 0.29*0 + 0.70*0 + 0.29*0); /* Replace `intercept` with your actual intercept value */ rho = 2.3531; /* Shape parameter from PROC LIFEREG output */ rho_l = 2.0850; rho_u = 2.6557; h_t = rho/lambda * ((t/lambda)**(rho - 1)); /* Calculate hazard */ loght = log(rho/lambda * ((t/lambda)**(rho - 1))); lower_h_t = rho_u/lambda * ((t/lambda)**(rho_u - 1)); upper_h_t = rho_l/lambda * ((t/lambda)**(rho_l - 1)); suriv = 1 - exp(-(t/lambda) ** rho); suriv_u = 1 - exp(-(t/lambda) ** rho_u); suriv_l = 1 - exp(-(t/lambda) ** rho_l); output; end; *drop lambda rho rho_l rho_u; run;
What you CANNOT do:
What you CAN do:
I agree it's not optimal since every time you want to score another set of data ... you need to fit your model again.
See also this blog:
The missing value trick for scoring a regression model
By Rick Wicklin on The DO Loop February 17, 2014
https://blogs.sas.com/content/iml/2014/02/17/the-missing-value-trick-for-scoring-a-regression-model....
The below blog does not contain a solution to your question, but I want you to know about it anyway:
Interpret estimates for a Weibull regression model in SAS
By Rick Wicklin on The DO Loop October 27, 2021
https://blogs.sas.com/content/iml/2021/10/27/weibull-regression-model-sas.html
Koen
You can also use this formula to get predictions on new data (use a data step where t_value is your input-time-value to be scored):
predicted_target = 1/(1+exp(-((t_value - intercept) / scale_parameter)));
Please verify by scoring the training data and comparing with proc lifereg predictions.
I won't put my hand up to it, but I think that's the right formula.
Koen
Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9.
Early bird rate extended! Save $200 when you sign up by March 31.
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.