Royston-Parmar Model – Calculating Hazard Ratio with flexsurv::flexsurvspline

cox-modelrregressionsurvival

I have a covariate with time-varying coefficient with two categories (lets call it T), which I have modeled using the Royston-Parmar model from flexsurv package as following.

fit <- flexsurv::flexsurvspline(Surv(time, event) ~ T+gamma1(T)+A+B,data=data,k=1,scale="hazard")

where A and B are other covariates. I know that I can get the hazard rates as predictions for a new data using

pred=summary(fit,typ="hazard",newdata=newdata)

where newdata has data on the covariate levels of interest.

newdata = data.frame(A= rep(25,2),
                    T= rep(c('T1', 'T2'), each=1), B=rep(5,2))

as the hazard rates are time-varying for T1 and T2, can I calculate hazard ratios at different time points by dividing the hazard rates at those specific time points?

Best Answer

For those not familiar with the flexsurv package, the gamma1(T) term in the model allows for a time-varying coefficient for the covariate T as part of the Royston-Parmar regression spline estimate of hazard over time.

A hazard ratio is just that: a ratio of hazards. So if you specify covariate values and a comparison time, then the ratio of hazard values gives you the hazard ratio at that specific time. In your situation that hazard ratio will necessarily vary over time, so it's not clear how useful that hazard ratio will be. Evaluation of cumulative hazards via asking for "cumhaz" might be more informative, as it tells you the relative hazards up through that time.

Related Question