BookmarkSubscribeRSS Feed
DavidsM
Calcite | Level 5

Hello community,

 

I really request for assistance. I want to calculate the Nam-D'Agostino Test which is an extension of Hosmer Lemeshow test adapted to survival data.   

 

Attached to this message is the formula I am supposed to use to calculate this statistic but I dont know how to write the code and I have not come across any code on internet for almost 3 month of searching.  Community , I request for your assistance.

 

Thank you in advance. 

 

 

 

4 REPLIES 4
Rick_SAS
SAS Super FREQ

See the article "Decile Calibration plots in SAS" for an example of logistic regression. You can use the same ideas to modify the code for survival analysis. I haven't done it myself, but if you know how to use the SAS survival analysis procedures, perhaps that article will help. As you read the article, however, please pay attention to the section that discusses why the Hosmer-Lemeshow test is not recommended by most experts.

DavidsM
Calcite | Level 5

Thank you Mr. Rick for the article about calibration plots. I have followed it and was able to get the concept for obtaining calibration plot using the Phreg procedure.   However, I would be glad if am also assisted to find  a way to calculating the associated Chi Square and P values using this formula modified by Nam-D'Agostino. 

 

There are other people who have tried to search for the same calculating on this forum but they had no replies about this calculation, so i failed to get any ideas about how the coding should be done. 

 

 

I will be glad to receive more additional assistance from you and other community advisors.

Rick_SAS
SAS Super FREQ

If you want help, please post example data and the code that you are using to run the PHREG procedure. Also specify how the PHREG output relates to the various terms in the formula. There are thousands of tests and formulas in statistics. The experts on this forum are experienced with SAS, but may not be familiar with a particular formula such as you the Nam-D'Agostino Test. You have to help us understand what you have and what you want.

DavidsM
Calcite | Level 5

 Hello Rick, 

 

This is what I have tried out so far. 

 

 

/* USING PHREG PROCEDURE TO SAVE PREDICTED PROBABILITIES FROM THE COX MODEL */
Proc phreg data=Stone1.Development;
class SEX(ref='2') AGE (ref='1') SMOKING(ref='1') DRINKING(ref='1') CHOLESTEROL(ref='1') TRIGLYCERIDES(ref='1') OBESITY(ref='1') GLUCOSE(ref='1') SBP(ref='1');
model Years * Censor (0)=Sex AGE SMOKING DRINKING CHOLESTEROL TRIGLYCERIDES OBESITY GLUCOSE SBP/ rl;
output out=OutData Survival=PredProb; /* Saving predicted probabilities in data set */
run;


/* IDENTIFICATION OF DECILES OF PREDICTED PROBABILITIES*/
Proc rank data=OutData out=Decile groups=10;
var PredProb;
ranks Decile;
run;

/* COMPUTATION OF THE MEAN PREDICTED PROBABILITIES AND THEIR CONFIDENCE INTERVALS*/
proc means data=Decile noprint;
class Decile;
types Decile;
var PredProb;
output out=MeanDecileOut mean= PredProbMean
lclm=PredProbLower uclm=PredProbUpper;
run;

 

 

*/Desription of Variables in my data desription*/

*/Years=Varibale for time ot event or follow up time for each indivividual in the cohort*/

*/Censor=Censoring variable with censor(0) representing censored participant and Censor(1) representing participants who expereinced the outcome of interest*/

*/PredProb is the variable containing individual Survival probabilties that I obtained from the a multivariable Cox proportional Hazards model as seen above/*


*/Desription of Variables in Nam-D'Agostino Test formula*/


Below is the formula to calculate the statistics for each decile.

[KMg(t)- p(t)g]Squared *ng /p(t)g(1-p(t)g)

Then summation for all deciles to get the overal statistcis for the model.

 

Where

*/KMg(t) represents the failure probability in g-th decile at time t*/


*/ p(t)g is the mean predicted probability of failure for subjects in g-th decile using any survival modelling technique [ I am using Cox model]/*


*/ng is number of observations in a group g/*

 

 

 

Thank you RICK for your continued assistance. Will be glad to receive your assistance again. 

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
  • 4 replies
  • 3494 views
  • 1 like
  • 2 in conversation