- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Hello .
In order to perform a Cox model, I am supposed to test the proportional hazard hypothesis.
On this site https://stats.idre.ucla.edu/other/examples/asa2/testing-the-proportional-hazard-assumption-in-cox-mo...
I find this suggestion of code :
proc phreg data=uis;
model time*censor(0) = age race treat site aget racet treatt sitet;
aget = age*log(time);
racet = race*log(time);
treatt = treat*log(time);
sitet = site*log(time);
proportionality_test: test aget, racet, treat, sitet;
run;
However, if I apply the code with my current variables (where “race” is categorical) I get the error :
Variable race should be either numeric or specified in the CLASS statement
If I add a line for « class age race treat site ; » I get :
Unable to convert a character value to a numeric value
Finally the only way to have this program woking is to convert my variable into numeric (white = 1 black = 2 for instance). But is it that I am supposed to do ? I have some doubts here.
I have a second question: When I perform the test, I get a (unique) p-value. If I understand correctly it is when the test is concluant (p-value low) that the hypothesis of proportional hazard is not verified right?
Thank you very much to who will be able to help me.
Best regards.
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
I think the reason you need to have race as numeric is you are using it in an interaction. Also, your treatment of the null hypothesis of the PH assumption via the test statement is correct.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
I think the reason you need to have race as numeric is you are using it in an interaction. Also, your treatment of the null hypothesis of the PH assumption via the test statement is correct.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
So racet = race*log(time) ; is an interaction not a multiplication even if race is numeric, I am reassured, the test make sens now.
It was counterintuitive for me because in other proc we can create interaction between categorical and numeric variable.
Thanks for your answers.