0.1 Load data from spreadsheet

data <-
  read_xlsx(
    "/Users/carolinaferreiraatuesta/Documents/WAMS/ASM_withdrawal_registry/WAMS_Registry.xlsx"
  )
data <-
  subset(
    data,
    data$began_wd == 1 &
      szaura >= "0" &
      wd_all >= "0" & wd_all_time >= "0" & time_szaura >= "0"
  )
#data = data[,!(names(data) %in% drop)]
data$time_szaura <- as.numeric(data$time_szaura)
data$aura_time <- as.numeric(data$aura_time)
data$time_begin <- as.numeric(data$time_begin)
data$years_follow_up <- as.numeric(data$years_follow_up)
data$wd_all_time <- as.numeric(data$wd_all_time)
data$age_onset <- as.numeric(data$age_onset)
data$duration <- as.numeric(data$duration)

0.2 Some theory

1 What are competing risks?

When subjects have multiple possible events in a time-to-event setting and that one of them precludes them from having the other.

In our case, we have to assume that seizure relapse precludes participants from completely withdrawing (but not the other way around! -> important when interpreting the results.

2 So, what’s the problem?

Conventional survival analysis (aka. KM) relies on non-informative censoring ->censoring that occurs independently of the risk for the outcome of interest. So, if our main outcome is complete withdrawal, participants who survived (did not complete withdrawal) at the end of follow up will be censored, and this censoring is assumed to be non-informative (aka, that it tells us nothing about the risk)…however, that’s not the case for our scenario: participants that are censored at the end of follow up as “did not complete withdrawal” could include those who had a seizure relapse (and therefore will never complete withdrawal). In this case, censoring IS informative and running a KM here will result in overestimated effects.

3 What to do?

In competing risk modelling, data is described using cumulative incidence functions. Incidence derived from CIFs is the probability of experiencing the primary event (wd_all) conditioned upon not experiencing either event (wd_all or relapse) until that time. The effect of covariates is determined by two different hazard functions: cause-specific and/or Fine-Gray subdistribution.

Cause-specific: Cause-specific hazard (estimate is called Aalen-Johanson) of a given event represents the rate of wd_all per unit of time among those not having had relapse.

Subdistribution hazard function Cumulative incidence (Fine Gray) represents the rate of wd_all among those that have not experienced any event PLUS those that have experienced a competing event (aka, relapse)

4 What to use:

Each of these approaches have practical considerations and give complementary information about the data.

Regression using a cause-specific hazard function will give coefficients that describes the relative effect of a covariate on the relative increase in the rate of wd_all in observations that haven’t relapse. This is ideal when examining causal relationships between risk factors and an event.

Regression using the subdistribution hazard function describes the effect of covariates on the incidence and this may be more in line with predicting the rate of occurrence of events.

Literature says its ideal to use both. But the interpretation is a bit complex.

5 Whats in here?

  1. Cumulative incidence curves for each predictor and each competing risk.
  2. Cause-specific analysis
  3. Subdistribution analysis

5.1 Data set-up

data$age_at_surgery_ten_cat <-
  findInterval(data$age_at_surgery_ten, c(0, 2, 4), rightmost.closed = TRUE)
data$duration_ten_cat <-
  findInterval(data$duration_ten, c(0, 2), rightmost.closed = TRUE)
data$age_onset_ten_cat <-
  findInterval(data$age_onset_ten, c(0, 2, 4), rightmost.closed = TRUE)
data$drugs_cat <-
  findInterval(data$drugs, c(0, 3), rightmost.closed = TRUE)
data$time_begin_cat <-
  findInterval(data$time_begin, c(0, 2, 4), rightmost.closed = TRUE)


etime <- with(data, ifelse(szaura == 0, wd_all_time,  time_szaura))
event <- with(data, ifelse(szaura == 0, 2 * wd_all, 1))
event <- factor(event, 0:2, labels = c("none", "szaura", "wdall"))
table(event)
## event
##   none szaura  wdall 
##    301    302    195

5.2 Time spent in each status

list <- list(
  'external',
  'sex',
  'febrile_sz',
  'learning_disability',
  'psychiatric_pre_any',
  'gtcs',
  'MRI_normal',
  'opside',
  'optemp',
  'as.factor(opextent)',
  'op_incomplete',
  'pathology_HS',
  'pathology_FCD',
  'pathology_DNT',
  'pathology_CAV',
  'pathology_GL',
  'pathology_dual',
  'pathology_other',
  'pathology_normal',
  'acutepostszauras',
  'auras',
  'age_onset_ten_cat',
  'age_at_surgery_ten_cat',
  'duration_ten_cat',
  'extent',
  'extra',
  'aura_relapse',
  'numsz6',
  'time_begin_cat',
  'drugs_cat'
)

fit_cause_specific <- lapply(list, function(x)
  survfit(as.formula(
    paste("Surv(as.numeric(etime), event) ~", x)
  ),  data = data))
fit_cause_specific
## [[1]]
## Call: survfit(formula = as.formula(paste("Surv(as.numeric(etime), event) ~", 
##     x)), data = data)
## 
##                      n nevent    rmean*
## external=0, (s0)   350      0  8.263520
## external=1, (s0)   448      0  5.943924
## external=0, szaura 350    116  7.270142
## external=1, szaura 448    186 11.930215
## external=0, wdall  350    130  8.113560
## external=1, wdall  448     65  5.773083
##    *restricted mean time in state (max time = 23.64722 )
## 
## [[2]]
## Call: survfit(formula = as.formula(paste("Surv(as.numeric(etime), event) ~", 
##     x)), data = data)
## 
##                 n nevent    rmean*
## sex=0, (s0)   374      0  7.915595
## sex=1, (s0)   424      0  6.615008
## sex=0, szaura 374    133  8.975504
## sex=1, szaura 424    169 10.356667
## sex=0, wdall  374     93  6.756124
## sex=1, wdall  424    102  6.675548
##    *restricted mean time in state (max time = 23.64722 )
## 
## [[3]]
## Call: survfit(formula = as.formula(paste("Surv(as.numeric(etime), event) ~", 
##     x)), data = data)
## 
##    65 observations deleted due to missingness 
##                        n nevent    rmean*
## febrile_sz=0, (s0)   446      0  6.684250
## febrile_sz=1, (s0)   287      0  8.065381
## febrile_sz=0, szaura 446    174 10.146971
## febrile_sz=1, szaura 287    105  8.647054
## febrile_sz=0, wdall  446    111  6.816001
## febrile_sz=1, wdall  287     83  6.934787
##    *restricted mean time in state (max time = 23.64722 )
## 
## [[4]]
## Call: survfit(formula = as.formula(paste("Surv(as.numeric(etime), event) ~", 
##     x)), data = data)
## 
##    63 observations deleted due to missingness 
##                                 n nevent   rmean*
## learning_disability=0, (s0)   673      0 7.485711
## learning_disability=1, (s0)    62      0 5.328022
## learning_disability=0, szaura 673    256 9.470245
## learning_disability=1, szaura  62     23 8.908078
## learning_disability=0, wdall  673    173 6.691267
## learning_disability=1, wdall   62     22 9.411122
##    *restricted mean time in state (max time = 23.64722 )
## 
## [[5]]
## Call: survfit(formula = as.formula(paste("Surv(as.numeric(etime), event) ~", 
##     x)), data = data)
## 
##    63 observations deleted due to missingness 
##                                 n nevent   rmean*
## psychiatric_pre_any=0, (s0)   523      0 6.899684
## psychiatric_pre_any=1, (s0)   212      0 8.305492
## psychiatric_pre_any=0, szaura 523    206 9.881985
## psychiatric_pre_any=1, szaura 212     73 8.336334
## psychiatric_pre_any=0, wdall  523    134 6.865553
## psychiatric_pre_any=1, wdall  212     61 7.005396
##    *restricted mean time in state (max time = 23.64722 )
## 
## [[6]]
## Call: survfit(formula = as.formula(paste("Surv(as.numeric(etime), event) ~", 
##     x)), data = data)
## 
##    1 observation deleted due to missingness 
##                  n nevent    rmean*
## gtcs=0, (s0)   234      0  7.690958
## gtcs=1, (s0)   563      0  7.165633
## gtcs=0, szaura 234     69  7.705062
## gtcs=1, szaura 563    233 10.443566
## gtcs=0, wdall  234     74  8.251202
## gtcs=1, wdall  563    120  6.038023
##    *restricted mean time in state (max time = 23.64722 )
## 
## [[7]]
## Call: survfit(formula = as.formula(paste("Surv(as.numeric(etime), event) ~", 
##     x)), data = data)
## 
##                        n nevent    rmean*
## MRI_normal=0, (s0)   711      0  7.348438
## MRI_normal=1, (s0)    87      0  7.000697
## MRI_normal=0, szaura 711    266  9.382714
## MRI_normal=1, szaura  87     36 12.367119
## MRI_normal=0, wdall  711    186  6.916070
## MRI_normal=1, wdall   87      9  4.279407
##    *restricted mean time in state (max time = 23.64722 )
## 
## [[8]]
## Call: survfit(formula = as.formula(paste("Surv(as.numeric(etime), event) ~", 
##     x)), data = data)
## 
##    1 observation deleted due to missingness 
##                    n nevent    rmean*
## opside=0, (s0)   360      0  7.135861
## opside=1, (s0)   429      0  7.510271
## opside=2, (s0)     8      0  2.687500
## opside=0, szaura 360    137  9.739226
## opside=1, szaura 429    164  9.674143
## opside=2, szaura   8      1  2.893403
## opside=0, wdall  360     92  6.772135
## opside=1, wdall  429     98  6.462808
## opside=2, wdall    8      5 18.066319
##    *restricted mean time in state (max time = 23.64722 )
## 
## [[9]]
## Call: survfit(formula = as.formula(paste("Surv(as.numeric(etime), event) ~", 
##     x)), data = data)
## 
##                    n nevent    rmean*
## optemp=0, (s0)   386      0  6.663424
## optemp=1, (s0)   412      0  7.882302
## optemp=0, szaura 386    155 11.469868
## optemp=1, szaura 412    147  8.234167
## optemp=0, wdall  386     61  5.513930
## optemp=1, wdall  412    134  7.530753
##    *restricted mean time in state (max time = 23.64722 )
## 
## [[10]]
## Call: survfit(formula = as.formula(paste("Surv(as.numeric(etime), event) ~", 
##     x)), data = data)
## 
##    131 observations deleted due to missingness 
##                                 n nevent    rmean*
## as.factor(opextent)=0, (s0)   104      0  6.749081
## as.factor(opextent)=1, (s0)   550      0  7.608952
## as.factor(opextent)=2, (s0)    13      0  7.057949
## as.factor(opextent)=0, szaura 104     33  7.920359
## as.factor(opextent)=1, szaura 550    202  9.106843
## as.factor(opextent)=2, szaura  13      2  3.330342
## as.factor(opextent)=0, wdall  104     38  8.977783
## as.factor(opextent)=1, wdall  550    149  6.931428
## as.factor(opextent)=2, wdall   13      8 13.258932
##    *restricted mean time in state (max time = 23.64722 )
## 
## [[11]]
## Call: survfit(formula = as.formula(paste("Surv(as.numeric(etime), event) ~", 
##     x)), data = data)
## 
##    6 observations deleted due to missingness 
##                           n nevent    rmean*
## op_incomplete=0, (s0)   708      0  7.572456
## op_incomplete=1, (s0)    84      0  5.976254
## op_incomplete=0, szaura 708    259  9.269423
## op_incomplete=1, szaura  84     42 12.228017
## op_incomplete=0, wdall  708    179  6.805344
## op_incomplete=1, wdall   84     13  5.442951
##    *restricted mean time in state (max time = 23.64722 )
## 
## [[12]]
## Call: survfit(formula = as.formula(paste("Surv(as.numeric(etime), event) ~", 
##     x)), data = data)
## 
##                          n nevent   rmean*
## pathology_HS=0, (s0)   362      0 6.901347
## pathology_HS=1, (s0)   436      0 7.606000
## pathology_HS=0, szaura 362    131 9.850888
## pathology_HS=1, szaura 436    171 9.487682
## pathology_HS=0, wdall  362     80 6.894987
## pathology_HS=1, wdall  436    115 6.553541
##    *restricted mean time in state (max time = 23.64722 )
## 
## [[13]]
## Call: survfit(formula = as.formula(paste("Surv(as.numeric(etime), event) ~", 
##     x)), data = data)
## 
##                           n nevent   rmean*
## pathology_FCD=0, (s0)   730      0 7.395765
## pathology_FCD=1, (s0)    68      0 7.115867
## pathology_FCD=0, szaura 730    280 9.710629
## pathology_FCD=1, szaura  68     22 8.089548
## pathology_FCD=0, wdall  730    176 6.540828
## pathology_FCD=1, wdall   68     19 8.441807
##    *restricted mean time in state (max time = 23.64722 )
## 
## [[14]]
## Call: survfit(formula = as.formula(paste("Surv(as.numeric(etime), event) ~", 
##     x)), data = data)
## 
##                           n nevent   rmean*
## pathology_DNT=0, (s0)   749      0 7.341941
## pathology_DNT=1, (s0)    49      0 7.233879
## pathology_DNT=0, szaura 749    285 9.737981
## pathology_DNT=1, szaura  49     17 8.019535
## pathology_DNT=0, wdall  749    177 6.567300
## pathology_DNT=1, wdall   49     18 8.393809
##    *restricted mean time in state (max time = 23.64722 )
## 
## [[15]]
## Call: survfit(formula = as.formula(paste("Surv(as.numeric(etime), event) ~", 
##     x)), data = data)
## 
##    131 observations deleted due to missingness 
##                           n nevent    rmean*
## pathology_CAV=0, (s0)   613      0  7.511449
## pathology_CAV=1, (s0)    54      0  6.868634
## pathology_CAV=0, szaura 613    225  9.036434
## pathology_CAV=1, szaura  54     12  5.740363
## pathology_CAV=0, wdall  613    172  7.099339
## pathology_CAV=1, wdall   54     23 11.038226
##    *restricted mean time in state (max time = 23.64722 )
## 
## [[16]]
## Call: survfit(formula = as.formula(paste("Surv(as.numeric(etime), event) ~", 
##     x)), data = data)
## 
##    1 observation deleted due to missingness 
##                          n nevent    rmean*
## pathology_GL=0, (s0)   776      0  7.413176
## pathology_GL=1, (s0)    21      0  2.763528
## pathology_GL=0, szaura 776    295  9.680229
## pathology_GL=1, szaura  21      6  7.251629
## pathology_GL=0, wdall  776    185  6.553818
## pathology_GL=1, wdall   21     10 13.632065
##    *restricted mean time in state (max time = 23.64722 )
## 
## [[17]]
## Call: survfit(formula = as.formula(paste("Surv(as.numeric(etime), event) ~", 
##     x)), data = data)
## 
##    1 observation deleted due to missingness 
##                            n nevent   rmean*
## pathology_dual=0, (s0)   761      0 7.341221
## pathology_dual=1, (s0)    36      0 6.164697
## pathology_dual=0, szaura 761    291 9.722327
## pathology_dual=1, szaura  36     10 8.057083
## pathology_dual=0, wdall  761    183 6.583674
## pathology_dual=1, wdall   36     12 9.425443
##    *restricted mean time in state (max time = 23.64722 )
## 
## [[18]]
## Call: survfit(formula = as.formula(paste("Surv(as.numeric(etime), event) ~", 
##     x)), data = data)
## 
##                             n nevent   rmean*
## pathology_other=0, (s0)   663      0 7.137658
## pathology_other=1, (s0)   135      0 8.948204
## pathology_other=0, szaura 663    254 9.564709
## pathology_other=1, szaura 135     48 9.741912
## pathology_other=0, wdall  663    175 6.944855
## pathology_other=1, wdall  135     20 4.957106
##    *restricted mean time in state (max time = 23.64722 )
## 
## [[19]]
## Call: survfit(formula = as.formula(paste("Surv(as.numeric(etime), event) ~", 
##     x)), data = data)
## 
##                              n nevent    rmean*
## pathology_normal=0, (s0)   778      0  7.328002
## pathology_normal=1, (s0)    20      0  8.188381
## pathology_normal=0, szaura 778    293  9.549198
## pathology_normal=1, szaura  20      9 14.313147
## pathology_normal=0, wdall  778    194  6.770022
## pathology_normal=1, wdall   20      1  1.145694
##    *restricted mean time in state (max time = 23.64722 )
## 
## [[20]]
## Call: survfit(formula = as.formula(paste("Surv(as.numeric(etime), event) ~", 
##     x)), data = data)
## 
##                              n nevent   rmean*
## acutepostszauras=0, (s0)   725      0 7.175661
## acutepostszauras=1, (s0)    73      0 8.980822
## acutepostszauras=0, szaura 725    277 9.667697
## acutepostszauras=1, szaura  73     25 9.437234
## acutepostszauras=0, wdall  725    182 6.803864
## acutepostszauras=1, wdall   73     13 5.229166
##    *restricted mean time in state (max time = 23.64722 )
## 
## [[21]]
## Call: survfit(formula = as.formula(paste("Surv(as.numeric(etime), event) ~", 
##     x)), data = data)
## 
##    54 observations deleted due to missingness 
##                   n nevent    rmean*
## auras=0, (s0)   676      0  7.453676
## auras=1, (s0)    68      0  4.894606
## auras=0, szaura 676    240  8.872702
## auras=1, szaura  68     41 15.950184
## auras=0, wdall  676    190  7.320843
## auras=1, wdall   68      5  2.802432
##    *restricted mean time in state (max time = 23.64722 )
## 
## [[22]]
## Call: survfit(formula = as.formula(paste("Surv(as.numeric(etime), event) ~", 
##     x)), data = data)
## 
##                               n nevent    rmean*
## age_onset_ten_cat=1, (s0)   557      0  7.379274
## age_onset_ten_cat=2, (s0)   197      0  6.760903
## age_onset_ten_cat=3, (s0)    44      0 11.257718
## age_onset_ten_cat=1, szaura 557    208  9.287885
## age_onset_ten_cat=2, szaura 197     78 10.600300
## age_onset_ten_cat=3, szaura  44     16  9.237207
## age_onset_ten_cat=1, wdall  557    148  6.980063
## age_onset_ten_cat=2, wdall  197     43  6.286019
## age_onset_ten_cat=3, wdall   44      4  3.152298
##    *restricted mean time in state (max time = 23.64722 )
## 
## [[23]]
## Call: survfit(formula = as.formula(paste("Surv(as.numeric(etime), event) ~", 
##     x)), data = data)
## 
##                                    n nevent    rmean*
## age_at_surgery_ten_cat=1, (s0)    59      0  5.619964
## age_at_surgery_ten_cat=2, (s0)   471      0  7.216283
## age_at_surgery_ten_cat=3, (s0)   268      0  8.073811
## age_at_surgery_ten_cat=1, szaura  59     22 10.447979
## age_at_surgery_ten_cat=2, szaura 471    174  8.949416
## age_at_surgery_ten_cat=3, szaura 268    106 10.696615
## age_at_surgery_ten_cat=1, wdall   59     13  7.579279
## age_at_surgery_ten_cat=2, wdall  471    142  7.481523
## age_at_surgery_ten_cat=3, wdall  268     40  4.876796
##    *restricted mean time in state (max time = 23.64722 )
## 
## [[24]]
## Call: survfit(formula = as.formula(paste("Surv(as.numeric(etime), event) ~", 
##     x)), data = data)
## 
##                              n nevent    rmean*
## duration_ten_cat=1, (s0)   432      0  6.763113
## duration_ten_cat=2, (s0)   366      0  7.785234
## duration_ten_cat=1, szaura 432    147  8.998724
## duration_ten_cat=2, szaura 366    155 10.533246
## duration_ten_cat=1, wdall  432    123  7.885386
## duration_ten_cat=2, wdall  366     72  5.328742
##    *restricted mean time in state (max time = 23.64722 )
## 
## [[25]]
## Call: survfit(formula = as.formula(paste("Surv(as.numeric(etime), event) ~", 
##     x)), data = data)
## 
##    131 observations deleted due to missingness 
##                    n nevent    rmean*
## extent=0, (s0)   550      0  7.608952
## extent=1, (s0)   104      0  6.749081
## extent=2, (s0)    13      0  7.057949
## extent=0, szaura 550    202  9.106843
## extent=1, szaura 104     33  7.920359
## extent=2, szaura  13      2  3.330342
## extent=0, wdall  550    149  6.931428
## extent=1, wdall  104     38  8.977783
## extent=2, wdall   13      8 13.258932
##    *restricted mean time in state (max time = 23.64722 )
## 
## [[26]]
## Call: survfit(formula = as.formula(paste("Surv(as.numeric(etime), event) ~", 
##     x)), data = data)
## 
##                   n nevent   rmean*
## extra=0, (s0)   708      0 7.291833
## extra=1, (s0)    90      0 7.203678
## extra=0, szaura 708    275 9.847654
## extra=1, szaura  90     27 8.263164
## extra=0, wdall  708    169 6.507736
## extra=1, wdall   90     26 8.180381
##    *restricted mean time in state (max time = 23.64722 )
## 
## [[27]]
## Call: survfit(formula = as.formula(paste("Surv(as.numeric(etime), event) ~", 
##     x)), data = data)
## 
##    2 observations deleted due to missingness 
##                            n nevent     rmean*
## aura_relapse=0, (s0)     696      0  8.3046033
## aura_relapse=1, (s0)      99      0  2.4142706
## aura_relapse=N/A, (s0)     1      0  0.6416667
## aura_relapse=0, szaura   696    202  7.4551047
## aura_relapse=1, szaura    99     99 21.2329516
## aura_relapse=N/A, szaura   1      1 23.0055556
## aura_relapse=0, wdall    696    195  7.8875143
## aura_relapse=1, wdall     99      0  0.0000000
## aura_relapse=N/A, wdall    1      0  0.0000000
##    *restricted mean time in state (max time = 23.64722 )
## 
## [[28]]
## Call: survfit(formula = as.formula(paste("Surv(as.numeric(etime), event) ~", 
##     x)), data = data)
## 
##    1 observation deleted due to missingness 
##                    n nevent    rmean*
## numsz6=0, (s0)    16      0  4.285417
## numsz6=1, (s0)   132      0  7.400687
## numsz6=2, (s0)   411      0  7.562342
## numsz6=3, (s0)   141      0  9.074523
## numsz6=4, (s0)    97      0  5.966578
## numsz6=0, szaura  16      0  0.000000
## numsz6=1, szaura 132     43  7.717190
## numsz6=2, szaura 411    156  9.181181
## numsz6=3, szaura 141     70 12.642736
## numsz6=4, szaura  97     33  9.118449
## numsz6=0, wdall   16      7 19.361806
## numsz6=1, wdall  132     49  8.529345
## numsz6=2, wdall  411    115  6.903699
## numsz6=3, wdall  141      7  1.929963
## numsz6=4, wdall   97     16  8.562195
##    *restricted mean time in state (max time = 23.64722 )
## 
## [[29]]
## Call: survfit(formula = as.formula(paste("Surv(as.numeric(etime), event) ~", 
##     x)), data = data)
## 
##                            n nevent    rmean*
## time_begin_cat=1, (s0)   548      0  5.845545
## time_begin_cat=2, (s0)   164      0  6.142947
## time_begin_cat=3, (s0)    86      0 14.548390
## time_begin_cat=1, szaura 548    225 10.862214
## time_begin_cat=2, szaura 164     53  8.808714
## time_begin_cat=3, szaura  86     24  5.918486
## time_begin_cat=1, wdall  548    127  6.939463
## time_begin_cat=2, wdall  164     55  8.695561
## time_begin_cat=3, wdall   86     13  3.180346
##    *restricted mean time in state (max time = 23.64722 )
## 
## [[30]]
## Call: survfit(formula = as.formula(paste("Surv(as.numeric(etime), event) ~", 
##     x)), data = data)
## 
##                       n nevent    rmean*
## drugs_cat=1, (s0)   739      0  7.395729
## drugs_cat=2, (s0)    59      0  6.288982
## drugs_cat=1, szaura 739    274  9.431099
## drugs_cat=2, szaura  59     28 12.300759
## drugs_cat=1, wdall  739    185  6.820394
## drugs_cat=2, wdall   59     10  5.057481
##    *restricted mean time in state (max time = 23.64722 )

5.3 Cumulative incidence p values

library(cmprsk)
cif_external <- cuminc(etime, event, group = data$external)
cif_external
## Tests:
##            stat           pv df
## none   28.28188 1.048732e-07  1
## szaura 15.52977 8.121619e-05  1
## wdall  48.24037 3.770428e-12  1
## Estimates and Variances:
## $est
##                   5        10        15        20
## 0 none   0.09142857 0.1800000 0.2371429 0.2771429
## 1 none   0.30803571 0.4330357 0.4375000        NA
## 0 szaura 0.25428571 0.3114286 0.3285714 0.3314286
## 1 szaura 0.39732143 0.4129464 0.4151786        NA
## 0 wdall  0.28285714 0.3600000 0.3714286 0.3714286
## 1 wdall  0.12723214 0.1406250 0.1450893        NA
## 
## $var
##                     5           10           15           20
## 0 none   0.0002373621 0.0004199459 0.0005134052 0.0005700476
## 1 none   0.0004775302 0.0005522391 0.0005543608           NA
## 0 szaura 0.0005350768 0.0005959618 0.0006108939 0.0006135251
## 1 szaura 0.0005359347 0.0005437000 0.0005476395           NA
## 0 wdall  0.0005660753 0.0006339709 0.0006413191 0.0006413191
## 1 wdall  0.0002485493 0.0002705167 0.0002801222           NA
cif_sex <- cuminc(etime, event, group = data$sex)
cif_sex
## Tests:
##             stat        pv df
## none   0.9961613 0.3182412  1
## szaura 1.9119600 0.1667457  1
## wdall  0.1187791 0.7303625  1
## Estimates and Variances:
## $est
##                  5        10        15        20
## 0 none   0.2219251 0.3262032 0.3529412 0.3850267
## 1 none   0.2051887 0.3183962 0.3466981 0.3537736
## 0 szaura 0.3181818 0.3502674 0.3556150 0.3556150
## 1 szaura 0.3490566 0.3844340 0.3962264 0.3985849
## 0 wdall  0.2058824 0.2379679 0.2486631 0.2486631
## 1 wdall  0.1863208 0.2358491 0.2405660 0.2405660
## 
## $var
##                     5           10           15           20
## 0 none   0.0004621947 0.0005872023 0.0006104933 0.0006354285
## 1 none   0.0003856131 0.0005128402 0.0005354777 0.0005414510
## 0 szaura 0.0005786349 0.0006045271 0.0006085098 0.0006085098
## 1 szaura 0.0005352355 0.0005555939 0.0005617644 0.0005638426
## 0 wdall  0.0004327646 0.0004780284 0.0004921061 0.0004921061
## 1 wdall  0.0003554203 0.0004205369 0.0004264021 0.0004264021
cif_febrile_sz <- cuminc(etime, event, group = data$febrile_sz)
## 65 cases omitted due to missing values
cif_febrile_sz
## Tests:
##             stat        pv df
## none   1.3007132 0.2540830  1
## szaura 0.7757101 0.3784564  1
## wdall  0.9960601 0.3182657  1
## Estimates and Variances:
## $est
##                  5        10        15        20
## 0 none   0.2130045 0.3251121 0.3452915 0.3542601
## 1 none   0.1324042 0.2473868 0.2926829 0.3310105
## 0 szaura 0.3408072 0.3834081 0.3901345 0.3901345
## 1 szaura 0.3205575 0.3484321 0.3623693 0.3658537
## 0 wdall  0.2062780 0.2443946 0.2488789 0.2488789
## 1 wdall  0.2195122 0.2752613 0.2891986 0.2891986
## 
## $var
##                     5           10           15           20
## 0 none   0.0003762470 0.0004922714 0.0005078810 0.0005147182
## 1 none   0.0004011818 0.0006485100 0.0007213410 0.0007748094
## 0 szaura 0.0005022611 0.0005263615 0.0005302039 0.0005302039
## 1 szaura 0.0007571406 0.0007858122 0.0007987566 0.0008029198
## 0 wdall  0.0003640813 0.0004092481 0.0004142601 0.0004142601
## 1 wdall  0.0005909751 0.0006830257 0.0007035401 0.0007035401
cif_learning_disability <-cuminc(etime, event, group = data$learning_disability)
## 63 cases omitted due to missing values
cif_learning_disability
## Tests:
##                stat         pv df
## none   0.5033108818 0.47804895  1
## szaura 0.0002223846 0.98810194  1
## wdall  3.8118442121 0.05089139  1
## Estimates and Variances:
## $est
##                  5        10        15        20
## 0 none   0.1797920 0.3001486 0.3313522 0.3521545
## 1 none   0.1935484 0.2419355 0.2580645        NA
## 0 szaura 0.3283804 0.3684993 0.3789004 0.3803863
## 1 szaura 0.3709677 0.3709677 0.3709677        NA
## 0 wdall  0.2035661 0.2481426 0.2570579 0.2570579
## 1 wdall  0.3064516 0.3548387 0.3548387        NA
## 
## $var
##                     5           10           15           20
## 0 none   0.0002190481 0.0003112593 0.0003280103 0.0003381656
## 1 none   0.0025945126 0.0030615158 0.0032611231           NA
## 0 szaura 0.0003266025 0.0003429767 0.0003464925 0.0003470632
## 1 szaura 0.0037660605 0.0037660605 0.0037660605           NA
## 0 wdall  0.0002386103 0.0002731194 0.0002792936 0.0002792936
## 1 wdall  0.0034091299 0.0036671430 0.0036671430           NA
cif_psychiatric_pre_any <-cuminc(etime, event, group = data$psychiatric_pre_any)
## 63 cases omitted due to missing values
cif_psychiatric_pre_any
## Tests:
##              stat         pv df
## none   0.03533851 0.85088809  1
## szaura 2.88299020 0.08951964  1
## wdall  0.42776432 0.51308800  1
## Estimates and Variances:
## $est
##                  5        10        15        20
## 0 none   0.1950287 0.2982792 0.3212237 0.3422562
## 1 none   0.1462264 0.2877358 0.3349057 0.3537736
## 0 szaura 0.3537285 0.3843212 0.3919694 0.3938815
## 1 szaura 0.2783019 0.3301887 0.3443396 0.3443396
## 0 wdall  0.2122371 0.2485660 0.2562141 0.2562141
## 1 wdall  0.2122642 0.2783019 0.2877358 0.2877358
## 
## $var
##                     5           10           15           20
## 0 none   0.0003003808 0.0003998162 0.0004167715 0.0004312275
## 1 none   0.0005893003 0.0009679672 0.0010549253 0.0010885175
## 0 szaura 0.0004357239 0.0004494140 0.0004525335 0.0004534516
## 1 szaura 0.0009442683 0.0010318308 0.0010545815 0.0010545815
## 0 wdall  0.0003168733 0.0003525010 0.0003595015 0.0003595015
## 1 wdall  0.0007780157 0.0009282593 0.0009471950 0.0009471950
cif_gtcs <- cuminc(etime, event, group = data$gtcs)
## 1 cases omitted due to missing values
cif_gtcs
## Tests:
##               stat           pv df
## none    0.08375214 0.7722755913  1
## szaura 11.57698620 0.0006677308  1
## wdall  10.91913122 0.0009517623  1
## Estimates and Variances:
## $est
##                  5        10        15        20
## 0 none   0.2222222 0.3290598 0.3632479 0.3760684
## 1 none   0.2095915 0.3197158 0.3445826 0.3658970
## 0 szaura 0.2521368 0.2735043 0.2905983 0.2948718
## 1 szaura 0.3694494 0.4085258 0.4138544 0.4138544
## 0 wdall  0.2649573 0.3119658 0.3162393 0.3162393
## 1 wdall  0.1651865 0.2042629 0.2131439 0.2131439
## 
## $var
##                     5           10           15           20
## 0 none   0.0007420877 0.0009503445 0.0009969207 0.0010143975
## 1 none   0.0002945196 0.0003856937 0.0004005730 0.0004126406
## 0 szaura 0.0008055425 0.0008473955 0.0008802977 0.0008892158
## 1 szaura 0.0004127011 0.0004261443 0.0004277073 0.0004277073
## 0 wdall  0.0008288068 0.0009109175 0.0009180611 0.0009180611
## 1 wdall  0.0002425932 0.0002843818 0.0002932602 0.0002932602
cif_MRI_normal <- cuminc(etime, event, group = data$MRI_normal)
cif_MRI_normal
## Tests:
##            stat          pv df
## none   3.982114 0.045985821  1
## szaura 0.744839 0.388115163  1
## wdall  7.911730 0.004911528  1
## Estimates and Variances:
## $est
##                   5        10        15        20
## 0 none   0.18987342 0.3037975 0.3347398 0.3544304
## 1 none   0.40229885 0.4712644 0.4712644        NA
## 0 szaura 0.32770745 0.3628692 0.3727145 0.3741210
## 1 szaura 0.39080460 0.4137931 0.4137931        NA
## 0 wdall  0.20956399 0.2531646 0.2616034 0.2616034
## 1 wdall  0.08045977 0.1034483 0.1034483        NA
## 
## $var
##                     5           10           15           20
## 0 none   0.0002162461 0.0002964800 0.0003119170 0.0003208549
## 1 none   0.0028501487 0.0030476120 0.0030476120           NA
## 0 szaura 0.0003086015 0.0003222186 0.0003254643 0.0003259776
## 1 szaura 0.0027911245 0.0028943304 0.0028943304           NA
## 0 wdall  0.0002302679 0.0002613018 0.0002666854 0.0002666854
## 1 wdall  0.0008754202 0.0011209221 0.0011209221           NA
cif_opside <- cuminc(etime, event, group = data$opside)
## 1 cases omitted due to missing values
cif_opside
## Tests:
##              stat          pv df
## none    0.4475162 0.799508527  2
## szaura  1.4487781 0.484620548  2
## wdall  13.0179296 0.001490021  2
## Estimates and Variances:
## $est
##                  5        10        15        20
## 0 none   0.2111111 0.3083333 0.3416667 0.3611111
## 1 none   0.2121212 0.3333333 0.3566434 0.3752914
## 2 none          NA        NA        NA        NA
## 0 szaura 0.3250000 0.3694444 0.3805556 0.3805556
## 1 szaura 0.3473193 0.3729604 0.3799534 0.3822844
## 2 szaura        NA        NA        NA        NA
## 0 wdall  0.2055556 0.2500000 0.2555556 0.2555556
## 1 wdall  0.1794872 0.2191142 0.2284382 0.2284382
## 2 wdall         NA        NA        NA        NA
## 
## $var
##                     5           10           15           20
## 0 none   0.0004643074 0.0005948617 0.0006281004 0.0006481914
## 1 none   0.0003900141 0.0005179282 0.0005346307 0.0005473575
## 2 none             NA           NA           NA           NA
## 0 szaura 0.0006084420 0.0006432247 0.0006509509 0.0006509509
## 1 szaura 0.0005274183 0.0005426534 0.0005465445 0.0005481046
## 2 szaura           NA           NA           NA           NA
## 0 wdall  0.0004508362 0.0005152075 0.0005227880 0.0005227880
## 1 wdall  0.0003404399 0.0003939414 0.0004055859 0.0004055859
## 2 wdall            NA           NA           NA           NA
cif_optemp <- cuminc(etime, event, group = data$optemp)
cif_optemp
## Tests:
##             stat           pv df
## none    8.950958 2.773240e-03  1
## szaura  5.999819 1.430735e-02  1
## wdall  26.778831 2.281226e-07  1
## Estimates and Variances:
## $est
##                  5        10        15        20
## 0 none   0.3056995 0.4300518 0.4352332 0.4378238
## 1 none   0.1262136 0.2208738 0.2694175 0.3033981
## 0 szaura 0.3860104 0.3989637 0.4015544 0.4015544
## 1 szaura 0.2864078 0.3398058 0.3543689 0.3567961
## 0 wdall  0.1373057 0.1554404 0.1580311 0.1580311
## 1 wdall  0.2500000 0.3131068 0.3252427 0.3252427
## 
## $var
##                     5           10           15           20
## 0 none   0.0005528880 0.0006415906 0.0006445088 0.0006476948
## 1 none   0.0002671882 0.0004148288 0.0004734607 0.0005095748
## 0 szaura 0.0006160945 0.0006247504 0.0006285583 0.0006285583
## 1 szaura 0.0004915518 0.0005330540 0.0005421320 0.0005437910
## 0 wdall  0.0003081383 0.0003416034 0.0003473068 0.0003473068
## 1 wdall  0.0004460407 0.0005058336 0.0005152582 0.0005152582
cif_opextent <- cuminc(etime, event, group = as.factor(data$opextent))
## 131 cases omitted due to missing values
cif_opextent
## Tests:
##             stat          pv df
## none    1.405013 0.495342221  2
## szaura  3.007815 0.222259955  2
## wdall  13.529635 0.001153658  2
## Estimates and Variances:
## $est
##                   5         10        15        20
## 0 none   0.18269231 0.26923077 0.2884615 0.3076923
## 1 none   0.17272727 0.29454545 0.3290909 0.3527273
## 2 none   0.07692308 0.07692308 0.1538462 0.1538462
## 0 szaura 0.26923077 0.31730769 0.3173077 0.3173077
## 1 szaura 0.31272727 0.35272727 0.3654545 0.3672727
## 2 szaura 0.15384615 0.15384615 0.1538462 0.1538462
## 0 wdall  0.33653846 0.36538462 0.3653846 0.3653846
## 1 wdall  0.21090909 0.26000000 0.2709091 0.2709091
## 2 wdall  0.38461538 0.61538462 0.6153846 0.6153846
## 
## $var
##                     5           10           15           20
## 0 none   0.0014560714 0.0019424832 0.0020448955 0.0021477504
## 1 none   0.0002598614 0.0003765867 0.0003998727 0.0004144389
## 2 none   0.0065071147 0.0065071147 0.0145294449 0.0145294449
## 0 szaura 0.0019009372 0.0020809437 0.0020809437 0.0020809437
## 1 szaura 0.0003891826 0.0004112616 0.0004172126 0.0004182172
## 2 szaura 0.0107248521 0.0107248521 0.0107248521 0.0107248521
## 0 wdall  0.0021444880 0.0022275226 0.0022275226 0.0022275226
## 1 wdall  0.0002992269 0.0003439346 0.0003527225 0.0003527225
## 2 wdall  0.0196005917 0.0208678501 0.0208678501 0.0208678501
cif_op_incomplete <-cuminc(etime, event, group = data$op_incomplete)
## 6 cases omitted due to missing values
cif_op_incomplete
## Tests:
##              stat           pv df
## none    0.4925243 0.4828034308  1
## szaura 12.5094831 0.0004048916  1
## wdall   2.7310401 0.0984151729  1
## Estimates and Variances:
## $est
##                  5        10        15        20
## 0 none   0.2104520 0.3192090 0.3502825 0.3714689
## 1 none   0.2380952        NA        NA        NA
## 0 szaura 0.3177966 0.3559322 0.3644068 0.3658192
## 1 szaura 0.5000000        NA        NA        NA
## 0 wdall  0.2005650 0.2443503 0.2528249 0.2528249
## 1 wdall  0.1309524        NA        NA        NA
## 
## $var
##                     5           10           15           20
## 0 none   0.0002345050 0.0003059418 0.0003201672 0.0003288399
## 1 none   0.0022309985           NA           NA           NA
## 0 szaura 0.0003049483 0.0003207755 0.0003237927 0.0003243494
## 1 szaura 0.0030366855           NA           NA           NA
## 0 wdall  0.0002240710 0.0002564887 0.0002621323 0.0002621323
## 1 wdall  0.0014045631           NA           NA           NA
cif_pathology_HS <- cuminc(etime, event, group = data$pathology_HS)
cif_pathology_HS
## Tests:
##             stat          pv df
## none   7.0435268 0.007955223  1
## szaura 0.2123191 0.644955794  1
## wdall  1.2710312 0.259573318  1
## Estimates and Variances:
## $est
##                  5        10        15        20
## 0 none   0.2817680 0.3895028 0.4033149 0.4116022
## 1 none   0.1559633 0.2660550 0.3050459 0.3325688
## 0 szaura 0.3342541 0.3591160 0.3618785 0.3618785
## 1 szaura 0.3348624 0.3761468 0.3899083 0.3922018
## 0 wdall  0.1906077 0.2182320 0.2209945 0.2209945
## 1 wdall  0.1995413 0.2522936 0.2637615 0.2637615
## 
## $var
##                     5           10           15           20
## 0 none   0.0005608081 0.0006605853 0.0006702000 0.0006762438
## 1 none   0.0003021369 0.0004469157 0.0004848716 0.0005090455
## 0 szaura 0.0006145169 0.0006348175 0.0006376935 0.0006376935
## 1 szaura 0.0005096405 0.0005341433 0.0005407775 0.0005420956
## 0 wdall  0.0004247877 0.0004692197 0.0004737956 0.0004737956
## 1 wdall  0.0003629926 0.0004261913 0.0004384268 0.0004384268
cif_pathology_FCD <- cuminc(etime, event, group = data$pathology_FCD)
cif_pathology_FCD
## Tests:
##             stat        pv df
## none   2.2953072 0.1297655  1
## szaura 0.4901014 0.4838821  1
## wdall  1.2647929 0.2607458  1
## Estimates and Variances:
## $est
##                  5        10        15        20
## 0 none   0.2082192 0.3150685 0.3452055 0.3657534
## 1 none   0.2647059        NA        NA        NA
## 0 szaura 0.3369863 0.3726027 0.3821918 0.3835616
## 1 szaura 0.3088235        NA        NA        NA
## 0 wdall  0.1904110 0.2328767 0.2410959 0.2410959
## 1 wdall  0.2500000        NA        NA        NA
## 
## $var
##                     5           10           15           20
## 0 none   0.0002258182 0.0002947382 0.0003084736 0.0003169444
## 1 none   0.0029309517           NA           NA           NA
## 0 szaura 0.0003051094 0.0003177473 0.0003206029 0.0003210621
## 1 szaura 0.0031882835           NA           NA           NA
## 0 wdall  0.0002091393 0.0002409473 0.0002465205 0.0002465205
## 1 wdall  0.0027935987           NA           NA           NA
cif_pathology_DNT <- cuminc(etime, event, group = data$pathology_DNT)
cif_pathology_DNT
## Tests:
##             stat        pv df
## none   1.6516595 0.1987332  1
## szaura 0.6662634 0.4143574  1
## wdall  4.1079170 0.0426829  1
## Estimates and Variances:
## $est
##                  5        10        15        20
## 0 none   0.2202937 0.3284379 0.3551402 0.3738318
## 1 none   0.1020408 0.2244898 0.2653061        NA
## 0 szaura 0.3391188 0.3711615 0.3791722 0.3805073
## 1 szaura 0.2653061 0.3265306 0.3469388        NA
## 0 wdall  0.1882510 0.2296395 0.2363151 0.2363151
## 1 wdall  0.3061224 0.3469388 0.3673469        NA
## 
## $var
##                     5           10           15           20
## 0 none   0.0002291830 0.0002934866 0.0003045285 0.0003116585
## 1 none   0.0019297080 0.0037985390 0.0043864797           NA
## 0 szaura 0.0002983027 0.0003095100 0.0003119071 0.0003123726
## 1 szaura 0.0040132987 0.0044809460 0.0047292936           NA
## 0 wdall  0.0002022208 0.0002328923 0.0002374171 0.0002374171
## 1 wdall  0.0043269400 0.0046278637 0.0047802859           NA
cif_pathology_CAV <-cuminc(etime, event, group = data$pathology_CAV)
## 131 cases omitted due to missing values
cif_pathology_CAV
## Tests:
##               stat         pv df
## none   0.003055019 0.95592159  1
## szaura 4.786255567 0.02868773  1
## wdall  6.147334701 0.01316103  1
## Estimates and Variances:
## $est
##                  5        10        15        20
## 0 none   0.1696574 0.2838499 0.3181077 0.3425775
## 1 none   0.2037037 0.3148148 0.3333333 0.3333333
## 0 szaura 0.3132137 0.3556281 0.3654160 0.3670473
## 1 szaura 0.1851852 0.2037037 0.2222222 0.2222222
## 0 wdall  0.2251223 0.2707993 0.2805873 0.2805873
## 1 wdall  0.3333333 0.4259259 0.4259259 0.4259259
## 
## $var
##                     5           10           15           20
## 0 none   0.0002295739 0.0003301404 0.0003520504 0.0003660921
## 1 none   0.0031004558 0.0042188532 0.0044198718 0.0044198718
## 0 szaura 0.0003489030 0.0003693205 0.0003732833 0.0003740339
## 1 szaura 0.0028548356 0.0030851795 0.0034648823 0.0034648823
## 0 wdall  0.0002806907 0.0003157924 0.0003224586 0.0003224586
## 1 wdall  0.0041990861 0.0046910702 0.0046910702 0.0046910702
cif_pathology_GL <- cuminc(etime, event, group = data$pathology_GL)
## 1 cases omitted due to missing values
cif_pathology_GL
## Tests:
##               stat           pv df
## none    0.04326611 0.8352250135  1
## szaura  0.45225154 0.5012676667  1
## wdall  11.53884254 0.0006815706  1
## Estimates and Variances:
## $est
##                  5        10        15        20
## 0 none   0.2126289 0.3247423 0.3530928 0.3724227
## 1 none   0.2380952        NA        NA        NA
## 0 szaura 0.3363402 0.3698454 0.3788660 0.3801546
## 1 szaura 0.2380952        NA        NA        NA
## 0 wdall  0.1881443 0.2306701 0.2384021 0.2384021
## 1 wdall  0.4761905        NA        NA        NA
## 
## $var
##                     5           10           15           20
## 0 none   0.0002156048 0.0002816324 0.0002931677 0.0003003056
## 1 none   0.0098640188           NA           NA           NA
## 0 szaura 0.0002866107 0.0002980077 0.0003006238 0.0003010437
## 1 szaura 0.0092354057           NA           NA           NA
## 0 wdall  0.0001949085 0.0002251842 0.0002301770 0.0002301770
## 1 wdall  0.0135823768           NA           NA           NA
cif_pathology_dual <-cuminc(etime, event, group = data$pathology_dual)
## 1 cases omitted due to missing values
cif_pathology_dual
## Tests:
##             stat        pv df
## none   0.2566191 0.6124525  1
## szaura 1.4535546 0.2279584  1
## wdall  1.7681102 0.1836161  1
## Estimates and Variances:
## $est
##                  5        10        15        20
## 0 none   0.2128778 0.3193167 0.3482260 0.3679369
## 1 none   0.2222222 0.3888889 0.3888889        NA
## 0 szaura 0.3377135 0.3731932 0.3810775 0.3823916
## 1 szaura 0.2500000 0.2500000 0.2777778        NA
## 0 wdall  0.1931669 0.2325887 0.2404731 0.2404731
## 1 wdall  0.2500000 0.3333333 0.3333333        NA
## 
## $var
##                     5           10           15           20
## 0 none   0.0002201747 0.0002848183 0.0002972438 0.0003049260
## 1 none   0.0050043739 0.0074009580 0.0074009580           NA
## 0 szaura 0.0002928358 0.0003048598 0.0003071122 0.0003075424
## 1 szaura 0.0053627887 0.0053627887 0.0069665721           NA
## 0 wdall  0.0002027476 0.0002309221 0.0002360784 0.0002360784
## 1 wdall  0.0053807631 0.0065486383 0.0065486383           NA
cif_pathology_other <-cuminc(etime, event, group = data$pathology_other)
cif_pathology_other
## Tests:
##              stat           pv df
## none   13.9605175 0.0001866903  1
## szaura  0.1114865 0.7384580609  1
## wdall   7.1476742 0.0075061264  1
## Estimates and Variances:
## $est
##                  5        10        15        20
## 0 none   0.1885370 0.2941176 0.3242836 0.3438914
## 1 none   0.3333333 0.4592593 0.4740741 0.4888889
## 0 szaura 0.3333333 0.3710407 0.3815988 0.3831071
## 1 szaura 0.3407407 0.3555556 0.3555556 0.3555556
## 0 wdall  0.2111614 0.2549020 0.2639517 0.2639517
## 1 wdall  0.1185185 0.1481481 0.1481481 0.1481481
## 
## $var
##                     5           10           15           20
## 0 none   0.0002307407 0.0003123318 0.0003295007 0.0003397440
## 1 none   0.0016681768 0.0018790293 0.0018923067 0.0019136952
## 0 szaura 0.0003337980 0.0003486264 0.0003521057 0.0003526652
## 1 szaura 0.0016801782 0.0017211740 0.0017211740 0.0017211740
## 0 wdall  0.0002482330 0.0002813832 0.0002875764 0.0002875764
## 1 wdall  0.0007826620 0.0009519109 0.0009519109 0.0009519109
cif_pathology_normal <- cuminc(etime, event, group = data$pathology_normal)
cif_pathology_normal
## Tests:
##            stat          pv df
## none   8.438626 0.003673337  1
## szaura 1.106452 0.292854399  1
## wdall  2.458371 0.116899966  1
## Estimates and Variances:
## $est
##                  5        10        15        20
## 0 none   0.2069409 0.3174807 0.3457584 0.3650386
## 1 none   0.4500000        NA        NA        NA
## 0 szaura 0.3329049 0.3663239 0.3753213 0.3766067
## 1 szaura 0.4000000        NA        NA        NA
## 0 wdall  0.1992288 0.2416452 0.2493573 0.2493573
## 1 wdall  0.0500000        NA        NA        NA
## 
## $var
##                     5           10           15           20
## 0 none   0.0002108256 0.0002775972 0.0002895995 0.0002970653
## 1 none   0.0144619842           NA           NA           NA
## 0 szaura 0.0002843015 0.0002958446 0.0002985019 0.0002989276
## 1 szaura 0.0130234748           NA           NA           NA
## 0 wdall  0.0002028756 0.0002317028 0.0002364363 0.0002364363
## 1 wdall  0.0025569236           NA           NA           NA
cif_acutepostszauras <-cuminc(etime, event, group = data$acutepostszauras)
cif_acutepostszauras
## Tests:
##             stat         pv df
## none   4.9301203 0.02639248  1
## szaura 0.1624343 0.68692516  1
## wdall  1.8144919 0.17797032  1
## Estimates and Variances:
## $est
##                  5        10        15        20
## 0 none   0.2041379 0.3117241 0.3393103 0.3572414
## 1 none   0.3013699 0.4246575 0.4520548        NA
## 0 szaura 0.3379310 0.3724138 0.3806897 0.3820690
## 1 szaura 0.3013699 0.3287671 0.3424658        NA
## 0 wdall  0.2000000 0.2427586 0.2510345 0.2510345
## 1 wdall  0.1506849 0.1780822 0.1780822        NA
## 
## $var
##                     5           10           15           20
## 0 none   0.0002239875 0.0002949061 0.0003080217 0.0003159068
## 1 none   0.0029589925 0.0034865694 0.0035823061           NA
## 0 szaura 0.0003073566 0.0003195492 0.0003220563 0.0003225327
## 1 szaura 0.0029353229 0.0031020766 0.0031945838           NA
## 0 wdall  0.0002183388 0.0002493120 0.0002547480 0.0002547480
## 1 wdall  0.0017876906 0.0020669300 0.0020669300           NA
cif_auras <- cuminc(etime, event, group = data$auras)
## 54 cases omitted due to missing values
cif_auras
## Tests:
##              stat           pv df
## none    0.0614198 8.042658e-01  1
## szaura 18.4924177 1.705816e-05  1
## wdall  12.7401823 3.578828e-04  1
## Estimates and Variances:
## $est
##                   5         10         15         20
## 0 none   0.18786982 0.30029586 0.33284024 0.35502959
## 1 none   0.20588235 0.30882353 0.30882353 0.30882353
## 0 szaura 0.30769231 0.34319527 0.35355030 0.35502959
## 1 szaura 0.55882353 0.60294118 0.60294118 0.60294118
## 0 wdall  0.22633136 0.27218935 0.28106509 0.28106509
## 1 wdall  0.04411765 0.07352941 0.07352941 0.07352941
## 
## $var
##                     5           10           15           20
## 0 none   0.0002254866 0.0003094891 0.0003268088 0.0003374884
## 1 none   0.0025070818 0.0033449868 0.0033449868 0.0033449868
## 0 szaura 0.0003138441 0.0003304676 0.0003346804 0.0003353509
## 1 szaura 0.0037051172 0.0037103535 0.0037103535 0.0037103535
## 0 wdall  0.0002561823 0.0002881831 0.0002936522 0.0002936522
## 1 wdall  0.0006343149 0.0011646965 0.0011646965 0.0011646965
cif_age_onset_ten_cat <-cuminc(etime, event, group = data$age_onset_ten_cat)
cif_age_onset_ten_cat
## Tests:
##             stat           pv df
## none   14.930471 0.0005726503  2
## szaura  0.820040 0.6636369742  2
## wdall   6.188287 0.0453138138  2
## Estimates and Variances:
## $est
##                   5        10        15        20
## 1 none   0.19569120 0.2962298 0.3249551 0.3500898
## 2 none   0.22842640 0.3451777 0.3756345 0.3807107
## 3 none   0.36363636        NA        NA        NA
## 1 szaura 0.32854578 0.3608618 0.3716338 0.3734291
## 2 szaura 0.34517766 0.3908629 0.3959391 0.3959391
## 3 szaura 0.36363636        NA        NA        NA
## 1 wdall  0.20825853 0.2567325 0.2657092 0.2657092
## 2 wdall  0.18274112 0.2131980 0.2182741 0.2182741
## 3 wdall  0.09090909        NA        NA        NA
## 
## $var
##                     5           10           15           20
## 1 none   0.0002825292 0.0003730617 0.0003921985 0.0004074828
## 2 none   0.0009048382 0.0011659881 0.0012156831 0.0012310384
## 3 none   0.0055536959           NA           NA           NA
## 1 szaura 0.0003940972 0.0004098287 0.0004144087 0.0004152770
## 2 szaura 0.0011524801 0.0012164226 0.0012302635 0.0012302635
## 3 szaura 0.0054635284           NA           NA           NA
## 1 wdall  0.0002925049 0.0003358969 0.0003430267 0.0003430267
## 2 wdall  0.0007607285 0.0008554457 0.0008732645 0.0008732645
## 3 wdall  0.0020080087           NA           NA           NA
cif_age_at_surgery_ten_cat <- cuminc(etime, event, group = data$age_at_surgery_ten_cat)
cif_age_at_surgery_ten_cat
## Tests:
##              stat           pv df
## none   13.7853937 0.0010151724  2
## szaura  0.7227131 0.6967305391  2
## wdall  21.3510527 0.0000231035  2
## Estimates and Variances:
## $est
##                  5        10        15        20
## 1 none   0.3220339 0.3898305 0.4067797        NA
## 2 none   0.1613588 0.2547771 0.2887473 0.3163482
## 3 none   0.2798507 0.4253731 0.4440299 0.4514925
## 1 szaura 0.3559322 0.3559322 0.3559322        NA
## 2 szaura 0.3184713 0.3566879 0.3694268 0.3694268
## 3 szaura 0.3582090 0.3917910 0.3955224 0.3955224
## 1 wdall  0.1694915 0.2203390 0.2203390        NA
## 2 wdall  0.2377919 0.2929936 0.3014862 0.3014862
## 3 wdall  0.1268657 0.1417910 0.1492537 0.1492537
## 
## $var
##                     5           10           15           20
## 1 none   0.0038372661 0.0043303714 0.0044797717           NA
## 2 none   0.0002873240 0.0004024634 0.0004350556 0.0004593263
## 3 none   0.0007562875 0.0009194410 0.0009314573 0.0009388803
## 1 szaura 0.0039734241 0.0039734241 0.0039734241           NA
## 2 szaura 0.0004590411 0.0004826365 0.0004894206 0.0004894206
## 3 szaura 0.0008598815 0.0008914254 0.0008967679 0.0008967679
## 1 wdall  0.0024549319 0.0030747428 0.0030747428           NA
## 2 wdall  0.0003807056 0.0004323768 0.0004392462 0.0004392462
## 3 wdall  0.0004136289 0.0004543684 0.0004763145 0.0004763145
cif_duration_ten_cat <- cuminc(etime, event, group = data$duration_ten_cat)
cif_duration_ten_cat
## Tests:
##               stat          pv df
## none   0.004334304 0.947508847  1
## szaura 4.287475003 0.038394145  1
## wdall  8.970386939 0.002743905  1
## Estimates and Variances:
## $est
##                  5        10        15        20
## 1 none   0.2199074 0.3333333 0.3611111 0.3680556
## 2 none   0.2049180 0.3087432 0.3360656 0.3688525
## 1 szaura 0.3078704 0.3310185 0.3379630 0.3402778
## 2 szaura 0.3661202 0.4125683 0.4234973 0.4234973
## 1 wdall  0.2384259 0.2824074 0.2847222 0.2847222
## 2 wdall  0.1448087 0.1830601 0.1967213 0.1967213
## 
## $var
##                     5           10           15           20
## 1 none   0.0003976487 0.0005152492 0.0005357483 0.0005406381
## 2 none   0.0004462833 0.0005832150 0.0006095689 0.0006383776
## 1 szaura 0.0004924437 0.0005108098 0.0005166460 0.0005191995
## 2 szaura 0.0006338097 0.0006588101 0.0006632498 0.0006632498
## 1 wdall  0.0004165558 0.0004635786 0.0004659554 0.0004659554
## 2 wdall  0.0003368576 0.0004046275 0.0004270968 0.0004270968
cif_extent <- cuminc(etime, event, group = data$extent)
## 131 cases omitted due to missing values
cif_extent
## Tests:
##             stat          pv df
## none    1.405013 0.495342221  2
## szaura  3.007815 0.222259955  2
## wdall  13.529635 0.001153658  2
## Estimates and Variances:
## $est
##                   5         10        15        20
## 0 none   0.17272727 0.29454545 0.3290909 0.3527273
## 1 none   0.18269231 0.26923077 0.2884615 0.3076923
## 2 none   0.07692308 0.07692308 0.1538462 0.1538462
## 0 szaura 0.31272727 0.35272727 0.3654545 0.3672727
## 1 szaura 0.26923077 0.31730769 0.3173077 0.3173077
## 2 szaura 0.15384615 0.15384615 0.1538462 0.1538462
## 0 wdall  0.21090909 0.26000000 0.2709091 0.2709091
## 1 wdall  0.33653846 0.36538462 0.3653846 0.3653846
## 2 wdall  0.38461538 0.61538462 0.6153846 0.6153846
## 
## $var
##                     5           10           15           20
## 0 none   0.0002598614 0.0003765867 0.0003998727 0.0004144389
## 1 none   0.0014560714 0.0019424832 0.0020448955 0.0021477504
## 2 none   0.0065071147 0.0065071147 0.0145294449 0.0145294449
## 0 szaura 0.0003891826 0.0004112616 0.0004172126 0.0004182172
## 1 szaura 0.0019009372 0.0020809437 0.0020809437 0.0020809437
## 2 szaura 0.0107248521 0.0107248521 0.0107248521 0.0107248521
## 0 wdall  0.0002992269 0.0003439346 0.0003527225 0.0003527225
## 1 wdall  0.0021444880 0.0022275226 0.0022275226 0.0022275226
## 2 wdall  0.0196005917 0.0208678501 0.0208678501 0.0208678501
cif_extra <- cuminc(etime, event, group = data$extra)
cif_extra
## Tests:
##             stat        pv df
## none   0.6500572 0.4200922  1
## szaura 3.1551830 0.0756862  1
## wdall  1.5415363 0.2143893  1
## Estimates and Variances:
## $est
##                  5        10        15        20
## 0 none   0.2019774 0.3163842 0.3446328 0.3658192
## 1 none   0.3000000 0.3666667 0.3888889 0.3888889
## 0 szaura 0.3432203 0.3771186 0.3870056 0.3884181
## 1 szaura 0.2666667 0.3000000 0.3000000 0.3000000
## 0 wdall  0.1892655 0.2302260 0.2387006 0.2387006
## 1 wdall  0.2444444 0.2888889 0.2888889 0.2888889
## 
## $var
##                     5           10           15           20
## 0 none   0.0002277453 0.0003049288 0.0003182230 0.0003273294
## 1 none   0.0023539336 0.0026282772 0.0027233463 0.0027233463
## 0 szaura 0.0003174142 0.0003295026 0.0003324847 0.0003329849
## 1 szaura 0.0021847138 0.0023488995 0.0023488995 0.0023488995
## 0 wdall  0.0002147314 0.0002468316 0.0002528800 0.0002528800
## 1 wdall  0.0020640771 0.0022970574 0.0022970574 0.0022970574
cif_aura_relapse <- cuminc(etime, event, group = data$aura_relapse)
## 2 cases omitted due to missing values
cif_aura_relapse
## Tests:
##             stat           pv df
## none    29.71844 3.521460e-07  2
## szaura 266.15749 0.000000e+00  2
## wdall   30.77503 2.076284e-07  2
## Estimates and Variances:
## $est
##                    5        10        15        20
## 0 none     0.2428161 0.3663793 0.3979885 0.4195402
## 1 none     0.0000000 0.0000000 0.0000000        NA
## N/A none          NA        NA        NA        NA
## 0 szaura   0.2586207 0.2859195 0.2902299 0.2902299
## 1 szaura   0.8686869 0.9494949 0.9898990        NA
## N/A szaura        NA        NA        NA        NA
## 0 wdall    0.2241379 0.2715517 0.2801724 0.2801724
## 1 wdall    0.0000000 0.0000000 0.0000000        NA
## N/A wdall         NA        NA        NA        NA
## 
## $var
##                       5           10           15           20
## 0 none     0.0002640172 0.0003324211 0.0003428708 0.0003491022
## 1 none     0.0000000000 0.0000000000 0.0000000000           NA
## N/A none             NA           NA           NA           NA
## 0 szaura   0.0002747781 0.0002915346 0.0002940291 0.0002940291
## 1 szaura   0.0012016215 0.0005364062 0.0001667079           NA
## N/A szaura           NA           NA           NA           NA
## 0 wdall    0.0002475771 0.0002800800 0.0002852853 0.0002852853
## 1 wdall    0.0000000000 0.0000000000 0.0000000000           NA
## N/A wdall            NA           NA           NA           NA
cif_numsz6  <- cuminc(etime, event, group = data$numsz6)
## 1 cases omitted due to missing values
cif_numsz6
## Tests:
##            stat           pv df
## none   39.17272 6.416981e-08  4
## szaura 28.46667 1.003080e-05  4
## wdall  43.07731 9.972606e-09  4
## Estimates and Variances:
## $est
##                   5         10        15        20
## 0 none   0.56250000         NA        NA        NA
## 1 none   0.12878788 0.22727273 0.2727273        NA
## 2 none   0.16058394 0.26034063 0.2968370 0.3236010
## 3 none   0.30496454 0.44680851        NA        NA
## 4 none   0.36082474 0.49484536        NA        NA
## 0 szaura 0.00000000         NA        NA        NA
## 1 szaura 0.26515152 0.31818182 0.3181818        NA
## 2 szaura 0.32116788 0.36253041 0.3795620 0.3795620
## 3 szaura 0.48936170 0.49645390        NA        NA
## 4 szaura 0.31958763 0.34020619        NA        NA
## 0 wdall  0.37500000         NA        NA        NA
## 1 wdall  0.28787879 0.35606061 0.3712121        NA
## 2 wdall  0.22141119 0.27250608 0.2798054 0.2798054
## 3 wdall  0.04255319 0.04964539        NA        NA
## 4 wdall  0.14432990 0.15463918        NA        NA
## 
## $var
##                     5           10           15           20
## 0 none   0.0184217228           NA           NA           NA
## 1 none   0.0008558277 0.0013337443 0.0015131006           NA
## 2 none   0.0003281352 0.0004676260 0.0005068051 0.0005325854
## 3 none   0.0015322450 0.0018165307           NA           NA
## 4 none   0.0024412038 0.0027097985           NA           NA
## 0 szaura 0.0000000000           NA           NA           NA
## 1 szaura 0.0014667261 0.0016108379 0.0016108379           NA
## 2 szaura 0.0005275174 0.0005560050 0.0005658017 0.0005658017
## 3 szaura 0.0017939660 0.0018006937           NA           NA
## 4 szaura 0.0022765488 0.0023636398           NA           NA
## 0 wdall  0.0183515439           NA           NA           NA
## 1 wdall  0.0015364468 0.0016924880 0.0017241319           NA
## 2 wdall  0.0004134747 0.0004726656 0.0004802205 0.0004802205
## 3 wdall  0.0002965845 0.0003450226           NA           NA
## 4 wdall  0.0013023571 0.0013860251           NA           NA
cif_time_begin_cat <- cuminc(etime, event, group = data$time_begin_cat)
cif_time_begin_cat
## Tests:
##              stat          pv df
## none    0.9735549 0.614603796  2
## szaura 11.4806376 0.003213744  2
## wdall  11.6027216 0.003023438  2
## Estimates and Variances:
## $est
##                   5        10        15        20
## 1 none   0.24087591 0.3321168 0.3521898        NA
## 2 none   0.19512195 0.3109756 0.3414634        NA
## 3 none   0.06976744 0.2790698 0.3488372 0.4883721
## 1 szaura 0.38321168 0.4087591 0.4105839        NA
## 2 szaura 0.26219512 0.3109756 0.3170732        NA
## 3 szaura 0.16279070 0.2209302 0.2790698 0.2790698
## 1 wdall  0.20437956 0.2262774 0.2317518        NA
## 2 wdall  0.26829268 0.3292683 0.3353659        NA
## 3 wdall  0.00000000 0.1279070 0.1511628 0.1511628
## 
## $var
##                     5           10           15          20
## 1 none   0.0003337620 0.0004045552 0.0004170454          NA
## 2 none   0.0009632553 0.0013149311 0.0013917662          NA
## 3 none   0.0007655603 0.0023799439 0.0026957653 0.003000155
## 1 szaura 0.0004290111 0.0004370058 0.0004383205          NA
## 2 szaura 0.0011827779 0.0013033537 0.0013288159          NA
## 3 szaura 0.0016050225 0.0020309352 0.0023837253 0.002383725
## 1 wdall  0.0002930642 0.0003143360 0.0003197223          NA
## 2 wdall  0.0011914861 0.0013315565 0.0013437890          NA
## 3 wdall  0.0000000000 0.0013222154 0.0015235488 0.001523549
cif_drugs_cat <- cuminc(etime, event, group = data$drugs_cat)
cif_drugs_cat
## Tests:
##              stat         pv df
## none   0.05302614 0.81787882  1
## szaura 3.04447643 0.08101223  1
## wdall  1.70934016 0.19107100  1
## Estimates and Variances:
## $est
##                  5        10        15        20
## 1 none   0.2083897 0.3234100 0.3491204 0.3694181
## 2 none   0.2711864 0.3050847        NA        NA
## 1 szaura 0.3261164 0.3599459 0.3694181 0.3707713
## 2 szaura 0.4406780 0.4745763        NA        NA
## 1 wdall  0.1975643 0.2422192 0.2503383 0.2503383
## 2 wdall  0.1694915 0.1694915        NA        NA
## 
## $var
##                     5           10           15           20
## 1 none   0.0002230811 0.0002950021 0.0003061562 0.0003141779
## 2 none   0.0035166783 0.0038474078           NA           NA
## 1 szaura 0.0002963427 0.0003093162 0.0003124374 0.0003129322
## 2 szaura 0.0042753571 0.0043749685           NA           NA
## 1 wdall  0.0002124771 0.0002445530 0.0002497874 0.0002497874
## 2 wdall  0.0024605738 0.0024605738           NA           NA

5.4 Cumulative incidence curves

plot(cif_time_begin_cat, col = 1:9)

mfit2 <-
  survfit(Surv(as.numeric(etime), event) ~ as.factor(time_begin_cat), data =
            data)
print(mfit2)
## Call: survfit(formula = Surv(as.numeric(etime), event) ~ as.factor(time_begin_cat), 
##     data = data)
## 
##                                       n nevent    rmean*
## as.factor(time_begin_cat)=1, (s0)   548      0  5.845545
## as.factor(time_begin_cat)=2, (s0)   164      0  6.142947
## as.factor(time_begin_cat)=3, (s0)    86      0 14.548390
## as.factor(time_begin_cat)=1, szaura 548    225 10.862214
## as.factor(time_begin_cat)=2, szaura 164     53  8.808714
## as.factor(time_begin_cat)=3, szaura  86     24  5.918486
## as.factor(time_begin_cat)=1, wdall  548    127  6.939463
## as.factor(time_begin_cat)=2, wdall  164     55  8.695561
## as.factor(time_begin_cat)=3, wdall   86     13  3.180346
##    *restricted mean time in state (max time = 23.64722 )
plot(
  mfit2,
  ylim = c(0, 1),
  col = c(1, 2, 3, 4, 1, 2, 3, 4),
  lty = c(1, 1, 1, 2, 2, 2, 3, 3, 3),
  mark.time = FALSE,
  lwd = 2,
  xscale = 12,
  noplot = NULL,
  xlab = "Years post wd",
  ylab = "Probability in State"
)
legend(
  18,
  .9,
  c(
    "non:0-2",
    "non:2-4",
    "non:4-",
    "sz:0-2",
    "sz:2-4",
    "sz:4-",
    "wd:0-2",
    "wd:2-4",
    "wd:4-"
  ),
  col = c(1, 2, 3, 4, 1, 2, 3, 4),
  lty = c(1, 1, 1, 2, 2, 2, 3, 3, 3),
  lwd = 2,
  bty = 'n'
)

mfit3 <- survfit(Surv(as.numeric(etime), event) ~ sex, data = data)
print(mfit3)
## Call: survfit(formula = Surv(as.numeric(etime), event) ~ sex, data = data)
## 
##                 n nevent    rmean*
## sex=0, (s0)   374      0  7.915595
## sex=1, (s0)   424      0  6.615008
## sex=0, szaura 374    133  8.975504
## sex=1, szaura 424    169 10.356667
## sex=0, wdall  374     93  6.756124
## sex=1, wdall  424    102  6.675548
##    *restricted mean time in state (max time = 23.64722 )
plot(
  mfit3,
  ylim = c(0, 1),
  col = c(1, 2, 3, 1, 2, 3),
  lty = c(1, 1, 2, 2, 3, 3),
  mark.time = FALSE,
  lwd = 2,
  xscale = 12,
  noplot = NULL,
  xlab = "Years post wd",
  ylab = "Probability in State"
)
legend(
  18,
  1.0,
  c("none:m", "none:f", "sz:m", "sz:f", "wd:m", "wd:f"),
  col = c(1, 2, 3, 1, 2, 3),
  lty = c(1, 1, 2, 2, 3, 3),
  lwd = 2,
  bty = 'n'
)

mfit4 <- survfit(Surv(as.numeric(etime), event) ~ auras, data = data)
print(mfit4)
## Call: survfit(formula = Surv(as.numeric(etime), event) ~ auras, data = data)
## 
##    54 observations deleted due to missingness 
##                   n nevent    rmean*
## auras=0, (s0)   676      0  7.453676
## auras=1, (s0)    68      0  4.894606
## auras=0, szaura 676    240  8.872702
## auras=1, szaura  68     41 15.950184
## auras=0, wdall  676    190  7.320843
## auras=1, wdall   68      5  2.802432
##    *restricted mean time in state (max time = 23.64722 )
plot(
  mfit4,
  ylim = c(0, 1),
  col = c(1, 2, 3, 1, 2, 3),
  lty = c(1, 1, 2, 2, 3, 3),
  mark.time = FALSE,
  lwd = 2,
  xscale = 12,
  noplot = NULL,
  xlab = "Years post wd",
  ylab = "Probability in State"
)
legend(
  18,
  1.0,
  c("none:noaura", "none:aura", "sz:noaura", "sz:auras", "wd:noaura", "wd:auras"),
  col = c(1, 2, 3, 1, 2, 3),
  lty = c(1, 1, 2, 2, 3, 3),
  lwd = 2,
  bty = 'n'
)

mfit5 <- survfit(Surv(as.numeric(etime), event) ~ gtcs, data = data)
print(mfit5)
## Call: survfit(formula = Surv(as.numeric(etime), event) ~ gtcs, data = data)
## 
##    1 observation deleted due to missingness 
##                  n nevent    rmean*
## gtcs=0, (s0)   234      0  7.690958
## gtcs=1, (s0)   563      0  7.165633
## gtcs=0, szaura 234     69  7.705062
## gtcs=1, szaura 563    233 10.443566
## gtcs=0, wdall  234     74  8.251202
## gtcs=1, wdall  563    120  6.038023
##    *restricted mean time in state (max time = 23.64722 )
plot(
  mfit5,
  ylim = c(0, 1),
  col = c(1, 2, 3, 1, 2, 3),
  lty = c(1, 1, 2, 2, 3, 3),
  mark.time = FALSE,
  lwd = 2,
  xscale = 12,
  noplot = NULL,
  xlab = "Years post wd",
  ylab = "Probability in State"
)
legend(
  18,
  1.0,
  c("none:nogtcs", "none:gtcs", "sz:nogtcs", "sz:gtcs", "wd:nogtcs", "wd:gtcs"),
  col = c(1, 2, 3, 1, 2, 3),
  lty = c(1, 1, 2, 2, 3, 3),
  lwd = 2,
  bty = 'n'
)

mfit6 <- survfit(Surv(as.numeric(etime), event) ~ extra, data = data)
print(mfit6)
## Call: survfit(formula = Surv(as.numeric(etime), event) ~ extra, data = data)
## 
##                   n nevent   rmean*
## extra=0, (s0)   708      0 7.291833
## extra=1, (s0)    90      0 7.203678
## extra=0, szaura 708    275 9.847654
## extra=1, szaura  90     27 8.263164
## extra=0, wdall  708    169 6.507736
## extra=1, wdall   90     26 8.180381
##    *restricted mean time in state (max time = 23.64722 )
plot(
  mfit6,
  ylim = c(0, 1),
  col = c(1, 2, 3, 1, 2, 3),
  lty = c(1, 1, 2, 2, 3, 3),
  mark.time = FALSE,
  lwd = 2,
  xscale = 12,
  noplot = NULL,
  xlab = "Years post wd",
  ylab = "Probability in State"
)
legend(
  18,
  1.0,
  c("none:tempsurgery", "none:extratemp", "sz:tempsurgery", "sz:extratemp", "wd:tempsurgery", "wd:extratemp"),
  col = c(1, 2, 3, 1, 2, 3),
  lty = c(1, 1, 2, 2, 3, 3),
  lwd = 2,
  bty = 'n'
)

5.5 Cause specific hazard regression - estimates and p values for each predictor and competing outcome (1:2 -> relapse, 1:3-> wdall)

library(prodlim)
library(riskRegression)
## riskRegression version 2022.03.09
cs <- lapply(list, function(x)
  coxph(as.formula(
    paste("Surv(as.numeric(etime), event) ~", x)
  ),  data = data, id = id_wams))
## Warning in coxph.fit(X, Y, istrat, offset, init, control, weights = weights, :
## Loglik converged before variable 3,4 ; coefficient may be infinite.
cs
## [[1]]
## Call:
## coxph(formula = as.formula(paste("Surv(as.numeric(etime), event) ~", 
##     x)), data = data, id = id_wams)
## 
##           
## 1:2          coef exp(coef) se(coef) robust se     z       p
##   external 0.7782    2.1775   0.1229    0.1151 6.758 1.4e-11
## 
##           
## 1:3           coef exp(coef) se(coef) robust se      z     p
##   external -0.1588    0.8532   0.1551    0.1530 -1.038 0.299
## 
##  States:  1= (s0), 2= szaura, 3= wdall 
## 
## Likelihood ratio test=42.88  on 2 df, p=4.889e-10
## n= 798, number of events= 497 
## 
## [[2]]
## Call:
## coxph(formula = as.formula(paste("Surv(as.numeric(etime), event) ~", 
##     x)), data = data, id = id_wams)
## 
##      
## 1:2     coef exp(coef) se(coef) robust se     z     p
##   sex 0.1459    1.1571   0.1161    0.1159 1.259 0.208
## 
##      
## 1:3       coef exp(coef) se(coef) robust se      z     p
##   sex -0.01386   0.98624  0.14360   0.14382 -0.096 0.923
## 
##  States:  1= (s0), 2= szaura, 3= wdall 
## 
## Likelihood ratio test=1.6  on 2 df, p=0.4499
## n= 798, number of events= 497 
## 
## [[3]]
## Call:
## coxph(formula = as.formula(paste("Surv(as.numeric(etime), event) ~", 
##     x)), data = data, id = id_wams)
## 
##             
## 1:2             coef exp(coef) se(coef) robust se      z      p
##   febrile_sz -0.2511    0.7780   0.1243    0.1242 -2.022 0.0432
## 
##             
## 1:3             coef exp(coef) se(coef) robust se      z    p
##   febrile_sz -0.1437    0.8661   0.1459    0.1444 -0.995 0.32
## 
##  States:  1= (s0), 2= szaura, 3= wdall 
## 
## Likelihood ratio test=5.13  on 2 df, p=0.0769
## n= 733, number of events= 473 
##    (65 observations deleted due to missingness)
## 
## [[4]]
## Call:
## coxph(formula = as.formula(paste("Surv(as.numeric(etime), event) ~", 
##     x)), data = data, id = id_wams)
## 
##                      
## 1:2                     coef exp(coef) se(coef) robust se     z     p
##   learning_disability 0.2213    1.2477   0.2184    0.2217 0.998 0.318
## 
##                      
## 1:3                     coef exp(coef) se(coef) robust se     z        p
##   learning_disability 0.8118    2.2520   0.2276    0.2400 3.383 0.000716
## 
##  States:  1= (s0), 2= szaura, 3= wdall 
## 
## Likelihood ratio test=11.35  on 2 df, p=0.003431
## n= 735, number of events= 474 
##    (63 observations deleted due to missingness)
## 
## [[5]]
## Call:
## coxph(formula = as.formula(paste("Surv(as.numeric(etime), event) ~", 
##     x)), data = data, id = id_wams)
## 
##                      
## 1:2                      coef exp(coef) se(coef) robust se      z      p
##   psychiatric_pre_any -0.3369    0.7140   0.1366    0.1329 -2.536 0.0112
## 
##                      
## 1:3                      coef exp(coef) se(coef) robust se      z     p
##   psychiatric_pre_any -0.2047    0.8149   0.1548    0.1512 -1.354 0.176
## 
##  States:  1= (s0), 2= szaura, 3= wdall 
## 
## Likelihood ratio test=8.19  on 2 df, p=0.01666
## n= 735, number of events= 474 
##    (63 observations deleted due to missingness)
## 
## [[6]]
## Call:
## coxph(formula = as.formula(paste("Surv(as.numeric(etime), event) ~", 
##     x)), data = data, id = id_wams)
## 
##       
## 1:2      coef exp(coef) se(coef) robust se     z       p
##   gtcs 0.4200    1.5220   0.1371    0.1334 3.148 0.00165
## 
##       
## 1:3       coef exp(coef) se(coef) robust se      z      p
##   gtcs -0.3050    0.7371   0.1479    0.1506 -2.026 0.0428
## 
##  States:  1= (s0), 2= szaura, 3= wdall 
## 
## Likelihood ratio test=14.22  on 2 df, p=0.0008157
## n= 797, number of events= 496 
##    (1 observation deleted due to missingness)
## 
## [[7]]
## Call:
## coxph(formula = as.formula(paste("Surv(as.numeric(etime), event) ~", 
##     x)), data = data, id = id_wams)
## 
##              
## 1:2             coef exp(coef) se(coef) robust se     z      p
##   MRI_normal1 0.3210    1.3785   0.1787    0.1757 1.827 0.0676
## 
##              
## 1:3              coef exp(coef) se(coef) robust se      z     p
##   MRI_normal1 -0.4685    0.6259   0.3426    0.3367 -1.391 0.164
## 
##  States:  1= (s0), 2= szaura, 3= wdall 
## 
## Likelihood ratio test=5.14  on 2 df, p=0.0766
## n= 798, number of events= 497 
## 
## [[8]]
## Call:
## coxph(formula = as.formula(paste("Surv(as.numeric(etime), event) ~", 
##     x)), data = data, id = id_wams)
## 
##         
## 1:2           coef exp(coef)  se(coef) robust se      z     p
##   opside -0.007784  0.992246  0.111922  0.110078 -0.071 0.944
## 
##         
## 1:3         coef exp(coef) se(coef) robust se     z    p
##   opside 0.03371   1.03428  0.14095   0.14825 0.227 0.82
## 
##  States:  1= (s0), 2= szaura, 3= wdall 
## 
## Likelihood ratio test=0.06  on 2 df, p=0.9694
## n= 797, number of events= 497 
##    (1 observation deleted due to missingness)
## 
## [[9]]
## Call:
## coxph(formula = as.formula(paste("Surv(as.numeric(etime), event) ~", 
##     x)), data = data, id = id_wams)
## 
##         
## 1:2         coef exp(coef) se(coef) robust se      z        p
##   optemp -0.5367    0.5846   0.1179    0.1150 -4.668 3.04e-06
## 
##         
## 1:3        coef exp(coef) se(coef) robust se     z     p
##   optemp 0.0845    1.0882   0.1569    0.1562 0.541 0.588
## 
##  States:  1= (s0), 2= szaura, 3= wdall 
## 
## Likelihood ratio test=20.98  on 2 df, p=2.787e-05
## n= 798, number of events= 497 
## 
## [[10]]
## Call:
## coxph(formula = as.formula(paste("Surv(as.numeric(etime), event) ~", 
##     x)), data = data, id = id_wams)
## 
##                       
## 1:2                        coef exp(coef) se(coef) robust se      z     p
##   as.factor(opextent)1  0.03236   1.03289  0.18811   0.18823  0.172 0.864
##   as.factor(opextent)2 -0.88497   0.41273  0.72866   0.74644 -1.186 0.236
## 
##                       
## 1:3                       coef exp(coef) se(coef) robust se      z       p
##   as.factor(opextent)1 -0.5256    0.5912   0.1823    0.1947 -2.699 0.00695
##   as.factor(opextent)2  0.2615    1.2988   0.3899    0.4384  0.596 0.55092
## 
##  States:  1= (s0), 2= szaura, 3= wdall 
## 
## Likelihood ratio test=12.85  on 4 df, p=0.01202
## n= 667, number of events= 432 
##    (131 observations deleted due to missingness)
## 
## [[11]]
## Call:
## coxph(formula = as.formula(paste("Surv(as.numeric(etime), event) ~", 
##     x)), data = data, id = id_wams)
## 
##                
## 1:2               coef exp(coef) se(coef) robust se     z        p
##   op_incomplete 0.7489    2.1147   0.1675    0.1860 4.026 5.66e-05
## 
##                
## 1:3               coef exp(coef) se(coef) robust se     z     p
##   op_incomplete 0.2123    1.2365   0.2886    0.2730 0.778 0.437
## 
##  States:  1= (s0), 2= szaura, 3= wdall 
## 
## Likelihood ratio test=17.27  on 2 df, p=0.0001777
## n= 792, number of events= 493 
##    (6 observations deleted due to missingness)
## 
## [[12]]
## Call:
## coxph(formula = as.formula(paste("Surv(as.numeric(etime), event) ~", 
##     x)), data = data, id = id_wams)
## 
##               
## 1:2               coef exp(coef) se(coef) robust se      z     p
##   pathology_HS -0.1283    0.8796   0.1171    0.1174 -1.093 0.274
## 
##               
## 1:3               coef exp(coef) se(coef) robust se      z     p
##   pathology_HS -0.2058    0.8140   0.1470    0.1468 -1.402 0.161
## 
##  States:  1= (s0), 2= szaura, 3= wdall 
## 
## Likelihood ratio test=3.13  on 2 df, p=0.2093
## n= 798, number of events= 497 
## 
## [[13]]
## Call:
## coxph(formula = as.formula(paste("Surv(as.numeric(etime), event) ~", 
##     x)), data = data, id = id_wams)
## 
##                
## 1:2                 coef exp(coef) se(coef) robust se      z     p
##   pathology_FCD -0.02456   0.97574  0.22229   0.21985 -0.112 0.911
## 
##                
## 1:3               coef exp(coef) se(coef) robust se     z      p
##   pathology_FCD 0.5084    1.6627   0.2438    0.2459 2.068 0.0387
## 
##  States:  1= (s0), 2= szaura, 3= wdall 
## 
## Likelihood ratio test=3.83  on 2 df, p=0.1472
## n= 798, number of events= 497 
## 
## [[14]]
## Call:
## coxph(formula = as.formula(paste("Surv(as.numeric(etime), event) ~", 
##     x)), data = data, id = id_wams)
## 
##                
## 1:2                coef exp(coef) se(coef) robust se      z     p
##   pathology_DNT -0.2665    0.7661   0.2498    0.2314 -1.152 0.249
## 
##                
## 1:3               coef exp(coef) se(coef) robust se     z     p
##   pathology_DNT 0.1901    1.2094   0.2476    0.2454 0.775 0.438
## 
##  States:  1= (s0), 2= szaura, 3= wdall 
## 
## Likelihood ratio test=1.79  on 2 df, p=0.4081
## n= 798, number of events= 497 
## 
## [[15]]
## Call:
## coxph(formula = as.formula(paste("Surv(as.numeric(etime), event) ~", 
##     x)), data = data, id = id_wams)
## 
##                
## 1:2                coef exp(coef) se(coef) robust se      z      p
##   pathology_CAV -0.5083    0.6015   0.2963    0.2854 -1.781 0.0749
## 
##                
## 1:3               coef exp(coef) se(coef) robust se     z      p
##   pathology_CAV 0.4281    1.5344   0.2221    0.2287 1.872 0.0611
## 
##  States:  1= (s0), 2= szaura, 3= wdall 
## 
## Likelihood ratio test=6.77  on 2 df, p=0.03386
## n= 667, number of events= 432 
##    (131 observations deleted due to missingness)
## 
## [[16]]
## Call:
## coxph(formula = as.formula(paste("Surv(as.numeric(etime), event) ~", 
##     x)), data = data, id = id_wams)
## 
##               
## 1:2                coef exp(coef) se(coef) robust se     z     p
##   pathology_GL -0.02723   0.97313  0.41314   0.38714 -0.07 0.944
## 
##               
## 1:3              coef exp(coef) se(coef) robust se     z        p
##   pathology_GL 1.4389    4.2162   0.3288    0.3282 4.384 1.17e-05
## 
##  States:  1= (s0), 2= szaura, 3= wdall 
## 
## Likelihood ratio test=13.07  on 2 df, p=0.001451
## n= 797, number of events= 496 
##    (1 observation deleted due to missingness)
## 
## [[17]]
## Call:
## coxph(formula = as.formula(paste("Surv(as.numeric(etime), event) ~", 
##     x)), data = data, id = id_wams)
## 
##                 
## 1:2                 coef exp(coef) se(coef) robust se      z     p
##   pathology_dual -0.2981    0.7423   0.3217    0.3145 -0.948 0.343
## 
##                 
## 1:3                coef exp(coef) se(coef) robust se     z     p
##   pathology_dual 0.4091    1.5055   0.2982    0.3015 1.357 0.175
## 
##  States:  1= (s0), 2= szaura, 3= wdall 
## 
## Likelihood ratio test=2.62  on 2 df, p=0.2702
## n= 797, number of events= 496 
##    (1 observation deleted due to missingness)
## 
## [[18]]
## Call:
## coxph(formula = as.formula(paste("Surv(as.numeric(etime), event) ~", 
##     x)), data = data, id = id_wams)
## 
##                  
## 1:2                  coef exp(coef) se(coef) robust se     z     p
##   pathology_other 0.07141   1.07402  0.15774   0.16032 0.445 0.656
## 
##                  
## 1:3                  coef exp(coef) se(coef) robust se      z     p
##   pathology_other -0.3200    0.7262   0.2364    0.2414 -1.325 0.185
## 
##  States:  1= (s0), 2= szaura, 3= wdall 
## 
## Likelihood ratio test=2.19  on 2 df, p=0.3337
## n= 798, number of events= 497 
## 
## [[19]]
## Call:
## coxph(formula = as.formula(paste("Surv(as.numeric(etime), event) ~", 
##     x)), data = data, id = id_wams)
## 
##                   
## 1:2                  coef exp(coef) se(coef) robust se     z      p
##   pathology_normal 0.6281    1.8741   0.3395    0.3352 1.874 0.0609
## 
##                   
## 1:3                   coef exp(coef) se(coef) robust se      z     p
##   pathology_normal -0.7863    0.4555   1.0031    1.0693 -0.735 0.462
## 
##  States:  1= (s0), 2= szaura, 3= wdall 
## 
## Likelihood ratio test=3.65  on 2 df, p=0.1613
## n= 798, number of events= 497 
## 
## [[20]]
## Call:
## coxph(formula = as.formula(paste("Surv(as.numeric(etime), event) ~", 
##     x)), data = data, id = id_wams)
## 
##                   
## 1:2                    coef exp(coef) se(coef) robust se      z     p
##   acutepostszauras -0.07058   0.93186  0.20886   0.21739 -0.325 0.745
## 
##                   
## 1:3                   coef exp(coef) se(coef) robust se     z     p
##   acutepostszauras -0.3060    0.7364   0.2871    0.2915 -1.05 0.294
## 
##  States:  1= (s0), 2= szaura, 3= wdall 
## 
## Likelihood ratio test=1.36  on 2 df, p=0.507
## n= 798, number of events= 497 
## 
## [[21]]
## Call:
## coxph(formula = as.formula(paste("Surv(as.numeric(etime), event) ~", 
##     x)), data = data, id = id_wams)
## 
##        
## 1:2       coef exp(coef) se(coef) robust se     z        p
##   auras 0.7562    2.1302   0.1697    0.1708 4.428 9.51e-06
## 
##        
## 1:3        coef exp(coef) se(coef) robust se      z      p
##   auras -1.0561    0.3478   0.4535    0.4399 -2.401 0.0164
## 
##  States:  1= (s0), 2= szaura, 3= wdall 
## 
## Likelihood ratio test=24.36  on 2 df, p=5.13e-06
## n= 744, number of events= 476 
##    (54 observations deleted due to missingness)
## 
## [[22]]
## Call:
## coxph(formula = as.formula(paste("Surv(as.numeric(etime), event) ~", 
##     x)), data = data, id = id_wams)
## 
##                    
## 1:2                    coef exp(coef) se(coef) robust se     z     p
##   age_onset_ten_cat 0.15101   1.16301  0.09875   0.10083 1.498 0.134
## 
##                    
## 1:3                    coef exp(coef) se(coef) robust se      z     p
##   age_onset_ten_cat -0.1313    0.8770   0.1432    0.1400 -0.938 0.348
## 
##  States:  1= (s0), 2= szaura, 3= wdall 
## 
## Likelihood ratio test=3.12  on 2 df, p=0.2101
## n= 798, number of events= 497 
## 
## [[23]]
## Call:
## coxph(formula = as.formula(paste("Surv(as.numeric(etime), event) ~", 
##     x)), data = data, id = id_wams)
## 
##                         
## 1:2                         coef exp(coef) se(coef) robust se     z     p
##   age_at_surgery_ten_cat 0.08954   1.09367  0.10225   0.10442 0.858 0.391
## 
##                         
## 1:3                         coef exp(coef) se(coef) robust se      z       p
##   age_at_surgery_ten_cat -0.3589    0.6985   0.1318    0.1215 -2.954 0.00314
## 
##  States:  1= (s0), 2= szaura, 3= wdall 
## 
## Likelihood ratio test=8.22  on 2 df, p=0.0164
## n= 798, number of events= 497 
## 
## [[24]]
## Call:
## coxph(formula = as.formula(paste("Surv(as.numeric(etime), event) ~", 
##     x)), data = data, id = id_wams)
## 
##                   
## 1:2                  coef exp(coef) se(coef) robust se     z     p
##   duration_ten_cat 0.1365    1.1463   0.1154    0.1149 1.188 0.235
## 
##                   
## 1:3                   coef exp(coef) se(coef) robust se      z       p
##   duration_ten_cat -0.5329    0.5869   0.1488    0.1477 -3.607 0.00031
## 
##  States:  1= (s0), 2= szaura, 3= wdall 
## 
## Likelihood ratio test=14.69  on 2 df, p=0.0006469
## n= 798, number of events= 497 
## 
## [[25]]
## Call:
## coxph(formula = as.formula(paste("Surv(as.numeric(etime), event) ~", 
##     x)), data = data, id = id_wams)
## 
##         
## 1:2         coef exp(coef) se(coef) robust se     z     p
##   extent -0.1517    0.8592   0.1610    0.1581 -0.96 0.337
## 
##         
## 1:3        coef exp(coef) se(coef) robust se     z       p
##   extent 0.4562    1.5780   0.1322    0.1453 3.139 0.00169
## 
##  States:  1= (s0), 2= szaura, 3= wdall 
## 
## Likelihood ratio test=11.19  on 2 df, p=0.003719
## n= 667, number of events= 432 
##    (131 observations deleted due to missingness)
## 
## [[26]]
## Call:
## coxph(formula = as.formula(paste("Surv(as.numeric(etime), event) ~", 
##     x)), data = data, id = id_wams)
## 
##        
## 1:2        coef exp(coef) se(coef) robust se      z     p
##   extra -0.2347    0.7908   0.2020    0.1943 -1.208 0.227
## 
##        
## 1:3       coef exp(coef) se(coef) robust se     z     p
##   extra 0.3320    1.3938   0.2114    0.2186 1.519 0.129
## 
##  States:  1= (s0), 2= szaura, 3= wdall 
## 
## Likelihood ratio test=3.72  on 2 df, p=0.156
## n= 798, number of events= 497 
## 
## [[27]]
## Call:
## coxph(formula = as.formula(paste("Surv(as.numeric(etime), event) ~", 
##     x)), data = data, id = id_wams)
## 
##                  
## 1:2                  coef exp(coef) se(coef) robust se     z      p
##   aura_relapse1    1.7152    5.5580   0.1237    0.1153 14.88 <2e-16
##   aura_relapseN/A  2.3900   10.9138   1.0062    0.1106 21.61 <2e-16
## 
##                  
## 1:3                     coef  exp(coef)   se(coef)  robust se      z      p
##   aura_relapse1   -1.661e+01  6.109e-08  1.044e+03  1.967e-01 -84.44 <2e-16
##   aura_relapseN/A -1.665e+01  5.856e-08  3.963e+04  1.069e+00 -15.58 <2e-16
## 
##  States:  1= (s0), 2= szaura, 3= wdall 
## 
## Likelihood ratio test=180.2  on 4 df, p=< 2.2e-16
## n= 796, number of events= 497 
##    (2 observations deleted due to missingness)
## 
## [[28]]
## Call:
## coxph(formula = as.formula(paste("Surv(as.numeric(etime), event) ~", 
##     x)), data = data, id = id_wams)
## 
##         
## 1:2         coef exp(coef) se(coef) robust se     z        p
##   numsz6 0.26309   1.30094  0.06248   0.05923 4.442 8.91e-06
## 
##         
## 1:3          coef exp(coef) se(coef) robust se     z      p
##   numsz6 -0.25295   0.77651  0.09241   0.09921 -2.55 0.0108
## 
##  States:  1= (s0), 2= szaura, 3= wdall 
## 
## Likelihood ratio test=24.95  on 2 df, p=3.816e-06
## n= 797, number of events= 496 
##    (1 observation deleted due to missingness)
## 
## [[29]]
## Call:
## coxph(formula = as.formula(paste("Surv(as.numeric(etime), event) ~", 
##     x)), data = data, id = id_wams)
## 
##                 
## 1:2                  coef exp(coef) se(coef) robust se      z        p
##   time_begin_cat -0.56080   0.57075  0.09531   0.09292 -6.035 1.59e-09
## 
##                 
## 1:3                  coef exp(coef) se(coef) robust se      z        p
##   time_begin_cat -0.55934   0.57158  0.10620   0.08968 -6.237 4.45e-10
## 
##  States:  1= (s0), 2= szaura, 3= wdall 
## 
## Likelihood ratio test=72.63  on 2 df, p=< 2.2e-16
## n= 798, number of events= 497 
## 
## [[30]]
## Call:
## coxph(formula = as.formula(paste("Surv(as.numeric(etime), event) ~", 
##     x)), data = data, id = id_wams)
## 
##            
## 1:2           coef exp(coef) se(coef) robust se     z      p
##   drugs_cat 0.4448    1.5601   0.1990    0.1964 2.265 0.0235
## 
##            
## 1:3             coef exp(coef) se(coef) robust se     z     p
##   drugs_cat 0.002012  1.002014 0.325525  0.327931 0.006 0.995
## 
##  States:  1= (s0), 2= szaura, 3= wdall 
## 
## Likelihood ratio test=4.44  on 2 df, p=0.1088
## n= 798, number of events= 497
cscon <- lapply(cs, confint)
cscon
## [[1]]
##                   2.5 %    97.5 %
## external_1:2  0.5524964 1.0038589
## external_1:3 -0.4585830 0.1409801
## 
## [[2]]
##               2.5 %    97.5 %
## sex_1:2 -0.08122638 0.3730525
## sex_1:3 -0.29574251 0.2680274
## 
## [[3]]
##                     2.5 %       97.5 %
## febrile_sz_1:2 -0.4944574 -0.007700644
## febrile_sz_1:3 -0.4268168  0.139376854
## 
## [[4]]
##                              2.5 %    97.5 %
## learning_disability_1:2 -0.2131687 0.6557171
## learning_disability_1:3  0.3415355 1.2821454
## 
## [[5]]
##                              2.5 %      97.5 %
## psychiatric_pre_any_1:2 -0.5973449 -0.07652076
## psychiatric_pre_any_1:3 -0.5009500  0.09158856
## 
## [[6]]
##               2.5 %       97.5 %
## gtcs_1:2  0.1584818  0.681582763
## gtcs_1:3 -0.6001780 -0.009892498
## 
## [[7]]
##                       2.5 %    97.5 %
## MRI_normal1_1:2 -0.02328974 0.6653536
## MRI_normal1_1:3 -1.12846655 0.1914627
## 
## [[8]]
##                 2.5 %    97.5 %
## opside_1:2 -0.2235336 0.2079647
## opside_1:3 -0.2568484 0.3242615
## 
## [[9]]
##                 2.5 %     97.5 %
## optemp_1:2 -0.7621170 -0.3113696
## optemp_1:3 -0.2215387  0.3905463
## 
## [[10]]
##                               2.5 %     97.5 %
## as.factor(opextent)1_1:2 -0.3365668  0.4012817
## as.factor(opextent)2_1:2 -2.3479772  0.5780311
## as.factor(opextent)1_1:3 -0.9072951 -0.1439401
## as.factor(opextent)2_1:3 -0.5978349  1.1207854
## 
## [[11]]
##                        2.5 %    97.5 %
## op_incomplete_1:2  0.3843578 1.1134646
## op_incomplete_1:3 -0.3227937 0.7473329
## 
## [[12]]
##                       2.5 %     97.5 %
## pathology_HS_1:2 -0.3584495 0.10177842
## pathology_HS_1:3 -0.4934457 0.08185818
## 
## [[13]]
##                         2.5 %    97.5 %
## pathology_FCD_1:2 -0.45544621 0.4063326
## pathology_FCD_1:3  0.02648087 0.9904104
## 
## [[14]]
##                        2.5 %    97.5 %
## pathology_DNT_1:2 -0.7200616 0.1870574
## pathology_DNT_1:3 -0.2907811 0.6710027
## 
## [[15]]
##                        2.5 %     97.5 %
## pathology_CAV_1:2 -1.0675765 0.05100578
## pathology_CAV_1:3 -0.0200127 0.87628542
## 
## [[16]]
##                       2.5 %    97.5 %
## pathology_GL_1:2 -0.7860167 0.7315494
## pathology_GL_1:3  0.7955775 2.0822766
## 
## [[17]]
##                         2.5 %    97.5 %
## pathology_dual_1:2 -0.9144669 0.3183497
## pathology_dual_1:3 -0.1817686 0.9999799
## 
## [[18]]
##                          2.5 %    97.5 %
## pathology_other_1:2 -0.2428083 0.3856291
## pathology_other_1:3 -0.7931626 0.1531924
## 
## [[19]]
##                            2.5 %   97.5 %
## pathology_normal_1:2 -0.02882741 1.285077
## pathology_normal_1:3 -2.88215621 1.309609
## 
## [[20]]
##                           2.5 %    97.5 %
## acutepostszauras_1:2 -0.4966514 0.3555014
## acutepostszauras_1:3 -0.8773390 0.2652798
## 
## [[21]]
##                2.5 %    97.5 %
## auras_1:2  0.4215021  1.090946
## auras_1:3 -1.9182121 -0.193935
## 
## [[22]]
##                             2.5 %    97.5 %
## age_onset_ten_cat_1:2 -0.04660564 0.3486315
## age_onset_ten_cat_1:3 -0.40568859 0.1431153
## 
## [[23]]
##                                 2.5 %     97.5 %
## age_at_surgery_ten_cat_1:2 -0.1151190  0.2942050
## age_at_surgery_ten_cat_1:3 -0.5969657 -0.1207513
## 
## [[24]]
##                            2.5 %     97.5 %
## duration_ten_cat_1:2 -0.08871316  0.3617106
## duration_ten_cat_1:3 -0.82244559 -0.2432796
## 
## [[25]]
##                 2.5 %    97.5 %
## extent_1:2 -0.4615574 0.1580967
## extent_1:3  0.1713457 0.7409881
## 
## [[26]]
##                 2.5 %    97.5 %
## extra_1:2 -0.61555716 0.1460990
## extra_1:3 -0.09650161 0.7605504
## 
## [[27]]
##                          2.5 %     97.5 %
## aura_relapse1_1:2     1.489336   1.941133
## aura_relapseN/A_1:2   2.173273   2.606785
## aura_relapse1_1:3   -16.996465 -16.225364
## aura_relapseN/A_1:3 -18.748431 -14.558154
## 
## [[28]]
##                 2.5 %      97.5 %
## numsz6_1:2  0.1470045  0.37917521
## numsz6_1:3 -0.4473949 -0.05849533
## 
## [[29]]
##                         2.5 %     97.5 %
## time_begin_cat_1:2 -0.7429243 -0.3786707
## time_begin_cat_1:3 -0.7351055 -0.3835822
## 
## [[30]]
##                     2.5 %    97.5 %
## drugs_cat_1:2  0.05983095 0.8297178
## drugs_cat_1:3 -0.64072234 0.6447454
csmulti <- coxph(Surv(as.numeric(etime), event) ~ duration_ten_cat + age_at_surgery_ten_cat + gtcs + numsz6 + learning_disability + factor(extent==1) +pathology_FCD + pathology_GL + time_begin + auras, data = data, id = id_wams)

csmulti
## Call:
## coxph(formula = Surv(as.numeric(etime), event) ~ duration_ten_cat + 
##     age_at_surgery_ten_cat + gtcs + numsz6 + learning_disability + 
##     factor(extent == 1) + pathology_FCD + pathology_GL + time_begin + 
##     auras, data = data, id = id_wams)
## 
##                          
## 1:2                            coef exp(coef)  se(coef) robust se      z
##   duration_ten_cat         0.239586  1.270723  0.144753  0.151751  1.579
##   age_at_surgery_ten_cat   0.050448  1.051742  0.131286  0.133406  0.378
##   gtcs                     0.415458  1.515064  0.151014  0.148588  2.796
##   numsz6                   0.174450  1.190591  0.074404  0.074925  2.328
##   learning_disability      0.355510  1.426909  0.241497  0.248127  1.433
##   factor(extent == 1)TRUE -0.006701  0.993321  0.196140  0.202043 -0.033
##   pathology_FCD            0.153598  1.166022  0.240244  0.243437  0.631
##   pathology_GL             0.389328  1.475989  0.425123  0.452459  0.860
##   time_begin              -0.136250  0.872625  0.028888  0.036120 -3.772
##   auras                    1.084932  2.959239  0.194950  0.203330  5.336
##                          
## 1:2                              p
##   duration_ten_cat        0.114380
##   age_at_surgery_ten_cat  0.705317
##   gtcs                    0.005173
##   numsz6                  0.019896
##   learning_disability     0.151922
##   factor(extent == 1)TRUE 0.973541
##   pathology_FCD           0.528068
##   pathology_GL            0.389529
##   time_begin              0.000162
##   auras                   9.51e-08
## 
##                          
## 1:3                           coef exp(coef) se(coef) robust se      z        p
##   duration_ten_cat        -0.25846   0.77224  0.16343   0.16875 -1.532 0.125612
##   age_at_surgery_ten_cat  -0.33857   0.71279  0.14048   0.13673 -2.476 0.013282
##   gtcs                    -0.17140   0.84248  0.15019   0.15669 -1.094 0.274006
##   numsz6                  -0.19687   0.82130  0.09501   0.10386 -1.896 0.058022
##   learning_disability      0.77709   2.17512  0.23233   0.25580  3.038 0.002383
##   factor(extent == 1)TRUE  0.17503   1.19128  0.19841   0.20716  0.845 0.398153
##   pathology_FCD            0.32809   1.38831  0.25336   0.26539  1.236 0.216363
##   pathology_GL             1.31824   3.73684  0.36726   0.33927  3.885 0.000102
##   time_begin              -0.22030   0.80228  0.04011   0.03478 -6.334 2.39e-10
##   auras                   -0.52512   0.59148  0.46107   0.41633 -1.261 0.207199
## 
##  States:  1= (s0), 2= szaura, 3= wdall 
## 
## Likelihood ratio test=168.1  on 20 df, p=< 2.2e-16
## n= 665, number of events= 430 
##    (133 observations deleted due to missingness)
exp(confint(csmulti))
##                                 2.5 %    97.5 %
## duration_ten_cat_1:2        0.9438000 1.7108890
## age_at_surgery_ten_cat_1:2  0.8097557 1.3660430
## gtcs_1:2                    1.1322761 2.0272606
## numsz6_1:2                  1.0279829 1.3789198
## learning_disability_1:2     0.8773848 2.3206101
## factor(extent == 1)TRUE_1:2 0.6685134 1.4759421
## pathology_FCD_1:2           0.7235912 1.8789724
## pathology_GL_1:2            0.6080646 3.5827502
## time_begin_1:2              0.8129851 0.9366397
## auras_1:2                   1.9865757 4.4081372
## duration_ten_cat_1:3        0.5547764 1.0749544
## age_at_surgery_ten_cat_1:3  0.5452232 0.9318579
## gtcs_1:3                    0.6197075 1.1453454
## numsz6_1:3                  0.6700270 1.0067147
## learning_disability_1:3     1.3174787 3.5910753
## factor(extent == 1)TRUE_1:3 0.7937487 1.7879196
## pathology_FCD_1:3           0.8252553 2.3355203
## pathology_GL_1:3            1.9218250 7.2659893
## time_begin_1:3              0.7494066 0.8588741
## auras_1:3                   0.2615543 1.3375945
csh <- lapply(list, function(x)
  CSC(as.formula(
    paste("Hist(as.numeric(etime), event) ~", x)
  ),  data = data))
## Warning in coxph.fit(X, Y, istrat, offset, init, control, weights = weights, :
## Loglik converged before variable 1,2 ; coefficient may be infinite.
## Warning in coxph.fit(X, Y, istrat, offset, init, control, weights = weights, :
## Loglik converged before variable 1,2 ; coefficient may be infinite.

5.6 Subdistribution model data set up

data <-
  read_xlsx(
    "/Users/carolinaferreiraatuesta/Documents/WAMS/ASM_withdrawal_registry/WAMS_Registry.xlsx"
  )
data <-
  subset(
    data,
    data$began_wd == 1 &
      wd_all_time >= "0" &
      szaura >= "0" &
      wd_all >= "0" & wd_all_time >= "0" & time_szaura >= "0"
  )
data$age_at_surgery_ten_cat <-
  findInterval(data$age_at_surgery_ten, c(0, 2, 4), rightmost.closed = TRUE)
data$duration_ten_cat <-
  findInterval(data$duration_ten, c(0, 2), rightmost.closed = TRUE)
data$age_onset_ten_cat <-
  findInterval(data$age_onset_ten, c(0, 2, 4), rightmost.closed = TRUE)
data$drugs_cat <-
  findInterval(data$drugs, c(0, 3), rightmost.closed = TRUE)

data$time_begin_cat <-
  findInterval(data$time_begin, c(0, 2, 4), rightmost.closed = TRUE)
etime <- with(data, ifelse(szaura == 0, wd_all_time, time_szaura))
event <- with(data, ifelse(szaura == 0, 2 * wd_all, 1))
event <- factor(event, 0:2, labels = c("none", "szaura", "wdall"))
table(event)
## event
##   none szaura  wdall 
##    301    302    195
szdat <-
  finegray(
    Surv(as.numeric(etime), event) ~ .,
    data = data,
    etype = "szaura",
    id = id_wams
  )
wddat <-
  finegray(
    Surv(as.numeric(etime), event) ~ .,
    data = data,
    etype = "wdall",
    id = id_wams
  )

5.7 Subdistribution model - only time_begin as example but i should run this for all predictors

pfitsz <-
  survfit(
    Surv(fgstart, fgstop, fgstatus) ~ as.factor(time_begin_cat),
    data = szdat,
    weight = fgwt
  )


dfitwdall <-
  survfit(
    Surv(fgstart, fgstop, fgstatus) ~ as.factor(time_begin_cat),
    data = wddat,
    weight = fgwt
  )


fgfitsz <-
  coxph(
    Surv(fgstart, fgstop, fgstatus) ~ as.factor(time_begin_cat),
    data = szdat,
    weight = fgwt
  )
#summary(fgfitsz)

fgfitwdall <-
  coxph(
    Surv(fgstart, fgstop, fgstatus) ~ as.factor(time_begin_cat),
    data = wddat,
    weight = fgwt
  )
#summary(fgfitwdall)



finegray <- lapply(list, function(x)
  coxph(as.formula(
    paste("Surv(fgstart, fgstop, fgstatus) ~", x)
  ),  data = wddat,
    weight = fgwt))
## Warning in agreg.fit(X, Y, istrat, offset, init, control, weights = weights, :
## Loglik converged before variable 1,2 ; beta may be infinite.
finegray
## [[1]]
## Call:
## coxph(formula = as.formula(paste("Surv(fgstart, fgstop, fgstatus) ~", 
##     x)), data = wddat, weights = fgwt)
## 
##             coef exp(coef) se(coef) robust se      z        p
## external -0.7062    0.4935   0.1524    0.1416 -4.987 6.13e-07
## 
## Likelihood ratio test=22.79  on 1 df, p=1.804e-06
## n= 10056, number of events= 195 
## 
## [[2]]
## Call:
## coxph(formula = as.formula(paste("Surv(fgstart, fgstop, fgstatus) ~", 
##     x)), data = wddat, weights = fgwt)
## 
##         coef exp(coef) se(coef) robust se      z     p
## sex -0.06488   0.93718  0.14340   0.13308 -0.487 0.626
## 
## Likelihood ratio test=0.2  on 1 df, p=0.6511
## n= 10056, number of events= 195 
## 
## [[3]]
## Call:
## coxph(formula = as.formula(paste("Surv(fgstart, fgstop, fgstatus) ~", 
##     x)), data = wddat, weights = fgwt)
## 
##               coef exp(coef) se(coef) robust se     z     p
## febrile_sz 0.02618   1.02652  0.14521   0.13321 0.197 0.844
## 
## Likelihood ratio test=0.03  on 1 df, p=0.857
## n= 9090, number of events= 194 
##    (966 observations deleted due to missingness)
## 
## [[4]]
## Call:
## coxph(formula = as.formula(paste("Surv(fgstart, fgstop, fgstatus) ~", 
##     x)), data = wddat, weights = fgwt)
## 
##                       coef exp(coef) se(coef) robust se     z       p
## learning_disability 0.5406    1.7171   0.2265    0.2069 2.613 0.00898
## 
## Likelihood ratio test=4.96  on 1 df, p=0.02593
## n= 9092, number of events= 195 
##    (964 observations deleted due to missingness)
## 
## [[5]]
## Call:
## coxph(formula = as.formula(paste("Surv(fgstart, fgstop, fgstatus) ~", 
##     x)), data = wddat, weights = fgwt)
## 
##                         coef exp(coef) se(coef) robust se     z     p
## psychiatric_pre_any 0.003427  1.003432 0.154510  0.141265 0.024 0.981
## 
## Likelihood ratio test=0  on 1 df, p=0.9823
## n= 9092, number of events= 195 
##    (964 observations deleted due to missingness)
## 
## [[6]]
## Call:
## coxph(formula = as.formula(paste("Surv(fgstart, fgstop, fgstatus) ~", 
##     x)), data = wddat, weights = fgwt)
## 
##         coef exp(coef) se(coef) robust se      z        p
## gtcs -0.4801    0.6187   0.1478    0.1382 -3.473 0.000514
## 
## Likelihood ratio test=10.07  on 1 df, p=0.001507
## n= 10055, number of events= 194 
##    (1 observation deleted due to missingness)
## 
## [[7]]
## Call:
## coxph(formula = as.formula(paste("Surv(fgstart, fgstop, fgstatus) ~", 
##     x)), data = wddat, weights = fgwt)
## 
##                coef exp(coef) se(coef) robust se      z      p
## MRI_normal1 -0.7884    0.4546   0.3414    0.3275 -2.407 0.0161
## 
## Likelihood ratio test=6.82  on 1 df, p=0.008997
## n= 10056, number of events= 195 
## 
## [[8]]
## Call:
## coxph(formula = as.formula(paste("Surv(fgstart, fgstop, fgstatus) ~", 
##     x)), data = wddat, weights = fgwt)
## 
##            coef exp(coef) se(coef) robust se     z    p
## opside 0.008784  1.008823 0.140904  0.139916 0.063 0.95
## 
## Likelihood ratio test=0  on 1 df, p=0.9503
## n= 10055, number of events= 195 
##    (1 observation deleted due to missingness)
## 
## [[9]]
## Call:
## coxph(formula = as.formula(paste("Surv(fgstart, fgstop, fgstatus) ~", 
##     x)), data = wddat, weights = fgwt)
## 
##          coef exp(coef) se(coef) robust se     z        p
## optemp 0.5174    1.6777   0.1548    0.1442 3.587 0.000334
## 
## Likelihood ratio test=11.8  on 1 df, p=0.0005929
## n= 10056, number of events= 195 
## 
## [[10]]
## Call:
## coxph(formula = as.formula(paste("Surv(fgstart, fgstop, fgstatus) ~", 
##     x)), data = wddat, weights = fgwt)
## 
##                         coef exp(coef) se(coef) robust se      z       p
## as.factor(opextent)1 -0.4656    0.6277   0.1819    0.1728 -2.694 0.00705
## as.factor(opextent)2  0.5332    1.7043   0.3891    0.3777  1.411 0.15811
## 
## Likelihood ratio test=10.94  on 2 df, p=0.004217
## n= 7450, number of events= 195 
##    (2606 observations deleted due to missingness)
## 
## [[11]]
## Call:
## coxph(formula = as.formula(paste("Surv(fgstart, fgstop, fgstatus) ~", 
##     x)), data = wddat, weights = fgwt)
## 
##                  coef exp(coef) se(coef) robust se      z     p
## op_incomplete -0.4055    0.6666   0.2873    0.2657 -1.526 0.127
## 
## Likelihood ratio test=2.24  on 1 df, p=0.1343
## n= 10050, number of events= 192 
##    (6 observations deleted due to missingness)
## 
## [[12]]
## Call:
## coxph(formula = as.formula(paste("Surv(fgstart, fgstop, fgstatus) ~", 
##     x)), data = wddat, weights = fgwt)
## 
##                  coef exp(coef) se(coef) robust se     z     p
## pathology_HS -0.01747   0.98268  0.14586   0.13459 -0.13 0.897
## 
## Likelihood ratio test=0.01  on 1 df, p=0.9047
## n= 10056, number of events= 195 
## 
## [[13]]
## Call:
## coxph(formula = as.formula(paste("Surv(fgstart, fgstop, fgstatus) ~", 
##     x)), data = wddat, weights = fgwt)
## 
##                 coef exp(coef) se(coef) robust se     z     p
## pathology_FCD 0.3450    1.4120   0.2419    0.2251 1.533 0.125
## 
## Likelihood ratio test=1.86  on 1 df, p=0.173
## n= 10056, number of events= 195 
## 
## [[14]]
## Call:
## coxph(formula = as.formula(paste("Surv(fgstart, fgstop, fgstatus) ~", 
##     x)), data = wddat, weights = fgwt)
## 
##                 coef exp(coef) se(coef) robust se     z      p
## pathology_DNT 0.3777    1.4589   0.2474    0.2244 1.683 0.0924
## 
## Likelihood ratio test=2.1  on 1 df, p=0.1468
## n= 10056, number of events= 195 
## 
## [[15]]
## Call:
## coxph(formula = as.formula(paste("Surv(fgstart, fgstop, fgstatus) ~", 
##     x)), data = wddat, weights = fgwt)
## 
##                 coef exp(coef) se(coef) robust se     z       p
## pathology_CAV 0.5690    1.7666   0.2221    0.2078 2.738 0.00618
## 
## Likelihood ratio test=5.68  on 1 df, p=0.01714
## n= 7450, number of events= 195 
##    (2606 observations deleted due to missingness)
## 
## [[16]]
## Call:
## coxph(formula = as.formula(paste("Surv(fgstart, fgstop, fgstatus) ~", 
##     x)), data = wddat, weights = fgwt)
## 
##                coef exp(coef) se(coef) robust se     z        p
## pathology_GL 1.1590    3.1866   0.3255    0.2773 4.179 2.93e-05
## 
## Likelihood ratio test=9.18  on 1 df, p=0.002443
## n= 10014, number of events= 195 
##    (42 observations deleted due to missingness)
## 
## [[17]]
## Call:
## coxph(formula = as.formula(paste("Surv(fgstart, fgstop, fgstatus) ~", 
##     x)), data = wddat, weights = fgwt)
## 
##                  coef exp(coef) se(coef) robust se     z      p
## pathology_dual 0.4568    1.5790   0.2982    0.2726 1.676 0.0938
## 
## Likelihood ratio test=2.06  on 1 df, p=0.1512
## n= 10014, number of events= 195 
##    (42 observations deleted due to missingness)
## 
## [[18]]
## Call:
## coxph(formula = as.formula(paste("Surv(fgstart, fgstop, fgstatus) ~", 
##     x)), data = wddat, weights = fgwt)
## 
##                    coef exp(coef) se(coef) robust se      z      p
## pathology_other -0.4542    0.6349   0.2361    0.2274 -1.997 0.0458
## 
## Likelihood ratio test=4.17  on 1 df, p=0.04107
## n= 10056, number of events= 195 
## 
## [[19]]
## Call:
## coxph(formula = as.formula(paste("Surv(fgstart, fgstop, fgstatus) ~", 
##     x)), data = wddat, weights = fgwt)
## 
##                     coef exp(coef) se(coef) robust se      z     p
## pathology_normal -1.3620    0.2562   1.0026    1.0107 -1.347 0.178
## 
## Likelihood ratio test=3.04  on 1 df, p=0.08122
## n= 10056, number of events= 195 
## 
## [[20]]
## Call:
## coxph(formula = as.formula(paste("Surv(fgstart, fgstop, fgstatus) ~", 
##     x)), data = wddat, weights = fgwt)
## 
##                     coef exp(coef) se(coef) robust se      z    p
## acutepostszauras -0.3017    0.7396   0.2871    0.2735 -1.103 0.27
## 
## Likelihood ratio test=1.21  on 1 df, p=0.2722
## n= 10056, number of events= 195 
## 
## [[21]]
## Call:
## coxph(formula = as.formula(paste("Surv(fgstart, fgstop, fgstatus) ~", 
##     x)), data = wddat, weights = fgwt)
## 
##          coef exp(coef) se(coef) robust se      z       p
## auras -1.4482    0.2350   0.4531    0.4370 -3.314 0.00092
## 
## Likelihood ratio test=16.78  on 1 df, p=4.194e-05
## n= 9197, number of events= 195 
##    (859 observations deleted due to missingness)
## 
## [[22]]
## Call:
## coxph(formula = as.formula(paste("Surv(fgstart, fgstop, fgstatus) ~", 
##     x)), data = wddat, weights = fgwt)
## 
##                      coef exp(coef) se(coef) robust se      z      p
## age_onset_ten_cat -0.2644    0.7676   0.1423    0.1293 -2.046 0.0408
## 
## Likelihood ratio test=3.73  on 1 df, p=0.05336
## n= 10056, number of events= 195 
## 
## [[23]]
## Call:
## coxph(formula = as.formula(paste("Surv(fgstart, fgstop, fgstatus) ~", 
##     x)), data = wddat, weights = fgwt)
## 
##                           coef exp(coef) se(coef) robust se      z        p
## age_at_surgery_ten_cat -0.3866    0.6794   0.1253    0.1026 -3.769 0.000164
## 
## Likelihood ratio test=9.51  on 1 df, p=0.002043
## n= 10056, number of events= 195 
## 
## [[24]]
## Call:
## coxph(formula = as.formula(paste("Surv(fgstart, fgstop, fgstatus) ~", 
##     x)), data = wddat, weights = fgwt)
## 
##                     coef exp(coef) se(coef) robust se      z       p
## duration_ten_cat -0.5065    0.6026   0.1486    0.1375 -3.683 0.00023
## 
## Likelihood ratio test=12.02  on 1 df, p=0.0005256
## n= 10056, number of events= 195 
## 
## [[25]]
## Call:
## coxph(formula = as.formula(paste("Surv(fgstart, fgstop, fgstatus) ~", 
##     x)), data = wddat, weights = fgwt)
## 
##          coef exp(coef) se(coef) robust se    z        p
## extent 0.4823    1.6199   0.1355    0.1293 3.73 0.000192
## 
## Likelihood ratio test=10.92  on 1 df, p=0.0009524
## n= 7450, number of events= 195 
##    (2606 observations deleted due to missingness)
## 
## [[26]]
## Call:
## coxph(formula = as.formula(paste("Surv(fgstart, fgstop, fgstatus) ~", 
##     x)), data = wddat, weights = fgwt)
## 
##         coef exp(coef) se(coef) robust se     z      p
## extra 0.3548    1.4259   0.2109    0.1987 1.786 0.0742
## 
## Likelihood ratio test=2.6  on 1 df, p=0.1071
## n= 10056, number of events= 195 
## 
## [[27]]
## Call:
## coxph(formula = as.formula(paste("Surv(fgstart, fgstop, fgstatus) ~", 
##     x)), data = wddat, weights = fgwt)
## 
##                       coef  exp(coef)   se(coef)  robust se      z      p
## aura_relapse1   -1.830e+01  1.127e-08  1.521e+03  8.638e-02 -211.9 <2e-16
## aura_relapseN/A -1.830e+01  1.132e-08  1.589e+04  3.096e-01  -59.1 <2e-16
## 
## Likelihood ratio test=70.27  on 2 df, p=5.5e-16
## n= 10054, number of events= 195 
##    (2 observations deleted due to missingness)
## 
## [[28]]
## Call:
## coxph(formula = as.formula(paste("Surv(fgstart, fgstop, fgstatus) ~", 
##     x)), data = wddat, weights = fgwt)
## 
##            coef exp(coef) se(coef) robust se      z        p
## numsz6 -0.45045   0.63734  0.09138   0.09392 -4.796 1.62e-06
## 
## Likelihood ratio test=25.91  on 1 df, p=3.575e-07
## n= 10055, number of events= 194 
##    (1 observation deleted due to missingness)
## 
## [[29]]
## Call:
## coxph(formula = as.formula(paste("Surv(fgstart, fgstop, fgstatus) ~", 
##     x)), data = wddat, weights = fgwt)
## 
##                    coef exp(coef) se(coef) robust se      z       p
## time_begin_cat -0.22495   0.79856  0.10457   0.08381 -2.684 0.00727
## 
## Likelihood ratio test=4.95  on 1 df, p=0.02612
## n= 10056, number of events= 195 
## 
## [[30]]
## Call:
## coxph(formula = as.formula(paste("Surv(fgstart, fgstop, fgstatus) ~", 
##     x)), data = wddat, weights = fgwt)
## 
##              coef exp(coef) se(coef) robust se      z     p
## drugs_cat -0.3342    0.7159   0.3247    0.3068 -1.089 0.276
## 
## Likelihood ratio test=1.17  on 1 df, p=0.2789
## n= 10056, number of events= 195
lapply(finegray, confint)
## [[1]]
##               2.5 %    97.5 %
## external -0.9837258 -0.428645
## 
## [[2]]
##          2.5 %    97.5 %
## sex -0.3257187 0.1959624
## 
## [[3]]
##                 2.5 %    97.5 %
## febrile_sz -0.2349121 0.2872699
## 
## [[4]]
##                         2.5 %    97.5 %
## learning_disability 0.1351086 0.9461367
## 
## [[5]]
##                          2.5 %    97.5 %
## psychiatric_pre_any -0.2734473 0.2803004
## 
## [[6]]
##           2.5 %    97.5 %
## gtcs -0.7510282 -0.209181
## 
## [[7]]
##                 2.5 %     97.5 %
## MRI_normal1 -1.430333 -0.1465465
## 
## [[8]]
##             2.5 %    97.5 %
## opside -0.2654456 0.2830136
## 
## [[9]]
##            2.5 %    97.5 %
## optemp 0.2347191 0.8001095
## 
## [[10]]
##                           2.5 %     97.5 %
## as.factor(opextent)1 -0.8043671 -0.1269149
## as.factor(opextent)2 -0.2071859  1.2735199
## 
## [[11]]
##                   2.5 %    97.5 %
## op_incomplete -0.926365 0.1153525
## 
## [[12]]
##                   2.5 %    97.5 %
## pathology_HS -0.2812539 0.2463125
## 
## [[13]]
##                     2.5 %    97.5 %
## pathology_FCD -0.09617643 0.7862293
## 
## [[14]]
##                     2.5 %    97.5 %
## pathology_DNT -0.06215348 0.8175818
## 
## [[15]]
##                   2.5 %    97.5 %
## pathology_CAV 0.1617062 0.9763597
## 
## [[16]]
##                  2.5 %   97.5 %
## pathology_GL 0.6153883 1.702543
## 
## [[17]]
##                      2.5 %    97.5 %
## pathology_dual -0.07746397 0.9910597
## 
## [[18]]
##                      2.5 %      97.5 %
## pathology_other -0.9000279 -0.00844968
## 
## [[19]]
##                      2.5 %    97.5 %
## pathology_normal -3.342982 0.6190811
## 
## [[20]]
##                       2.5 %    97.5 %
## acutepostszauras -0.8377918 0.2344132
## 
## [[21]]
##          2.5 %     97.5 %
## auras -2.30475 -0.5916612
## 
## [[22]]
##                        2.5 %      97.5 %
## age_onset_ten_cat -0.5177751 -0.01109838
## 
## [[23]]
##                             2.5 %     97.5 %
## age_at_surgery_ten_cat -0.5876512 -0.1855767
## 
## [[24]]
##                       2.5 %     97.5 %
## duration_ten_cat -0.7760693 -0.2369708
## 
## [[25]]
##            2.5 %    97.5 %
## extent 0.2288857 0.7358142
## 
## [[26]]
##             2.5 %    97.5 %
## extra -0.03464227 0.7442755
## 
## [[27]]
##                     2.5 %    97.5 %
## aura_relapse1   -18.46999 -18.13138
## aura_relapseN/A -18.90348 -17.69001
## 
## [[28]]
##             2.5 %     97.5 %
## numsz6 -0.6345276 -0.2663807
## 
## [[29]]
##                     2.5 %      97.5 %
## time_begin_cat -0.3892092 -0.06068195
## 
## [[30]]
##                2.5 %   97.5 %
## drugs_cat -0.9355648 0.267141

Plot wdall using both competing risks models and time to begin

#rawfit<- survfit(Surv(time_szaura, szaura) ~ time_begin_cat, data=data)
mfit2 <-
  survfit(Surv(as.numeric(etime), event) ~ time_begin_cat, data = data) #reprise the AJ

plot(
  mfit2[, 'wdall'],
  col = 1:3,
  ylim = c(0, 1),
  lwd = 2,
  xscale = 12,
  conf.times = c(5, 15, 25) * 12,
  xlab = "Years post wd",
  ylab = "Fraction with wdall"
)

ndata <- data.frame(time_begin_cat = c("1", "2", "3"))
fgsurv <- survfit(fgfitwdall, ndata)
lines(
  fgsurv,
  fun = "event",
  lty = 2,
  lwd = 2,
  col = 1:3
)
#lines(rawfit, fun="event", lty=2, lwd=2, col=1:2)
legend(
  "topleft",
  c(
    "0-2, Aalen-Johansen",
    "2-4, Aalen-Johansen",
    "4, Aalen-Johansen",
    "0-2, Fine-Gray",
    "2-4, Fine-Gray",
    "4-, Fine-Gray"
  ),
  col = 1:3,
  lty = c(1, 1, 1, 2, 2, 2),
  bty = 'n'
)

# rate models with only 
cfitr <-
  coxph(Surv(as.numeric(etime), event) ~ time_begin_cat, data, id = id_wams)
#rcurve <- survfit(cfitr, newdata=ndata)
#lines(rcurve[, 'pcm'], col=6:7) # makes the plot too crowsded

Plot szaura relapse model using both competing risks models and time to begin

mfit2 <-
  survfit(Surv(as.numeric(etime), event) ~ time_begin_cat, data = data)

plot(
  mfit2[, 'szaura'],
  col = 1:3,
  ylim = c(0, 1),
  lwd = 2,
  xscale = 12,
  conf.times = c(5, 15, 25) * 12,
  xlab = "Years post wd",
  ylab = "Fraction with szaura"
)

ndata <- data.frame(time_begin_cat = c("1", "2", "3"))
fgsurv <- survfit(fgfitsz, ndata)
lines(
  fgsurv,
  fun = "event",
  lty = 2,
  lwd = 2,
  col = 1:3
)

legend(
  "topleft",
  c(
    "0-2, Aalen-Johansen",
    "2-4, Aalen-Johansen",
    "4, Aalen-Johansen",
    "0-2, Fine-Gray",
    "2-4, Fine-Gray",
    "4-, Fine-Gray"
  ),
  col = 1:3,
  lty = c(1, 1, 1, 2, 2, 2),
  bty = 'n'
)

cfitr <-
  coxph(Surv(as.numeric(etime), event) ~ time_begin_cat, data, id = id_wams)
#rcurve <- survfit(cfitr, newdata=ndata)
finegraymulti <- 
  coxph(Surv(fgstart, fgstop, fgstatus) ~ age_onset_ten_cat + duration_ten_cat + age_at_surgery_ten_cat + gtcs + numsz6 + learning_disability +MRI_normal + factor(extent==1) +pathology_CAV +pathology_GL +pathology_other+ time_begin_cat + auras, data = wddat, weight = fgwt)
finegraymulti
## Call:
## coxph(formula = Surv(fgstart, fgstop, fgstatus) ~ age_onset_ten_cat + 
##     duration_ten_cat + age_at_surgery_ten_cat + gtcs + numsz6 + 
##     learning_disability + MRI_normal + factor(extent == 1) + 
##     pathology_CAV + pathology_GL + pathology_other + time_begin_cat + 
##     auras, data = wddat, weights = fgwt)
## 
##                             coef exp(coef) se(coef) robust se      z        p
## age_onset_ten_cat       -0.42775   0.65197  0.18301   0.16877 -2.535  0.01126
## duration_ten_cat        -0.51499   0.59751  0.18466   0.16529 -3.116  0.00184
## age_at_surgery_ten_cat  -0.17681   0.83794  0.16646   0.14821 -1.193  0.23288
## gtcs                    -0.38477   0.68061  0.15115   0.14264 -2.697  0.00699
## numsz6                  -0.26618   0.76630  0.09534   0.10050 -2.649  0.00808
## learning_disability      0.47907   1.61457  0.24014   0.22692  2.111  0.03476
## MRI_normal1             -0.48389   0.61638  0.35139   0.33409 -1.448  0.14751
## factor(extent == 1)TRUE  0.03361   1.03418  0.20670   0.20011  0.168  0.86662
## pathology_CAV            0.61842   1.85599  0.26520   0.25808  2.396  0.01657
## pathology_GL             1.12872   3.09170  0.35948   0.27759  4.066 4.78e-05
## pathology_other         -0.11464   0.89169  0.25364   0.23381 -0.490  0.62393
## time_begin_cat          -0.38621   0.67962  0.10989   0.09263 -4.170 3.05e-05
## auras                   -1.09114   0.33583  0.45749   0.43468 -2.510  0.01207
## 
## Likelihood ratio test=82.77  on 13 df, p=3.32e-12
## n= 7407, number of events= 194 
##    (2649 observations deleted due to missingness)
exp(confint(finegraymulti))
##                             2.5 %    97.5 %
## age_onset_ten_cat       0.4683565 0.9075766
## duration_ten_cat        0.4321590 0.8261151
## age_at_surgery_ten_cat  0.6266968 1.1203874
## gtcs                    0.5146120 0.9001534
## numsz6                  0.6292865 0.9331393
## learning_disability     1.0349036 2.5189044
## MRI_normal1             0.3202371 1.1863865
## factor(extent == 1)TRUE 0.6986591 1.5308306
## pathology_CAV           1.1191729 3.0779073
## pathology_GL            1.7943827 5.3269496
## pathology_other         0.5638865 1.4100560
## time_begin_cat          0.5667947 0.8149160
## auras                   0.1432581 0.7872779
convencoxmulti <- 
  coxph(Surv(as.numeric(wd_all_time), wd_all) ~ febrile_sz + learning_disability +extra + pathology_HS +pathology_FCD +as.numeric(time_begin), data = data)
convencoxmulti
## Call:
## coxph(formula = Surv(as.numeric(wd_all_time), wd_all) ~ febrile_sz + 
##     learning_disability + extra + pathology_HS + pathology_FCD + 
##     as.numeric(time_begin), data = data)
## 
##                            coef exp(coef) se(coef)      z        p
## febrile_sz              0.10568   1.11147  0.13490  0.783   0.4334
## learning_disability     0.34284   1.40895  0.20104  1.705   0.0881
## extra                   0.41437   1.51341  0.21252  1.950   0.0512
## pathology_HS            0.32244   1.38049  0.15229  2.117   0.0342
## pathology_FCD          -0.05184   0.94948  0.23572 -0.220   0.8259
## as.numeric(time_begin) -0.15929   0.85275  0.02887 -5.518 3.42e-08
## 
## Likelihood ratio test=51.8  on 6 df, p=2.046e-09
## n= 733, number of events= 283 
##    (65 observations deleted due to missingness)
exp(confint(convencoxmulti))
##                            2.5 %    97.5 %
## febrile_sz             0.8532432 1.4478405
## learning_disability    0.9501029 2.0893874
## extra                  0.9978305 2.2954013
## pathology_HS           1.0242438 1.8606547
## pathology_FCD          0.5981933 1.5070597
## as.numeric(time_begin) 0.8058454 0.9023872