BookmarkSubscribeRSS Feed
Lostinstats
Calcite | Level 5

Hello everyone,

 

I am doing a Cox's model with delayed entry.

 

 

proc phreg data=food;
  class sexe_cl IPAQ1(ref="1") tabac_2classes;
model(age_inclus,age_fin)*censure(1)=ultraprocessed sexe_cl IMC taille nb_enq Alc kcal IPAQ1 diplome_3cl tabac_2classes atcd_K0
/ risklimits ties=efron;
run ;

age_inclus is the age at the inclusion of the participant.

age_fin is the age at the minimum between the date of censure or the date of death or the date of last follow-up.

ultraprocessed is my variable of interest.

The other variables are explicative.

 

I would like to draw the graph of Martingale or schoenfeld residuals to see if the variables follow the proportional hazards hypothesis and i don't know how to dot it. Do you have an idea please ?

Thanks in advance,

Best regards,

 

 

 

2 REPLIES 2
JacobSimonsen
Barite | Level 11

As I see it, it is not at present possible to make the assessment of the proportional hazard assumption with use of martingales in PROC PHREG when there is either lefttruncated timevalues or timedependent covariates in the model. It is also a big wish for me, so I hope it will come in a future release (Please, SAS Institute, we want that).

 

I worked some time ago with the same problem, and I was able to write both a cox-regression macro and a goodness-of-fit macro - see attachment. But it is difficult to use, and I have not made a very good documentation. It require that all covariates are specified as continous variables x_1-x_n, and they are lineary independent. (A class variable with three levels should be written as two variables). Also, it require a definition of some matrix functions which I also have attached. There is a libname statement where the path should be corrected to what ever drive you want to store these functions on. So, first declare the matrix-functions, then make your data with covariates x1-x_n, then estimate with the "%oldcox_regression" macro, then run the "%goodness_of_fit" macro" there is an example in the file, so you can try on that first.

 

I will recommend that you simplify your model, and put all covariates that is not of interest into the strata-statement, so there is less parameters to check for.

 

By the way, It is possible to make the assessment much faster (lineary time) than what phreg do (quadratic time).

Lostinstats
Calcite | Level 5
thank you for your detailed answer. I will try this, even if it seems to be difficult.

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