Reputation: 397
If I have a cox proportional hazards model with as a predictor of event a categorical variable (and other covariates such as age etc), let's say for example the categorial variable I am interested in is tumor size which can be 0-10, 10-20, 20-30 for example, and I see there is a trend towards an higher HR of death with the increasing in tumor size, how can I compute in r and get a p?
Upvotes: 2
Views: 2569
Reputation: 263391
There is a bit of danger in accepting your incomplete specification since you could have a size classification that will mess this up, as for example: 0-10, 10-20, 20-30, 30-80, 80-120, 120-240. Unless you have carefully constructed your factor to have correctly ordered ascending levels, what I am about to suggest as a shortcut will fail.
survmdl <- coxph(Surv(tie,event) ~ as.numeric(fact), data=dat)
You will get a "test of trend" which would be interpreted as the per-category increase in the log(Hazard) for rising size and it would be a single coefficient. So post your actual factor levels if you wnat a better considered reply.
Upvotes: 2