0
$\begingroup$

I tried to do relative survival analysis specifically poisson regression in relsurv package. And I want to include covariate x time interaction term since the hazard (or excess hazard) in my model is not proportional.

library(relsurv)
dat <- rdata

#model without interaction
mod <- rsadd(Surv(time, cens)~sex+agegr+ratetable(age=age*365.241), data = dat, ratetable = slopop, 
             int = c(0,5,10,15), method = "glm.poi") 
summary(mod)

#test for proportional excess hazard
rs.br(mod) #all not significant

#cut time according to interval argument
dat$ytime <- dat$time/365.241
dat$fu <- cut(dat$ytime, c(0, 5, 10, 15), labels = 1:3, include.lowest = T) 

#dummy code for interaction
dat$intFe2 <- ifelse(dat$sex==2 & dat$fu==2, 1,0)
dat$intFe3 <- ifelse(dat$sex==2 & dat$fu==3, 1,0)

#model with interaction
mod2 <- rsadd(Surv(time, cens)~sex+agegr+intFe2+intFe3+ratetable(age=age*365.241), data = dat, 
              ratetable = slopop, int = c(0, 5, 10, 15), method = "glm.poi") 
summary(mod2) #interaction should not be significant since the result from rs.br() is not significant

In the example, the interaction should not be significant. Since the sex and the time variables are factor or categorical, this is my reference. And here are my references: non-proportional(page 15) model and relsurv.

Also, I have asked the author how to do this in her package, and this is her reply:

"In general, you can include interaction between covariates, e.g.:

mod <- rsadd(Surv(time, cens) ~ sex * agegr,data = rdata, ratetable = slopop, int = 5, method = "glm.poi")
summary(mod)

Interaction between a covariate and time can be implemented only through the standard data transformation trick: let's assume you have a two year follow up time and you're interested in the interaction between age and time. What you have to do is to generate two variables out of variable age. The first variable is equal to age on the first subinterval (e.g. [0, 1]) and 0 otherwise; the second variable is then equal to age on the other subinterval (in this example: (1, 2]) and 0 otherwise.

You then include these two variables in the model (let's name them age_1 and age_2) and through this you can see what's the interaction:

mod <- rsadd(Surv(time, cens) ~ age_1 + age_2, data = rdata, ratetable = slopop, int = 5, method = "glm.poi")
summary(mod)

You can generalize this for any number of subintervals."

Anyone knows or can give me tips on how to properly include the term?

*rdata is a dataset in relsurv package

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.