Search code examples
rsurvival-analysiscox-regression

Compute Cox PH models with only time to event data


I have a few individual patient data (IPD) sets with only time to event data and a boolean for censoring or an event.

I've very new to R and biostats, so any input would be much appreciated.

My problem is as follows:

  1. I have multiple IPD datasets from clinical trials with similar baselines

  2. I've been able to scrape IPD data using the method outlined by Guyot et al. ('Enhanced Secondary Analysis of Surival data...')

  3. This gives me dataframes with the following structure:

    event_time   censor    arm_id
    
     1         1         X
     2         0         X
     5         1         X
    

censor = 1 is an event | censor = 0 is a censoring event

I would like to compute Cox proportional hazard statistics for the given arms, but every walk through I find online uses covariate data - how can I generate Cox PH statistics effectively?

Many thanks!


Solution

  • Your example doesn't actually have sufficient numbers to generate anything useful but it is large enough to demonstarte the code that would be needed:

     dt <- rd.txt("event_time   censor    arm_id
      1         1         X
      2         0         X
      5         1         X")
    
    #Don't use that rd.txt function unless you have defined one yourself.
    
    coxph( Surv(event_time, event=censor) ~ 1, data=dt)
    Call:  coxph(formula = Surv(event_time, event = censor) ~ 1, data = dt)
    
    Null model
      log likelihood= -1.098612 
      n= 3 
    

    The R formula interface uses 1 for a non-covariate model. Such a model can be useful if you are comparint it to another covariate containing model and want to do a likelihood ratio test.