Notice removed Draw attention by Max Gordon
Bounty Ended with DWin's answer chosen by Max Gordon
Notice added Draw attention by Max Gordon
Bounty Started worth 50 reputation by Max Gordon
5 Added the possibilities of getting it done with Fractional Polynomial Time model and cmprsk crr function. I've also tried out the coxvc package

Update: Rewritten large parts of the question sinceSorry for another update but I've found some possible solutions but I'm not completely comfortable with the outputfractional polynomials and the competing risk-package that I still don't know how to do a nice graphneed some help with.

## The problem

### 2) Reduced Rank models - The coxvc package

The coxvc package provides an elegant way of dealing with the problem - here's a manual. The problem is that the author is no longer developing the package hasn't been updated(last version is since 05/23/2007 and the), after some e-mail conversation I've gotten the package to work but one run took 5 hours on my dataset (140 000 entries) and gives extreme estimates at the end of the author bouncesperiod. You can find a slightly updated package here - I've mostly just updated the plot function.

It might be just a question of tweaking but since the software doesn't easily provide confidence intervals and the process is so time consuming I'm looking right now at other solutions.

The impressive timereg package also addresses the problem but I'm not certain of how to use it and it doesn't give me a smooth plot.

### 4) Fractional Polynomial Time (FPT) model

I found Anika Buchholz' excellent dissertation on "Assessment of time–varying long–term effects of therapies and prognostic factors" that does an excellent job covering different models. She concludes that Sauerbrei et al's proposed FPT seems to be the most appropriate for time-dependent coefficients:

FPT is very good at detecting time-varying effects, while the Reduced Rank approach results in far too complex models, as it does not include selection of time-varying effects.

The research seems very complete but it's slightly out of reach for me. I'm also a little wondering since she happens to work with Sauerbrei. It seems sound though and I guess the analysis could be done with the mfp package but I'm not sure how.

### 5) The cmprsk package

I've been thinking of doing my competing risk analysis but the calculations have been to time-consuming so I switched to the regular cox regression. The crr has thoug an option for time dependent covariates:

....
cov2        matrix of covariates that will be multiplied
by functions of time; if used, often these
covariates would also appear in cov1 to give
a prop hazards effect plus a time interaction
....


There is the quadratic example but I'm don't quite follow where the time actually appears and I'm not sure of how to display it. I've also looked at the test.R file but the example there is basically the same...

Here's an example that I use to test the different possibilities

library("survival")
library("timereg")
data(sTRACE)

# Basic cox regression
surv <- with(sTRACE, Surv(time/365,status==9))
fit1 <- coxph(surv~age+sex+diabetes+chf+vf, data=sTRACE)
check <- cox.zph(fit1)
print(check)
plot(check, resid=F)
# vf seems to be the most time varying

######################################
# Do the analysis with the code from #
# the example that I've found        #
######################################

# Split the dataset according to the splitSurv() from prof. Wesley O. Johnson
# http://anson.ucdavis.edu/~johnson/st222/lab8/splitSurv.ssc
new_split_dataset = splitSuv(sTRACE$$time/365, sTRACE$$status==9, sTRACE[, grep("(age|sex|diabetes|chf|vf)", names(sTRACE))])

surv2 <- with(new_split_dataset, Surv(start, stop, event))
fit2 <- coxph(surv2~age+sex+diabetes+chf+I(pspline(stop)*vf), data=new_split_dataset)
print(fit2)

######################################
# Do the analysis by just straifying #
######################################
fit3 <- coxph(surv~age+sex+diabetes+chf+strata(vf), data=sTRACE)
print(fit3)

# High computational cost!
# The price for 259 events
sum((sTRACE$status==9)*1) # ~240 times larger dataset! NROW(new_split_dataset)/NROW(sTRACE) ############################################################################## # Do the analysis with the coxvc and # # the timecox from the timereg library # ############################################################################## fit4<Ft_1 <-timecox cbind(surv~constrep(age)+const1,nrow(sexsTRACE)+const(diabetes)+const,bs(chf)+vfsTRACE$time/365,df=3))
fit_coxvc1 <- coxvc(surv~vf+sex, Ft_1, rank=2, data=sTRACE)

summary(fit4)
# I interpret the summaryfit_coxvc2 as<- vfcoxvc(surv~vf+sex, timeFt_1, dependentrank=1, whendata=sTRACE)
# checkning with the null
Ft_3 hypothesis<- constcbind(agerep(1,nrow(sTRACE) and const),bs(vfsTRACE$time/365,df=5)) # I'm uncertainfit_coxvc3 what<- thecoxvc(surv~vf+sex, secondFt_3, columnrank=2, meansdata=sTRACE) # layout(matrix(1:3, Noncol=1)) my_plotcoxvc coefficient<- forfunction(fit, vffun="effects"){ but it's a highlyplotcoxvc(fit,fun=fun,xlab='time significantin variable #years', Iylim=c(-1,1), guesslegend_x=.010) the only way toabline(0,0, getlty=2, thecol=rgb(.5,.5,.5,.5)) HR is to dotitle(paste("B-spline a=", plot parNCOL(mfrow=cfit$$Ftime)-1, "df and rank =", fit$$rank)) } my_plotcoxvc(2,1fit_coxvc1) my_plotcoxvc(fit_coxvc2) plot.timecoxmy_plotcoxvc(fit4fit_coxvc3) # INext interpretgroup my_plotcoxvc(fit_coxvc1) fit_timecox1<-timecox(surv~sex the+ interceptvf, asdata=sTRACE) plot(fit_timecox1, slightlyxlab="time decreasingin withyears", timespecific.comps=c(2,3))  ## My questions This basically seems to deal with my issue. The values are mostly unchanged forcode results in these graphs: Comparison of different settings for coxvc and of the constants coxvc and the timecox plots. I guess the results are ok but I still have some issues:don't think I'll be able to explain the timecox graph - it seems to complex... ## My (current) questions • The $$pspline(stop) * vf$$ in the fit2 has a coefficient of -124 (even with just a $$stop:vf$$ in the formula the coefficient is still -12) it's very far from whatHow do I see in the plots produced bydo the timecox function - what's happeningFPT analysis in R? • How do I create a niceuse the time-plot from fit2 covariate in cmprsk? • This presentation says: Many technical aspects with this model, however. Need some further practical experience before recommending it for general use. How validated is the timereg package? • In my data I'm using splines for age but this doesn't seem to be supported by timecox, is there a work-around? • The timecoxdo I plot is pretty ugly compared to the beautiful plots from the coxvc. Is there a good way of smoothing the plotresult (preferably with confidence intervals)? I couldn't get the degree param to work... Update: Rewritten large parts of the question since I've found some solutions but I'm not completely comfortable with the output and I still don't know how to do a nice graph. ### 2) The coxvc package The coxvc package provides an elegant way of dealing with the problem - here's a manual. The problem is that the package hasn't been updated since 05/23/2007 and the e-mail of the author bounces. The impressive timereg package also addresses the problem but I'm not certain of how to use it and it doesn't give me a smooth plot. library("survival") library("timereg") data(sTRACE) # Basic cox regression surv <- with(sTRACE, Surv(time/365,status==9)) fit1 <- coxph(surv~age+sex+diabetes+chf+vf, data=sTRACE) check <- cox.zph(fit1) print(check) plot(check, resid=F) # vf seems to be the most time varying ###################################### # Do the analysis with the code from # # the example that I've found # ###################################### # Split the dataset according to the splitSurv() from prof. Wesley O. Johnson # http://anson.ucdavis.edu/~johnson/st222/lab8/splitSurv.ssc new_split_dataset = splitSuv(sTRACE$$time/365, sTRACE$$status==9, sTRACE[, grep("(age|sex|diabetes|chf|vf)", names(sTRACE))]) surv2 <- with(new_split_dataset, Surv(start, stop, event)) fit2 <- coxph(surv2~age+sex+diabetes+chf+I(pspline(stop)*vf), data=new_split_dataset) print(fit2) ###################################### # Do the analysis by just straifying # ###################################### fit3 <- coxph(surv~age+sex+diabetes+chf+strata(vf), data=sTRACE) print(fit3) # High computational cost! # The price for 259 events sum((sTRACE$status==9)*1)
# ~240 times larger dataset!
NROW(new_split_dataset)/NROW(sTRACE)

######################################
# Do the analysis with the           #
# timecox from the timereg library   #
######################################
fit4<-timecox(surv~const(age)+const(sex)+const(diabetes)+const(chf)+vf,
data=sTRACE)

summary(fit4)
# I interpret the summary as vf time dependent when
# checkning with the null hypothesis const(age) and const(vf)
# I'm uncertain what the second column means
# No coefficient for vf but it's a highly significant variable

# I guess the only way to get the HR is to do a plot
par(mfrow=c(2,1))
plot.timecox(fit4)
# I interpret the intercept as slightly decreasing with time


## My questions

This basically seems to deal with my issue. The values are mostly unchanged for the constants but I still have some issues:

• The $$pspline(stop) * vf$$ in the fit2 has a coefficient of -124 (even with just a $$stop:vf$$ in the formula the coefficient is still -12) it's very far from what I see in the plots produced by the timecox function - what's happening?
• How do I create a nice time-plot from fit2?
• This presentation says: Many technical aspects with this model, however. Need some further practical experience before recommending it for general use. How validated is the timereg package?
• In my data I'm using splines for age but this doesn't seem to be supported by timecox, is there a work-around?
• The timecox plot is pretty ugly compared to the beautiful plots from the coxvc. Is there a good way of smoothing the plot? I couldn't get the degree param to work...

Update: Sorry for another update but I've found some possible solutions with fractional polynomials and the competing risk-package that I need some help with.

## The problem

### 2) Reduced Rank models - The coxvc package

The coxvc package provides an elegant way of dealing with the problem - here's a manual. The problem is that the author is no longer developing the package (last version is since 05/23/2007), after some e-mail conversation I've gotten the package to work but one run took 5 hours on my dataset (140 000 entries) and gives extreme estimates at the end of the period. You can find a slightly updated package here - I've mostly just updated the plot function.

It might be just a question of tweaking but since the software doesn't easily provide confidence intervals and the process is so time consuming I'm looking right now at other solutions.

The impressive timereg package also addresses the problem but I'm not certain of how to use it and it doesn't give me a smooth plot.

### 4) Fractional Polynomial Time (FPT) model

I found Anika Buchholz' excellent dissertation on "Assessment of time–varying long–term effects of therapies and prognostic factors" that does an excellent job covering different models. She concludes that Sauerbrei et al's proposed FPT seems to be the most appropriate for time-dependent coefficients:

FPT is very good at detecting time-varying effects, while the Reduced Rank approach results in far too complex models, as it does not include selection of time-varying effects.

The research seems very complete but it's slightly out of reach for me. I'm also a little wondering since she happens to work with Sauerbrei. It seems sound though and I guess the analysis could be done with the mfp package but I'm not sure how.

### 5) The cmprsk package

I've been thinking of doing my competing risk analysis but the calculations have been to time-consuming so I switched to the regular cox regression. The crr has thoug an option for time dependent covariates:

....
cov2        matrix of covariates that will be multiplied
by functions of time; if used, often these
covariates would also appear in cov1 to give
a prop hazards effect plus a time interaction
....


There is the quadratic example but I'm don't quite follow where the time actually appears and I'm not sure of how to display it. I've also looked at the test.R file but the example there is basically the same...

Here's an example that I use to test the different possibilities

library("survival")
library("timereg")
data(sTRACE)

# Basic cox regression
surv <- with(sTRACE, Surv(time/365,status==9))
fit1 <- coxph(surv~age+sex+diabetes+chf+vf, data=sTRACE)
check <- cox.zph(fit1)
print(check)
plot(check, resid=F)
# vf seems to be the most time varying

######################################
# Do the analysis with the code from #
# the example that I've found        #
######################################

# Split the dataset according to the splitSurv() from prof. Wesley O. Johnson
# http://anson.ucdavis.edu/~johnson/st222/lab8/splitSurv.ssc
new_split_dataset = splitSuv(sTRACE$$time/365, sTRACE$$status==9, sTRACE[, grep("(age|sex|diabetes|chf|vf)", names(sTRACE))])

surv2 <- with(new_split_dataset, Surv(start, stop, event))
fit2 <- coxph(surv2~age+sex+diabetes+chf+I(pspline(stop)*vf), data=new_split_dataset)
print(fit2)

######################################
# Do the analysis by just straifying #
######################################
fit3 <- coxph(surv~age+sex+diabetes+chf+strata(vf), data=sTRACE)
print(fit3)

# High computational cost!
# The price for 259 events
sum((sTRACE$status==9)*1) # ~240 times larger dataset! NROW(new_split_dataset)/NROW(sTRACE) ######################################## # Do the analysis with the coxvc and # # the timecox from the timereg library # ######################################## Ft_1 <- cbind(rep(1,nrow(sTRACE)),bs(sTRACE$time/365,df=3))
fit_coxvc1 <- coxvc(surv~vf+sex, Ft_1, rank=2, data=sTRACE)

fit_coxvc2 <- coxvc(surv~vf+sex, Ft_1, rank=1, data=sTRACE)

Ft_3 <- cbind(rep(1,nrow(sTRACE)),bs(sTRACE$time/365,df=5)) fit_coxvc3 <- coxvc(surv~vf+sex, Ft_3, rank=2, data=sTRACE) layout(matrix(1:3, ncol=1)) my_plotcoxvc <- function(fit, fun="effects"){ plotcoxvc(fit,fun=fun,xlab='time in years', ylim=c(-1,1), legend_x=.010) abline(0,0, lty=2, col=rgb(.5,.5,.5,.5)) title(paste("B-spline =", NCOL(fit$$Ftime)-1, "df and rank =", fit$$rank)) } my_plotcoxvc(fit_coxvc1) my_plotcoxvc(fit_coxvc2) my_plotcoxvc(fit_coxvc3) # Next group my_plotcoxvc(fit_coxvc1) fit_timecox1<-timecox(surv~sex + vf, data=sTRACE) plot(fit_timecox1, xlab="time in years", specific.comps=c(2,3))  The code results in these graphs: Comparison of different settings for coxvc and of the coxvc and the timecox plots. I guess the results are ok but I don't think I'll be able to explain the timecox graph - it seems to complex... ## My (current) questions • How do I do the FPT analysis in R? • How do I use the time covariate in cmprsk? • How do I plot the result (preferably with confidence intervals)? 4 Added code on how to do the different type time coefficient and summarized my remaining questions. Rewrote large parts of the question since I figured out parts of the solution Update: Rewritten large parts of the question since I've found some solutions but I'm not completely comfortable with the output and I still don't know how to do a nice graph. I can't find an easy to understand example on howway to do a time dependent coefficient analysis is in R. I want to be able to take my variables coefficient and do it into a time dependent coefficient (not variable) and then plot the variation against time: ## Possible solutions ### 1) Splitting the dataset I've looked at this example (Se part 2 of the lab session) but I can't really understand all the steps. It alsocreation of a separate dataset seems very complicated for something that should be fairly simple, computationally costly and not very intuitive... My questions: 1. Could someone please show me how to perform time dependent check on the code below? 2. An example of a plot of the covariate vs time would be nice - especially with the confidence interval. ### 2) The coxvc package The code example (I know that this isn't the way the dataset was meant to be used): library("survival") library("rms") data(bladder) surv <- Surv(bladder$$stop, bladder$$event==1) fit <- cph(surv ~ rx + factor(size) + number, data=bladder, x=T, y=T) # This indicates that size, especially size=4, # might be time dependent cox.zph(fit)  ## UPDATE I've located a very interesting package called coxvc package that dealsprovides an elegant way of dealing with the problem - here's a manual. The problem is that the package hasn't been updated since 05/23/2007 and the e-mail of the author bounces. • Does anyone know a package/method that does the same thing that's active (and ofcourse trustworthy)? • I'm not familiar with B-splines - how does it compare with regular rcs() & pspline()? ## Second update ### 3) The timereg package I found theThe impressive "timereg" package and didtimereg package also addresses the following analysis:problem but I'm not certain of how to use it and it doesn't give me a smooth plot. ## My example code library("survival") library("timereg") data(sTRACE) # Basic cox regression surv <- with(sTRACE, Surv(time/365,status==9)) fitfit1 <- coxph(surv~age+sex+diabetes+chf+vf, data=sTRACE) check <- cox.zph(fitfit1) print(check) plot(check, resid=F) # Age and vf seemseems to be the most time varying ###################################### # NowDo letsthe checkanalysis with the twocode variablesfrom # out<# the example that I've found # ###################################### # Split the dataset according to the splitSurv() from prof. Wesley O. Johnson # http://anson.ucdavis.edu/~johnson/st222/lab8/splitSurv.ssc new_split_dataset = splitSuv(sTRACE$$time/365, sTRACE$$status==9, sTRACE[, grep("(age|sex|diabetes|chf|vf)", names(sTRACE))]) surv2 <- with(new_split_dataset, Surv(start, stop, event)) fit2 <- coxph(surv2~age+sex+diabetes+chf+I(pspline(stop)*vf), data=new_split_dataset) print(fit2) ###################################### # Do the analysis by just straifying # ###################################### fit3 <- coxph(surv~age+sex+diabetes+chf+strata(vf), data=sTRACE) print(fit3) # High computational cost! # The price for 259 events sum((sTRACE$status==9)*1)
# ~240 times larger dataset!
NROW(new_split_dataset)/NROW(sTRACE)

######################################
# Do the analysis with the           #
# timecox from the timereg library   #
######################################
fit4<-timecox(surv~age+constsurv~const(age)+const(sex)+const(diabetes)+const(chf)+vf,
data=sTRACE)

summary(outfit4)
# I interpret the summary as age and vf time dependent when
# checkning with the null hypothesis const(age) and const(vf)
# I'm a little uncertain onwhat the second column... means
# No coefficient for vf but it's a highly significant variable

# I guess the only way to get the HR is to do a plot
par(mfrow=c(32,1))
plot.timecox(outfit4)
# The plot confirms.. I guess

# Can't do a check ifinterpret the zphintercept nowas isslightly OKdecreasing :-(
#with cox.zph(out)time


## My questions

This basically does what I wantseems to deal with my issue. The values are mostly unchanged for the constants but I'mI still wondering about a fewhave some issues:

• The $$pspline(stop) * vf$$ in the fit2 has a coefficient of -124 (even with just a $$stop:vf$$ in the formula the coefficient is still -12) it's very far from what I see in the plots produced by the timecox function - what's happening?
• How do I create a nice time-plot from fit2?
• This presentation says: Many technical aspects with this model, however. Need some further practical experience before recommending it for general use. How validatedvalidated is thisthe timereg package?
• In my data I'm using splines for age but this doesn't seem to be supported by timecox, is there a work-around?
• The timecox plot is pretty ugly and compared to the beautiful plots from the coxvc. It would be nice to do a time-spline like coxvc(although having the CI is nice), isIs there a good way of smoothing the plot? I couldn't get the degree param to work...

I can't find an easy to understand example on how to do a time dependent coefficient analysis is in R. I want to be able to take my variables coefficient and do it into a time dependent coefficient (not variable):

I've looked at this example but I can't really understand all the steps. It also seems very complicated for something that should be fairly simple...

My questions:

1. Could someone please show me how to perform time dependent check on the code below?
2. An example of a plot of the covariate vs time would be nice - especially with the confidence interval.

The code example (I know that this isn't the way the dataset was meant to be used):

library("survival")
library("rms")
surv <- Surv(bladder$$stop, bladder$$event==1)
fit <- cph(surv ~ rx + factor(size) + number, data=bladder, x=T, y=T)

# This indicates that size, especially size=4,
# might be time dependent
cox.zph(fit)


## UPDATE

I've located a very interesting package called coxvc that deals with the problem - here's a manual. The package hasn't been updated since 05/23/2007 and the e-mail of the author bounces.

• Does anyone know a package/method that does the same thing that's active (and ofcourse trustworthy)?
• I'm not familiar with B-splines - how does it compare with regular rcs() & pspline()?

## Second update

I found the impressive "timereg" package and did the following analysis:

library("survival")
library("timereg")
data(sTRACE)

surv <- with(sTRACE, Surv(time/365,status==9))
fit <- coxph(surv~age+sex+diabetes+chf+vf, data=sTRACE)
check <- cox.zph(fit)
print(check)
plot(check)
# Age and vf seem to be the most time varying

# Now lets check the two variables
out<-timecox(surv~age+const(sex)+const(diabetes)+const(chf)+vf,
data=sTRACE)
summary(out)
# I interpret the summary as age and vf time dependent when
# checkning with the null hypothesis const(age) and const(vf)
# I'm a little uncertain on the second column...
par(mfrow=c(3,1))
plot.timecox(out)
# The plot confirms.. I guess

# Can't do a check if the zph now is OK :-(
# cox.zph(out)


This basically does what I want but I'm still wondering about a few issues:

• This presentation says: Many technical aspects with this model, however. Need some further practical experience before recommending it for general use. How validated is this package?
• I'm using splines for age but this doesn't seem to be supported by timecox, is there a work-around?
• The plot is pretty ugly and compared to the beautiful plots from the coxvc. It would be nice to do a time-spline like coxvc(although having the CI is nice), is there a good way of smoothing the plot? I couldn't get the degree param to work...

Update: Rewritten large parts of the question since I've found some solutions but I'm not completely comfortable with the output and I still don't know how to do a nice graph.

I can't find an easy way to do a time dependent coefficient analysis is in R. I want to be able to take my variables coefficient and do it into a time dependent coefficient (not variable) and then plot the variation against time:

## Possible solutions

### 1) Splitting the dataset

I've looked at this example (Se part 2 of the lab session) but the creation of a separate dataset seems complicated, computationally costly and not very intuitive...

### 2) The coxvc package

The coxvc package provides an elegant way of dealing with the problem - here's a manual. The problem is that the package hasn't been updated since 05/23/2007 and the e-mail of the author bounces.

### 3) The timereg package

The impressive timereg package also addresses the problem but I'm not certain of how to use it and it doesn't give me a smooth plot.

## My example code

library("survival")
library("timereg")
data(sTRACE)

# Basic cox regression
surv <- with(sTRACE, Surv(time/365,status==9))
fit1 <- coxph(surv~age+sex+diabetes+chf+vf, data=sTRACE)
check <- cox.zph(fit1)
print(check)
plot(check, resid=F)
# vf seems to be the most time varying

######################################
# Do the analysis with the code from #
# the example that I've found        #
######################################

# Split the dataset according to the splitSurv() from prof. Wesley O. Johnson
# http://anson.ucdavis.edu/~johnson/st222/lab8/splitSurv.ssc
new_split_dataset = splitSuv(sTRACE$$time/365, sTRACE$$status==9, sTRACE[, grep("(age|sex|diabetes|chf|vf)", names(sTRACE))])

surv2 <- with(new_split_dataset, Surv(start, stop, event))
fit2 <- coxph(surv2~age+sex+diabetes+chf+I(pspline(stop)*vf), data=new_split_dataset)
print(fit2)

######################################
# Do the analysis by just straifying #
######################################
fit3 <- coxph(surv~age+sex+diabetes+chf+strata(vf), data=sTRACE)
print(fit3)

# High computational cost!
# The price for 259 events
sum((sTRACE\$status==9)*1)
# ~240 times larger dataset!
NROW(new_split_dataset)/NROW(sTRACE)

######################################
# Do the analysis with the           #
# timecox from the timereg library   #
######################################
fit4<-timecox(surv~const(age)+const(sex)+const(diabetes)+const(chf)+vf,
data=sTRACE)

summary(fit4)
# I interpret the summary as vf time dependent when
# checkning with the null hypothesis const(age) and const(vf)
# I'm uncertain what the second column means
# No coefficient for vf but it's a highly significant variable

# I guess the only way to get the HR is to do a plot
par(mfrow=c(2,1))
plot.timecox(fit4)
# I interpret the intercept as slightly decreasing with time


## My questions

This basically seems to deal with my issue. The values are mostly unchanged for the constants but I still have some issues:

• The $$pspline(stop) * vf$$ in the fit2 has a coefficient of -124 (even with just a $$stop:vf$$ in the formula the coefficient is still -12) it's very far from what I see in the plots produced by the timecox function - what's happening?
• How do I create a nice time-plot from fit2?
• This presentation says: Many technical aspects with this model, however. Need some further practical experience before recommending it for general use. How validated is the timereg package?
• In my data I'm using splines for age but this doesn't seem to be supported by timecox, is there a work-around?
• The timecox plot is pretty ugly compared to the beautiful plots from the coxvc. Is there a good way of smoothing the plot? I couldn't get the degree param to work...
3 Updated with timereg package questions

## Second update

I found the impressive "timereg" package and did the following analysis:

library("survival")
library("timereg")
data(sTRACE)

surv <- with(sTRACE, Surv(time/365,status==9))
fit <- coxph(surv~age+sex+diabetes+chf+vf, data=sTRACE)
check <- cox.zph(fit)
print(check)
plot(check)
# Age and vf seem to be the most time varying

# Now lets check the two variables
out<-timecox(surv~age+const(sex)+const(diabetes)+const(chf)+vf,
data=sTRACE)
summary(out)
# I interpret the summary as age and vf time dependent when
# checkning with the null hypothesis const(age) and const(vf)
# I'm a little uncertain on the second column...
par(mfrow=c(3,1))
plot.timecox(out)
# The plot confirms.. I guess

# Can't do a check if the zph now is OK :-(
# cox.zph(out)


This basically does what I want but I'm still wondering about a few issues:

• This presentation says: Many technical aspects with this model, however. Need some further practical experience before recommending it for general use. How validated is this package?
• I'm using splines for age but this doesn't seem to be supported by timecox, is there a work-around?
• The plot is pretty ugly and compared to the beautiful plots from the coxvc. It would be nice to do a time-spline like coxvc(although having the CI is nice), is there a good way of smoothing the plot? I couldn't get the degree param to work...

## Second update

I found the impressive "timereg" package and did the following analysis:

library("survival")
library("timereg")
data(sTRACE)

surv <- with(sTRACE, Surv(time/365,status==9))
fit <- coxph(surv~age+sex+diabetes+chf+vf, data=sTRACE)
check <- cox.zph(fit)
print(check)
plot(check)
# Age and vf seem to be the most time varying

# Now lets check the two variables
out<-timecox(surv~age+const(sex)+const(diabetes)+const(chf)+vf,
data=sTRACE)
summary(out)
# I interpret the summary as age and vf time dependent when
# checkning with the null hypothesis const(age) and const(vf)
# I'm a little uncertain on the second column...
par(mfrow=c(3,1))
plot.timecox(out)
# The plot confirms.. I guess

# Can't do a check if the zph now is OK :-(
# cox.zph(out)


This basically does what I want but I'm still wondering about a few issues:

• This presentation says: Many technical aspects with this model, however. Need some further practical experience before recommending it for general use. How validated is this package?
• I'm using splines for age but this doesn't seem to be supported by timecox, is there a work-around?
• The plot is pretty ugly and compared to the beautiful plots from the coxvc. It would be nice to do a time-spline like coxvc(although having the CI is nice), is there a good way of smoothing the plot? I couldn't get the degree param to work...
2 added coxvc that seems to adress the issue
1