0

This is my first question here, so if I need to share more information please let me know.

I have done a Cox regression analysis in R in which I am interested in the effect of implant surface on reoperation over 36 months. Here's a reproducible example:

library(survival)

n <- 100
df <- data.frame(id=1:n, 
                 time=sample(1:36, n, replace=TRUE),
                 event=sample(0:2, n, replace=TRUE),
                 implantsurface=sample(0:1, n, replace=TRUE),
                 covariate1=sample(0:1, n, replace=TRUE),
                 covariate2=sample(0:1, n, replace=TRUE))
df$time <- as.numeric(df$time)

I adjusted for a number of covariates, which showed that the proportional hazards assumption was violated for covariate1. I split my dataset into 0-4 mo and 4-36 mo as follows (simplified code), so that the PH assumption was no longer violated:

fit1 <- survSplit(Surv(time, event == 1) ~
implantsurface + covariate1 + covariate2,
data = df, cut=c(4),
episode= "tgroup")

fit2 <- coxph(Surv(tstart, time, event) ~
implantsurface + strata(tgroup):covariate1 + covariate2,
data = fit1)

Now I would also like to adjust for competing risks with Fine-Gray regression, but I am unable to do this for the split dataset. I have tried the following:

FG <- finegray(Surv(time = time, event = event.competing, type = "mstate") ~
implantsurface + strata(tgroup):covariate1 + covariate2,
data = fit1, etype = "event_of_interest")

FGfit <- coxph(Surv(fgstart, fgstop, fgstatus) ~
implantsurface + strata(tgroup):covariate1 + covariate2,
weights = fgwt, data = FG)

Error in strata(tgroup) : object 'tgroup' not found

Does anyone know how/if Fine-Gray can be applied to a split survival dataset? Many thanks in advance for thinking along!

r_fryer
  • 1
  • 2
  • 1
    It's easier to help you if you include a simple [reproducible example](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) with sample input that can be used to test and verify possible solutions. – MrFlick Dec 06 '22 at 15:55
  • Many thanks for your quick response, I've added a reproducible example. – r_fryer Dec 06 '22 at 16:38

0 Answers0