1
votes

I have this survival data that describes the mortality rate of three types of services (saloon, restaurant and express)over a ten year time study.

The data contains three variables: service type (1=saloon, 2=restaurant, and 3=express), years (an integer from 1 to 11, where 11 means greater than 10 years) and censor.

I have two questions:

1) I have fitted the Cox proportional hazard model, but what are the ways to check the proportional hazard assumption. That is we assume the hazard ratio of each individual and the baseline hazard is independent of time.

2) How to fit a time dependent Cox model in R?

Here are my code:

   #Cox Proportional Hazards
   cox <- coxph(Surv(Years, Censor) ~ data$`Service Type` )
   summary(cox)
1
This is both off-topic and too broad. It's not a programming question, it's a statistics question (which would make it better suited to stats.stackexchange). It also seems pretty broad. I'd recommend reading through John Fox's Appendix on Survival Analysis. It covers these topics and more, with plenty of example R code.Gregor Thomas
Baseline hazards are not assumed to be independent of time and the data do not support a time-dependent model. I'll answer the question about how to check proportionality in the predictors, since it's a one liner.IRTFM
Time-dependent analyses require a start and end time for the predictors which are time dependent. This data does not support such an analysis.IRTFM
You should make your question self-contained. Sooner or later you're going to break the link to your data and this question will be less useful to future visitors.Frank

1 Answers

0
votes

The cox.zph function in pkg survival checks for proportionality. Do note that using 'Service Type" as a column name provides programming hassles that one can be easily avoid by allowing periods to be substituted for spaces as is the default action with read.table:

data <- read.table(url("http://www.stat.ufl.edu/~winner/data/bizmort.dat"), col.names=c("Service Type","Years",  "Censor")
# Also note that the censoring indicatior is reversed so will use 1-Censor
require(survival)

cox <- coxph(Surv(Years, 1-Censor) ~ factor(Service.Type), data=data )
# The test fro proportionality:

> cox.zph(cox)
                         rho chisq     p
factor(Service.Type)2 0.0306  0.98 0.322
factor(Service.Type)3 0.0429  1.91 0.167
GLOBAL                    NA  2.33 0.312