data <- read.csv("/Users/carolinaferreiraatuesta/Documents/UCL/Reserach Project/Datasets/derivationtrain_test.csv")
set.seed(12345)
data <- read_xlsx("/Users/carolinaferreiraatuesta/Documents/UCL/Reserach Project/Datasets/derivation.xlsx")
split <- sample.split(data$sz,SplitRatio = 0.66)
train_set<- subset(data,split==T)
test_set<- subset(data,split==F)Cohort: Seizure free before reduction Outcome: withdrawal all
# Training Cohort ##Univariable regression
lapply(c('auras',
'withdraw1',
'sex',
'childconvul ',
'neuro_insult',
'status_epilepticus ',
'family_history',
'non_epileptic',
'gtcs',
'gtcs6',
'numsz6',
'MRI_normal',
'MRI_side',
'MRI_lobar',
'MRI_temp',
'EEG_ictal_side',
'EEG_ictal_temp',
'EEG_ictal_focal',
'EEG_interictal_normal',
'icEEG',
'PET',
'PET_side',
'learning_disability',
'psychiatric_pre_any',
'opside',
'optemp',
'opextent',
'op_incomplete',
'pathology_HS ',
'pathology_FCD',
'pathology_DNT',
'pathology_CAV',
'pathology_GL',
'pathology_dual',
'pathology_other',
'pathology_normal',
'acutepostszauras',
'sz',
'szaurafree1st',
'aura',
'szaura',
'began_wd',
'wd_all',
'aeds',
'age_onset ',
'duration',
'age_at_surgery',
'sz_time',
'aura_time',
'szaura_time',
'began_wd_time',
'age_began_wd',
'wd_all_time',
'years_follow_up'),
function(var) {
formula <-
as.formula(paste("Surv(time = train_set$wd_all_time, event = train_set$wd_all) ~", var))
res.logist <-
coxph(formula, data = train_set)
summary(res.logist)
}
)## [[1]]
## Call:
## coxph(formula = formula, data = train_set)
##
## n= 231, number of events= 139
##
## coef exp(coef) se(coef) z Pr(>|z|)
## auras -0.4701 0.6250 0.3887 -1.209 0.227
##
## exp(coef) exp(-coef) lower .95 upper .95
## auras 0.625 1.6 0.2917 1.339
##
## Concordance= 0.507 (se = 0.013 )
## Likelihood ratio test= 1.69 on 1 df, p=0.2
## Wald test = 1.46 on 1 df, p=0.2
## Score (logrank) test = 1.49 on 1 df, p=0.2
##
##
## [[2]]
## Call:
## coxph(formula = formula, data = train_set)
##
## n= 231, number of events= 139
##
## coef exp(coef) se(coef) z Pr(>|z|)
## withdraw1 0.9305 2.5358 0.2258 4.122 3.76e-05 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## exp(coef) exp(-coef) lower .95 upper .95
## withdraw1 2.536 0.3944 1.629 3.947
##
## Concordance= 0.586 (se = 0.021 )
## Likelihood ratio test= 20.4 on 1 df, p=6e-06
## Wald test = 16.99 on 1 df, p=4e-05
## Score (logrank) test = 18.2 on 1 df, p=2e-05
##
##
## [[3]]
## Call:
## coxph(formula = formula, data = train_set)
##
## n= 231, number of events= 139
##
## coef exp(coef) se(coef) z Pr(>|z|)
## sex 0.2972 1.3461 0.1733 1.715 0.0863 .
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## exp(coef) exp(-coef) lower .95 upper .95
## sex 1.346 0.7429 0.9585 1.89
##
## Concordance= 0.537 (se = 0.024 )
## Likelihood ratio test= 2.99 on 1 df, p=0.08
## Wald test = 2.94 on 1 df, p=0.09
## Score (logrank) test = 2.96 on 1 df, p=0.09
##
##
## [[4]]
## Call:
## coxph(formula = formula, data = train_set)
##
## n= 231, number of events= 139
##
## coef exp(coef) se(coef) z Pr(>|z|)
## childconvul -0.1202 0.8867 0.1700 -0.707 0.479
##
## exp(coef) exp(-coef) lower .95 upper .95
## childconvul 0.8867 1.128 0.6355 1.237
##
## Concordance= 0.516 (se = 0.024 )
## Likelihood ratio test= 0.5 on 1 df, p=0.5
## Wald test = 0.5 on 1 df, p=0.5
## Score (logrank) test = 0.5 on 1 df, p=0.5
##
##
## [[5]]
## Call:
## coxph(formula = formula, data = train_set)
##
## n= 231, number of events= 139
##
## coef exp(coef) se(coef) z Pr(>|z|)
## neuro_insult -0.2349 0.7906 0.1700 -1.382 0.167
##
## exp(coef) exp(-coef) lower .95 upper .95
## neuro_insult 0.7906 1.265 0.5666 1.103
##
## Concordance= 0.515 (se = 0.024 )
## Likelihood ratio test= 1.9 on 1 df, p=0.2
## Wald test = 1.91 on 1 df, p=0.2
## Score (logrank) test = 1.92 on 1 df, p=0.2
##
##
## [[6]]
## Call:
## coxph(formula = formula, data = train_set)
##
## n= 231, number of events= 139
##
## coef exp(coef) se(coef) z Pr(>|z|)
## status_epilepticus 0.08353 1.08712 0.24724 0.338 0.735
##
## exp(coef) exp(-coef) lower .95 upper .95
## status_epilepticus 1.087 0.9199 0.6696 1.765
##
## Concordance= 0.503 (se = 0.016 )
## Likelihood ratio test= 0.11 on 1 df, p=0.7
## Wald test = 0.11 on 1 df, p=0.7
## Score (logrank) test = 0.11 on 1 df, p=0.7
##
##
## [[7]]
## Call:
## coxph(formula = formula, data = train_set)
##
## n= 231, number of events= 139
##
## coef exp(coef) se(coef) z Pr(>|z|)
## family_history -0.1994 0.8192 0.1975 -1.01 0.312
##
## exp(coef) exp(-coef) lower .95 upper .95
## family_history 0.8192 1.221 0.5563 1.206
##
## Concordance= 0.529 (se = 0.021 )
## Likelihood ratio test= 1.05 on 1 df, p=0.3
## Wald test = 1.02 on 1 df, p=0.3
## Score (logrank) test = 1.02 on 1 df, p=0.3
##
##
## [[8]]
## Call:
## coxph(formula = formula, data = train_set)
##
## n= 231, number of events= 139
##
## coef exp(coef) se(coef) z Pr(>|z|)
## non_epileptic 0.2327 1.2620 0.3887 0.599 0.549
##
## exp(coef) exp(-coef) lower .95 upper .95
## non_epileptic 1.262 0.7924 0.5891 2.704
##
## Concordance= 0.501 (se = 0.008 )
## Likelihood ratio test= 0.33 on 1 df, p=0.6
## Wald test = 0.36 on 1 df, p=0.5
## Score (logrank) test = 0.36 on 1 df, p=0.5
##
##
## [[9]]
## Call:
## coxph(formula = formula, data = train_set)
##
## n= 231, number of events= 139
##
## coef exp(coef) se(coef) z Pr(>|z|)
## gtcs -0.1765 0.8382 0.1785 -0.989 0.323
##
## exp(coef) exp(-coef) lower .95 upper .95
## gtcs 0.8382 1.193 0.5907 1.189
##
## Concordance= 0.529 (se = 0.023 )
## Likelihood ratio test= 0.96 on 1 df, p=0.3
## Wald test = 0.98 on 1 df, p=0.3
## Score (logrank) test = 0.98 on 1 df, p=0.3
##
##
## [[10]]
## Call:
## coxph(formula = formula, data = train_set)
##
## n= 231, number of events= 139
##
## coef exp(coef) se(coef) z Pr(>|z|)
## gtcs6 -0.1214 0.8857 0.1815 -0.669 0.504
##
## exp(coef) exp(-coef) lower .95 upper .95
## gtcs6 0.8857 1.129 0.6205 1.264
##
## Concordance= 0.517 (se = 0.023 )
## Likelihood ratio test= 0.45 on 1 df, p=0.5
## Wald test = 0.45 on 1 df, p=0.5
## Score (logrank) test = 0.45 on 1 df, p=0.5
##
##
## [[11]]
## Call:
## coxph(formula = formula, data = train_set)
##
## n= 231, number of events= 139
##
## coef exp(coef) se(coef) z Pr(>|z|)
## numsz6 0.001369 1.001370 0.001443 0.949 0.343
##
## exp(coef) exp(-coef) lower .95 upper .95
## numsz6 1.001 0.9986 0.9985 1.004
##
## Concordance= 0.472 (se = 0.029 )
## Likelihood ratio test= 0.76 on 1 df, p=0.4
## Wald test = 0.9 on 1 df, p=0.3
## Score (logrank) test = 0.9 on 1 df, p=0.3
##
##
## [[12]]
## Call:
## coxph(formula = formula, data = train_set)
##
## n= 231, number of events= 139
##
## coef exp(coef) se(coef) z Pr(>|z|)
## MRI_normal -0.0773 0.9256 0.5083 -0.152 0.879
##
## exp(coef) exp(-coef) lower .95 upper .95
## MRI_normal 0.9256 1.08 0.3418 2.507
##
## Concordance= 0.501 (se = 0.009 )
## Likelihood ratio test= 0.02 on 1 df, p=0.9
## Wald test = 0.02 on 1 df, p=0.9
## Score (logrank) test = 0.02 on 1 df, p=0.9
##
##
## [[13]]
## Call:
## coxph(formula = formula, data = train_set)
##
## n= 231, number of events= 139
##
## coef exp(coef) se(coef) z Pr(>|z|)
## MRI_side -0.0848 0.9187 0.1277 -0.664 0.507
##
## exp(coef) exp(-coef) lower .95 upper .95
## MRI_side 0.9187 1.088 0.7153 1.18
##
## Concordance= 0.526 (se = 0.024 )
## Likelihood ratio test= 0.45 on 1 df, p=0.5
## Wald test = 0.44 on 1 df, p=0.5
## Score (logrank) test = 0.44 on 1 df, p=0.5
##
##
## [[14]]
## Call:
## coxph(formula = formula, data = train_set)
##
## n= 231, number of events= 139
##
## coef exp(coef) se(coef) z Pr(>|z|)
## MRI_lobar 0.1636 1.1778 0.1530 1.069 0.285
##
## exp(coef) exp(-coef) lower .95 upper .95
## MRI_lobar 1.178 0.8491 0.8726 1.59
##
## Concordance= 0.523 (se = 0.018 )
## Likelihood ratio test= 1.1 on 1 df, p=0.3
## Wald test = 1.14 on 1 df, p=0.3
## Score (logrank) test = 1.14 on 1 df, p=0.3
##
##
## [[15]]
## Call:
## coxph(formula = formula, data = train_set)
##
## n= 231, number of events= 139
##
## coef exp(coef) se(coef) z Pr(>|z|)
## MRI_temp 0.09689 1.10174 0.12206 0.794 0.427
##
## exp(coef) exp(-coef) lower .95 upper .95
## MRI_temp 1.102 0.9077 0.8673 1.4
##
## Concordance= 0.528 (se = 0.024 )
## Likelihood ratio test= 0.61 on 1 df, p=0.4
## Wald test = 0.63 on 1 df, p=0.4
## Score (logrank) test = 0.63 on 1 df, p=0.4
##
##
## [[16]]
## Call:
## coxph(formula = formula, data = train_set)
##
## n= 231, number of events= 139
##
## coef exp(coef) se(coef) z Pr(>|z|)
## EEG_ictal_side -0.1061 0.8993 0.1141 -0.93 0.352
##
## exp(coef) exp(-coef) lower .95 upper .95
## EEG_ictal_side 0.8993 1.112 0.7192 1.125
##
## Concordance= 0.515 (se = 0.026 )
## Likelihood ratio test= 0.89 on 1 df, p=0.3
## Wald test = 0.87 on 1 df, p=0.4
## Score (logrank) test = 0.87 on 1 df, p=0.4
##
##
## [[17]]
## Call:
## coxph(formula = formula, data = train_set)
##
## n= 231, number of events= 139
##
## coef exp(coef) se(coef) z Pr(>|z|)
## EEG_ictal_temp 0.03739 1.03810 0.18275 0.205 0.838
##
## exp(coef) exp(-coef) lower .95 upper .95
## EEG_ictal_temp 1.038 0.9633 0.7256 1.485
##
## Concordance= 0.506 (se = 0.021 )
## Likelihood ratio test= 0.04 on 1 df, p=0.8
## Wald test = 0.04 on 1 df, p=0.8
## Score (logrank) test = 0.04 on 1 df, p=0.8
##
##
## [[18]]
## Call:
## coxph(formula = formula, data = train_set)
##
## n= 231, number of events= 139
##
## coef exp(coef) se(coef) z Pr(>|z|)
## EEG_ictal_focal 0.03127 1.03176 0.18457 0.169 0.865
##
## exp(coef) exp(-coef) lower .95 upper .95
## EEG_ictal_focal 1.032 0.9692 0.7186 1.481
##
## Concordance= 0.495 (se = 0.023 )
## Likelihood ratio test= 0.03 on 1 df, p=0.9
## Wald test = 0.03 on 1 df, p=0.9
## Score (logrank) test = 0.03 on 1 df, p=0.9
##
##
## [[19]]
## Call:
## coxph(formula = formula, data = train_set)
##
## n= 231, number of events= 139
##
## coef exp(coef) se(coef) z Pr(>|z|)
## EEG_interictal_normal 0.0375 1.0382 0.2246 0.167 0.867
##
## exp(coef) exp(-coef) lower .95 upper .95
## EEG_interictal_normal 1.038 0.9632 0.6685 1.612
##
## Concordance= 0.508 (se = 0.018 )
## Likelihood ratio test= 0.03 on 1 df, p=0.9
## Wald test = 0.03 on 1 df, p=0.9
## Score (logrank) test = 0.03 on 1 df, p=0.9
##
##
## [[20]]
## Call:
## coxph(formula = formula, data = train_set)
##
## n= 231, number of events= 139
##
## coef exp(coef) se(coef) z Pr(>|z|)
## icEEG NA NA 0 NA NA
##
## exp(coef) exp(-coef) lower .95 upper .95
## icEEG NA NA NA NA
##
## Concordance= 0.5 (se = 0 )
## Likelihood ratio test= 0 on 0 df, p=1
## Wald test = NA on 0 df, p=NA
## Score (logrank) test = 0 on 0 df, p=1
##
##
## [[21]]
## Call:
## coxph(formula = formula, data = train_set)
##
## n= 231, number of events= 139
##
## coef exp(coef) se(coef) z Pr(>|z|)
## PET -0.1412 0.8683 0.3661 -0.386 0.7
##
## exp(coef) exp(-coef) lower .95 upper .95
## PET 0.8683 1.152 0.4237 1.78
##
## Concordance= 0.509 (se = 0.011 )
## Likelihood ratio test= 0.16 on 1 df, p=0.7
## Wald test = 0.15 on 1 df, p=0.7
## Score (logrank) test = 0.15 on 1 df, p=0.7
##
##
## [[22]]
## Call:
## coxph(formula = formula, data = train_set)
##
## n= 231, number of events= 139
##
## coef exp(coef) se(coef) z Pr(>|z|)
## PET_side 0.02443 1.02473 0.13416 0.182 0.855
##
## exp(coef) exp(-coef) lower .95 upper .95
## PET_side 1.025 0.9759 0.7878 1.333
##
## Concordance= 0.507 (se = 0.011 )
## Likelihood ratio test= 0.03 on 1 df, p=0.9
## Wald test = 0.03 on 1 df, p=0.9
## Score (logrank) test = 0.03 on 1 df, p=0.9
##
##
## [[23]]
## Call:
## coxph(formula = formula, data = train_set)
##
## n= 231, number of events= 139
##
## coef exp(coef) se(coef) z Pr(>|z|)
## learning_disability 0.05369 1.05515 0.41770 0.129 0.898
##
## exp(coef) exp(-coef) lower .95 upper .95
## learning_disability 1.055 0.9477 0.4653 2.393
##
## Concordance= 0.504 (se = 0.011 )
## Likelihood ratio test= 0.02 on 1 df, p=0.9
## Wald test = 0.02 on 1 df, p=0.9
## Score (logrank) test = 0.02 on 1 df, p=0.9
##
##
## [[24]]
## Call:
## coxph(formula = formula, data = train_set)
##
## n= 231, number of events= 139
##
## coef exp(coef) se(coef) z Pr(>|z|)
## psychiatric_pre_any -0.2705 0.7630 0.1737 -1.557 0.119
##
## exp(coef) exp(-coef) lower .95 upper .95
## psychiatric_pre_any 0.763 1.311 0.5428 1.073
##
## Concordance= 0.542 (se = 0.023 )
## Likelihood ratio test= 2.46 on 1 df, p=0.1
## Wald test = 2.42 on 1 df, p=0.1
## Score (logrank) test = 2.44 on 1 df, p=0.1
##
##
## [[25]]
## Call:
## coxph(formula = formula, data = train_set)
##
## n= 231, number of events= 139
##
## coef exp(coef) se(coef) z Pr(>|z|)
## opside -0.1476 0.8627 0.1698 -0.869 0.385
##
## exp(coef) exp(-coef) lower .95 upper .95
## opside 0.8627 1.159 0.6185 1.203
##
## Concordance= 0.531 (se = 0.024 )
## Likelihood ratio test= 0.75 on 1 df, p=0.4
## Wald test = 0.76 on 1 df, p=0.4
## Score (logrank) test = 0.76 on 1 df, p=0.4
##
##
## [[26]]
## Call:
## coxph(formula = formula, data = train_set)
##
## n= 231, number of events= 139
##
## coef exp(coef) se(coef) z Pr(>|z|)
## optemp -0.1298 0.8783 0.2736 -0.474 0.635
##
## exp(coef) exp(-coef) lower .95 upper .95
## optemp 0.8783 1.139 0.5137 1.502
##
## Concordance= 0.501 (se = 0.013 )
## Likelihood ratio test= 0.22 on 1 df, p=0.6
## Wald test = 0.22 on 1 df, p=0.6
## Score (logrank) test = 0.23 on 1 df, p=0.6
##
##
## [[27]]
## Call:
## coxph(formula = formula, data = train_set)
##
## n= 231, number of events= 139
##
## coef exp(coef) se(coef) z Pr(>|z|)
## opextent -0.1102 0.8957 0.2361 -0.467 0.641
##
## exp(coef) exp(-coef) lower .95 upper .95
## opextent 0.8957 1.117 0.5639 1.423
##
## Concordance= 0.516 (se = 0.017 )
## Likelihood ratio test= 0.21 on 1 df, p=0.6
## Wald test = 0.22 on 1 df, p=0.6
## Score (logrank) test = 0.22 on 1 df, p=0.6
##
##
## [[28]]
## Call:
## coxph(formula = formula, data = train_set)
##
## n= 231, number of events= 139
##
## coef exp(coef) se(coef) z Pr(>|z|)
## op_incomplete NA NA 0 NA NA
##
## exp(coef) exp(-coef) lower .95 upper .95
## op_incomplete NA NA NA NA
##
## Concordance= 0.5 (se = 0 )
## Likelihood ratio test= 0 on 0 df, p=1
## Wald test = NA on 0 df, p=NA
## Score (logrank) test = 0 on 0 df, p=1
##
##
## [[29]]
## Call:
## coxph(formula = formula, data = train_set)
##
## n= 231, number of events= 139
##
## coef exp(coef) se(coef) z Pr(>|z|)
## pathology_HS -0.1104 0.8955 0.1815 -0.608 0.543
##
## exp(coef) exp(-coef) lower .95 upper .95
## pathology_HS 0.8955 1.117 0.6274 1.278
##
## Concordance= 0.514 (se = 0.022 )
## Likelihood ratio test= 0.36 on 1 df, p=0.5
## Wald test = 0.37 on 1 df, p=0.5
## Score (logrank) test = 0.37 on 1 df, p=0.5
##
##
## [[30]]
## Call:
## coxph(formula = formula, data = train_set)
##
## n= 231, number of events= 139
##
## coef exp(coef) se(coef) z Pr(>|z|)
## pathology_FCD 0.6356 1.8882 0.4579 1.388 0.165
##
## exp(coef) exp(-coef) lower .95 upper .95
## pathology_FCD 1.888 0.5296 0.7696 4.633
##
## Concordance= 0.512 (se = 0.01 )
## Likelihood ratio test= 1.6 on 1 df, p=0.2
## Wald test = 1.93 on 1 df, p=0.2
## Score (logrank) test = 1.99 on 1 df, p=0.2
##
##
## [[31]]
## Call:
## coxph(formula = formula, data = train_set)
##
## n= 231, number of events= 139
##
## coef exp(coef) se(coef) z Pr(>|z|)
## pathology_DNT 0.2160 1.2412 0.2471 0.874 0.382
##
## exp(coef) exp(-coef) lower .95 upper .95
## pathology_DNT 1.241 0.8057 0.7647 2.014
##
## Concordance= 0.51 (se = 0.015 )
## Likelihood ratio test= 0.73 on 1 df, p=0.4
## Wald test = 0.76 on 1 df, p=0.4
## Score (logrank) test = 0.77 on 1 df, p=0.4
##
##
## [[32]]
## Call:
## coxph(formula = formula, data = train_set)
##
## n= 231, number of events= 139
##
## coef exp(coef) se(coef) z Pr(>|z|)
## pathology_CAV -0.2713 0.7624 0.3285 -0.826 0.409
##
## exp(coef) exp(-coef) lower .95 upper .95
## pathology_CAV 0.7624 1.312 0.4005 1.451
##
## Concordance= 0.505 (se = 0.015 )
## Likelihood ratio test= 0.74 on 1 df, p=0.4
## Wald test = 0.68 on 1 df, p=0.4
## Score (logrank) test = 0.69 on 1 df, p=0.4
##
##
## [[33]]
## Call:
## coxph(formula = formula, data = train_set)
##
## n= 231, number of events= 139
##
## coef exp(coef) se(coef) z Pr(>|z|)
## pathology_GL 0.7011 2.0159 0.4569 1.534 0.125
##
## exp(coef) exp(-coef) lower .95 upper .95
## pathology_GL 2.016 0.4961 0.8233 4.936
##
## Concordance= 0.506 (se = 0.005 )
## Likelihood ratio test= 1.92 on 1 df, p=0.2
## Wald test = 2.35 on 1 df, p=0.1
## Score (logrank) test = 2.45 on 1 df, p=0.1
##
##
## [[34]]
## Call:
## coxph(formula = formula, data = train_set)
##
## n= 231, number of events= 139
##
## coef exp(coef) se(coef) z Pr(>|z|)
## pathology_dual 0.9931 2.6996 0.5133 1.935 0.053 .
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## exp(coef) exp(-coef) lower .95 upper .95
## pathology_dual 2.7 0.3704 0.9871 7.382
##
## Concordance= 0.513 (se = 0.009 )
## Likelihood ratio test= 2.82 on 1 df, p=0.09
## Wald test = 3.74 on 1 df, p=0.05
## Score (logrank) test = 4.06 on 1 df, p=0.04
##
##
## [[35]]
## Call:
## coxph(formula = formula, data = train_set)
##
## n= 231, number of events= 139
##
## coef exp(coef) se(coef) z Pr(>|z|)
## pathology_other 0.03625 1.03691 0.34506 0.105 0.916
##
## exp(coef) exp(-coef) lower .95 upper .95
## pathology_other 1.037 0.9644 0.5273 2.039
##
## Concordance= 0.503 (se = 0.013 )
## Likelihood ratio test= 0.01 on 1 df, p=0.9
## Wald test = 0.01 on 1 df, p=0.9
## Score (logrank) test = 0.01 on 1 df, p=0.9
##
##
## [[36]]
## Call:
## coxph(formula = formula, data = train_set)
##
## n= 231, number of events= 139
##
## coef exp(coef) se(coef) z Pr(>|z|)
## pathology_normal NA NA 0 NA NA
##
## exp(coef) exp(-coef) lower .95 upper .95
## pathology_normal NA NA NA NA
##
## Concordance= 0.5 (se = 0 )
## Likelihood ratio test= 0 on 0 df, p=1
## Wald test = NA on 0 df, p=NA
## Score (logrank) test = 0 on 0 df, p=1
##
##
## [[37]]
## Call:
## coxph(formula = formula, data = train_set)
##
## n= 231, number of events= 139
##
## coef exp(coef) se(coef) z Pr(>|z|)
## acutepostszauras 0.1336 1.1429 0.3023 0.442 0.659
##
## exp(coef) exp(-coef) lower .95 upper .95
## acutepostszauras 1.143 0.875 0.632 2.067
##
## Concordance= 0.506 (se = 0.013 )
## Likelihood ratio test= 0.19 on 1 df, p=0.7
## Wald test = 0.2 on 1 df, p=0.7
## Score (logrank) test = 0.2 on 1 df, p=0.7
##
##
## [[38]]
## Call:
## coxph(formula = formula, data = train_set)
##
## n= 231, number of events= 139
##
## coef exp(coef) se(coef) z Pr(>|z|)
## sz 0.1489 1.1605 0.1875 0.794 0.427
##
## exp(coef) exp(-coef) lower .95 upper .95
## sz 1.161 0.8617 0.8037 1.676
##
## Concordance= 0.536 (se = 0.023 )
## Likelihood ratio test= 0.62 on 1 df, p=0.4
## Wald test = 0.63 on 1 df, p=0.4
## Score (logrank) test = 0.63 on 1 df, p=0.4
##
##
## [[39]]
## Call:
## coxph(formula = formula, data = train_set)
##
## n= 231, number of events= 139
##
## coef exp(coef) se(coef) z Pr(>|z|)
## szaurafree1st -0.1147 0.8916 0.7134 -0.161 0.872
##
## exp(coef) exp(-coef) lower .95 upper .95
## szaurafree1st 0.8916 1.122 0.2203 3.609
##
## Concordance= 0.499 (se = 0.004 )
## Likelihood ratio test= 0.02 on 1 df, p=0.9
## Wald test = 0.03 on 1 df, p=0.9
## Score (logrank) test = 0.03 on 1 df, p=0.9
##
##
## [[40]]
## Call:
## coxph(formula = formula, data = train_set)
##
## n= 231, number of events= 139
##
## coef exp(coef) se(coef) z Pr(>|z|)
## aura 0.4979 1.6452 0.2528 1.969 0.0489 *
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## exp(coef) exp(-coef) lower .95 upper .95
## aura 1.645 0.6078 1.002 2.7
##
## Concordance= 0.523 (se = 0.016 )
## Likelihood ratio test= 3.43 on 1 df, p=0.06
## Wald test = 3.88 on 1 df, p=0.05
## Score (logrank) test = 3.96 on 1 df, p=0.05
##
##
## [[41]]
## Call:
## coxph(formula = formula, data = train_set)
##
## n= 231, number of events= 139
##
## coef exp(coef) se(coef) z Pr(>|z|)
## szaura 0.2573 1.2934 0.1747 1.472 0.141
##
## exp(coef) exp(-coef) lower .95 upper .95
## szaura 1.293 0.7732 0.9183 1.822
##
## Concordance= 0.541 (se = 0.023 )
## Likelihood ratio test= 2.12 on 1 df, p=0.1
## Wald test = 2.17 on 1 df, p=0.1
## Score (logrank) test = 2.18 on 1 df, p=0.1
##
##
## [[42]]
## Call:
## coxph(formula = formula, data = train_set)
##
## n= 231, number of events= 139
##
## coef exp(coef) se(coef) z Pr(>|z|)
## began_wd 1.817e+01 7.805e+07 2.235e+03 0.008 0.994
##
## exp(coef) exp(-coef) lower .95 upper .95
## began_wd 78054414 1.281e-08 0 Inf
##
## Concordance= 0.553 (se = 0.012 )
## Likelihood ratio test= 29.6 on 1 df, p=5e-08
## Wald test = 0 on 1 df, p=1
## Score (logrank) test = 15.63 on 1 df, p=8e-05
##
##
## [[43]]
## Call:
## coxph(formula = formula, data = train_set)
##
## n= 231, number of events= 139
##
## coef exp(coef) se(coef) z Pr(>|z|)
## wd_all 2.086e+01 1.147e+09 2.129e+03 0.01 0.992
##
## exp(coef) exp(-coef) lower .95 upper .95
## wd_all 1.147e+09 8.719e-10 0 Inf
##
## Concordance= 0.777 (se = 0.017 )
## Likelihood ratio test= 255.9 on 1 df, p=<2e-16
## Wald test = 0 on 1 df, p=1
## Score (logrank) test = 200.6 on 1 df, p=<2e-16
##
##
## [[44]]
## Call:
## coxph(formula = formula, data = train_set)
##
## n= 231, number of events= 139
##
## coef exp(coef) se(coef) z Pr(>|z|)
## aeds -0.2321 0.7928 0.1077 -2.156 0.0311 *
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## exp(coef) exp(-coef) lower .95 upper .95
## aeds 0.7928 1.261 0.642 0.9791
##
## Concordance= 0.563 (se = 0.026 )
## Likelihood ratio test= 4.82 on 1 df, p=0.03
## Wald test = 4.65 on 1 df, p=0.03
## Score (logrank) test = 4.63 on 1 df, p=0.03
##
##
## [[45]]
## Call:
## coxph(formula = formula, data = train_set)
##
## n= 231, number of events= 139
##
## coef exp(coef) se(coef) z Pr(>|z|)
## age_onset -0.019788 0.980406 0.009341 -2.118 0.0341 *
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## exp(coef) exp(-coef) lower .95 upper .95
## age_onset 0.9804 1.02 0.9626 0.9985
##
## Concordance= 0.549 (se = 0.028 )
## Likelihood ratio test= 4.78 on 1 df, p=0.03
## Wald test = 4.49 on 1 df, p=0.03
## Score (logrank) test = 4.51 on 1 df, p=0.03
##
##
## [[46]]
## Call:
## coxph(formula = formula, data = train_set)
##
## n= 231, number of events= 139
##
## coef exp(coef) se(coef) z Pr(>|z|)
## duration 0.0003681 1.0003681 0.0078620 0.047 0.963
##
## exp(coef) exp(-coef) lower .95 upper .95
## duration 1 0.9996 0.9851 1.016
##
## Concordance= 0.505 (se = 0.03 )
## Likelihood ratio test= 0 on 1 df, p=1
## Wald test = 0 on 1 df, p=1
## Score (logrank) test = 0 on 1 df, p=1
##
##
## [[47]]
## Call:
## coxph(formula = formula, data = train_set)
##
## n= 231, number of events= 139
##
## coef exp(coef) se(coef) z Pr(>|z|)
## age_at_surgery -0.01923 0.98095 0.00915 -2.102 0.0356 *
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## exp(coef) exp(-coef) lower .95 upper .95
## age_at_surgery 0.981 1.019 0.9635 0.9987
##
## Concordance= 0.534 (se = 0.028 )
## Likelihood ratio test= 4.59 on 1 df, p=0.03
## Wald test = 4.42 on 1 df, p=0.04
## Score (logrank) test = 4.43 on 1 df, p=0.04
##
##
## [[48]]
## Call:
## coxph(formula = formula, data = train_set)
##
## n= 231, number of events= 139
##
## coef exp(coef) se(coef) z Pr(>|z|)
## sz_time -0.01453 0.98558 0.01454 -0.999 0.318
##
## exp(coef) exp(-coef) lower .95 upper .95
## sz_time 0.9856 1.015 0.9579 1.014
##
## Concordance= 0.554 (se = 0.028 )
## Likelihood ratio test= 1.01 on 1 df, p=0.3
## Wald test = 1 on 1 df, p=0.3
## Score (logrank) test = 1 on 1 df, p=0.3
##
##
## [[49]]
## Call:
## coxph(formula = formula, data = train_set)
##
## n= 231, number of events= 139
##
## coef exp(coef) se(coef) z Pr(>|z|)
## aura_time -0.01553 0.98459 0.01563 -0.994 0.32
##
## exp(coef) exp(-coef) lower .95 upper .95
## aura_time 0.9846 1.016 0.9549 1.015
##
## Concordance= 0.529 (se = 0.03 )
## Likelihood ratio test= 1.01 on 1 df, p=0.3
## Wald test = 0.99 on 1 df, p=0.3
## Score (logrank) test = 0.99 on 1 df, p=0.3
##
##
## [[50]]
## Call:
## coxph(formula = formula, data = train_set)
##
## n= 231, number of events= 139
##
## coef exp(coef) se(coef) z Pr(>|z|)
## szaura_time -0.02219 0.97805 0.01519 -1.461 0.144
##
## exp(coef) exp(-coef) lower .95 upper .95
## szaura_time 0.9781 1.022 0.9494 1.008
##
## Concordance= 0.568 (se = 0.028 )
## Likelihood ratio test= 2.19 on 1 df, p=0.1
## Wald test = 2.13 on 1 df, p=0.1
## Score (logrank) test = 2.14 on 1 df, p=0.1
##
##
## [[51]]
## Call:
## coxph(formula = formula, data = train_set)
##
## n= 231, number of events= 139
##
## coef exp(coef) se(coef) z Pr(>|z|)
## began_wd_time -0.2314 0.7934 0.0424 -5.457 4.85e-08 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## exp(coef) exp(-coef) lower .95 upper .95
## began_wd_time 0.7934 1.26 0.7302 0.8622
##
## Concordance= 0.711 (se = 0.024 )
## Likelihood ratio test= 52.01 on 1 df, p=6e-13
## Wald test = 29.77 on 1 df, p=5e-08
## Score (logrank) test = 33.03 on 1 df, p=9e-09
##
##
## [[52]]
## Call:
## coxph(formula = formula, data = train_set)
##
## n= 231, number of events= 139
##
## coef exp(coef) se(coef) z Pr(>|z|)
## age_began_wd -0.036077 0.964566 0.008539 -4.225 2.39e-05 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## exp(coef) exp(-coef) lower .95 upper .95
## age_began_wd 0.9646 1.037 0.9486 0.9808
##
## Concordance= 0.587 (se = 0.028 )
## Likelihood ratio test= 19.37 on 1 df, p=1e-05
## Wald test = 17.85 on 1 df, p=2e-05
## Score (logrank) test = 18.09 on 1 df, p=2e-05
##
##
## [[53]]
## Call:
## coxph(formula = formula, data = train_set)
##
## n= 231, number of events= 139
##
## coef exp(coef) se(coef) z Pr(>|z|)
## wd_all_time -7.353e+01 1.170e-32 3.304e+01 -2.225 0.0261 *
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## exp(coef) exp(-coef) lower .95 upper .95
## wd_all_time 1.17e-32 8.547e+31 8.725e-61 0.0001569
##
## Concordance= 0.997 (se = 0.001 )
## Likelihood ratio test= 853.2 on 1 df, p=<2e-16
## Wald test = 4.95 on 1 df, p=0.03
## Score (logrank) test = 150 on 1 df, p=<2e-16
##
##
## [[54]]
## Call:
## coxph(formula = formula, data = train_set)
##
## n= 231, number of events= 139
##
## coef exp(coef) se(coef) z Pr(>|z|)
## years_follow_up -0.002939 0.997065 0.015345 -0.192 0.848
##
## exp(coef) exp(-coef) lower .95 upper .95
## years_follow_up 0.9971 1.003 0.9675 1.028
##
## Concordance= 0.504 (se = 0.028 )
## Likelihood ratio test= 0.04 on 1 df, p=0.8
## Wald test = 0.04 on 1 df, p=0.8
## Score (logrank) test = 0.04 on 1 df, p=0.8
km_train<- survfit(Surv(train_set$wd_all_time, train_set$wd_all) ~ 1, data= train_set, type =
"kaplan-meier", conf.type = "plain")
summary(km_train, times = c(0,1,2,5,10,15, 20,23))## Call: survfit(formula = Surv(train_set$wd_all_time, train_set$wd_all) ~
## 1, data = train_set, type = "kaplan-meier", conf.type = "plain")
##
## time n.risk n.event survival std.err lower 95% CI upper 95% CI
## 0 231 0 1.000 0.0000 1.000 1.000
## 1 222 16 0.931 0.0167 0.898 0.963
## 2 212 24 0.826 0.0250 0.777 0.875
## 5 106 68 0.508 0.0341 0.441 0.575
## 10 46 26 0.346 0.0356 0.276 0.416
## 15 18 4 0.300 0.0379 0.226 0.374
## 20 8 1 0.281 0.0399 0.203 0.360
## 23 5 0 0.281 0.0399 0.203 0.360
km1_train<- ggsurvplot(km_train, data = train_set, xlab = "Time (years)", ylab = "Proportion of seizure free patients after withdrawal", palette = 'black', xlim = c(0,15),ylim = c(0,1), break.time.by = 5, font.x =14 ,font.y = 14, font.tickslab = 10, show.legend.text = F)
km1_trainmodel1_train <-
coxph(
Surv(time = train_set$wd_all_time, event = train_set$wd_all) ~ train_set$auras + train_set$began_wd_time + train_set$age_onset + train_set$age_began_wd + train_set$gtcs + train_set$psychiatric_pre_any + train_set$MRI_normal + train_set$pathology_HS + train_set$aeds,
x = TRUE,
y = TRUE,
data = train_set
)
print(model1_train)## Call:
## coxph(formula = Surv(time = train_set$wd_all_time, event = train_set$wd_all) ~
## train_set$auras + train_set$began_wd_time + train_set$age_onset +
## train_set$age_began_wd + train_set$gtcs + train_set$psychiatric_pre_any +
## train_set$MRI_normal + train_set$pathology_HS + train_set$aeds,
## data = train_set, x = TRUE, y = TRUE)
##
## coef exp(coef) se(coef) z
## train_set$auras 0.554326 1.740767 0.413590 1.340
## train_set$began_wd_time -0.254371 0.775404 0.046008 -5.529
## train_set$age_onset -0.019424 0.980763 0.010620 -1.829
## train_set$age_began_wd -0.007808 0.992222 0.009306 -0.839
## train_set$gtcs -0.086362 0.917262 0.183091 -0.472
## train_set$psychiatric_pre_any -0.275136 0.759469 0.177715 -1.548
## train_set$MRI_normal -0.187814 0.828769 0.519240 -0.362
## train_set$pathology_HS -0.049602 0.951608 0.189493 -0.262
## train_set$aeds -0.333842 0.716167 0.109418 -3.051
## p
## train_set$auras 0.18015
## train_set$began_wd_time 3.22e-08
## train_set$age_onset 0.06739
## train_set$age_began_wd 0.40146
## train_set$gtcs 0.63715
## train_set$psychiatric_pre_any 0.12158
## train_set$MRI_normal 0.71757
## train_set$pathology_HS 0.79351
## train_set$aeds 0.00228
##
## Likelihood ratio test=74.08 on 9 df, p=2.405e-12
## n= 231, number of events= 139
vif(model1_train)## train_set$auras train_set$began_wd_time
## 1.126545 1.157324
## train_set$age_onset train_set$age_began_wd
## 1.174220 1.193941
## train_set$gtcs train_set$psychiatric_pre_any
## 1.049804 1.037069
## train_set$MRI_normal train_set$pathology_HS
## 1.042206 1.088040
## train_set$aeds
## 1.042624
step(model1_train, direction = "both")## Start: AIC=1300.37
## Surv(time = train_set$wd_all_time, event = train_set$wd_all) ~
## train_set$auras + train_set$began_wd_time + train_set$age_onset +
## train_set$age_began_wd + train_set$gtcs + train_set$psychiatric_pre_any +
## train_set$MRI_normal + train_set$pathology_HS + train_set$aeds
##
## Df AIC
## - train_set$pathology_HS 1 1298.4
## - train_set$MRI_normal 1 1298.5
## - train_set$gtcs 1 1298.6
## - train_set$age_began_wd 1 1299.1
## - train_set$auras 1 1299.9
## <none> 1300.4
## - train_set$psychiatric_pre_any 1 1300.8
## - train_set$age_onset 1 1301.8
## - train_set$aeds 1 1308.5
## - train_set$began_wd_time 1 1344.4
##
## Step: AIC=1298.44
## Surv(time = train_set$wd_all_time, event = train_set$wd_all) ~
## train_set$auras + train_set$began_wd_time + train_set$age_onset +
## train_set$age_began_wd + train_set$gtcs + train_set$psychiatric_pre_any +
## train_set$MRI_normal + train_set$aeds
##
## Df AIC
## - train_set$MRI_normal 1 1296.6
## - train_set$gtcs 1 1296.7
## - train_set$age_began_wd 1 1297.2
## - train_set$auras 1 1298.1
## <none> 1298.4
## - train_set$psychiatric_pre_any 1 1298.9
## - train_set$age_onset 1 1299.8
## + train_set$pathology_HS 1 1300.4
## - train_set$aeds 1 1306.5
## - train_set$began_wd_time 1 1342.9
##
## Step: AIC=1296.56
## Surv(time = train_set$wd_all_time, event = train_set$wd_all) ~
## train_set$auras + train_set$began_wd_time + train_set$age_onset +
## train_set$age_began_wd + train_set$gtcs + train_set$psychiatric_pre_any +
## train_set$aeds
##
## Df AIC
## - train_set$gtcs 1 1294.8
## - train_set$age_began_wd 1 1295.3
## - train_set$auras 1 1296.3
## <none> 1296.6
## - train_set$psychiatric_pre_any 1 1296.9
## - train_set$age_onset 1 1298.0
## + train_set$MRI_normal 1 1298.4
## + train_set$pathology_HS 1 1298.5
## - train_set$aeds 1 1304.5
## - train_set$began_wd_time 1 1341.2
##
## Step: AIC=1294.85
## Surv(time = train_set$wd_all_time, event = train_set$wd_all) ~
## train_set$auras + train_set$began_wd_time + train_set$age_onset +
## train_set$age_began_wd + train_set$psychiatric_pre_any +
## train_set$aeds
##
## Df AIC
## - train_set$age_began_wd 1 1293.6
## - train_set$auras 1 1294.6
## <none> 1294.8
## - train_set$psychiatric_pre_any 1 1295.4
## - train_set$age_onset 1 1296.2
## + train_set$gtcs 1 1296.6
## + train_set$MRI_normal 1 1296.7
## + train_set$pathology_HS 1 1296.8
## - train_set$aeds 1 1303.0
## - train_set$began_wd_time 1 1339.8
##
## Step: AIC=1293.6
## Surv(time = train_set$wd_all_time, event = train_set$wd_all) ~
## train_set$auras + train_set$began_wd_time + train_set$age_onset +
## train_set$psychiatric_pre_any + train_set$aeds
##
## Df AIC
## - train_set$auras 1 1293.2
## <none> 1293.6
## - train_set$psychiatric_pre_any 1 1294.1
## + train_set$age_began_wd 1 1294.8
## + train_set$gtcs 1 1295.3
## + train_set$MRI_normal 1 1295.5
## + train_set$pathology_HS 1 1295.5
## - train_set$age_onset 1 1296.8
## - train_set$aeds 1 1302.6
## - train_set$began_wd_time 1 1350.0
##
## Step: AIC=1293.22
## Surv(time = train_set$wd_all_time, event = train_set$wd_all) ~
## train_set$began_wd_time + train_set$age_onset + train_set$psychiatric_pre_any +
## train_set$aeds
##
## Df AIC
## <none> 1293.2
## + train_set$auras 1 1293.6
## - train_set$psychiatric_pre_any 1 1294.0
## + train_set$age_began_wd 1 1294.6
## + train_set$gtcs 1 1294.8
## + train_set$pathology_HS 1 1295.0
## + train_set$MRI_normal 1 1295.0
## - train_set$age_onset 1 1296.5
## - train_set$aeds 1 1302.4
## - train_set$began_wd_time 1 1350.5
## Call:
## coxph(formula = Surv(time = train_set$wd_all_time, event = train_set$wd_all) ~
## train_set$began_wd_time + train_set$age_onset + train_set$psychiatric_pre_any +
## train_set$aeds, data = train_set, x = TRUE, y = TRUE)
##
## coef exp(coef) se(coef) z p
## train_set$began_wd_time -0.250527 0.778391 0.043315 -5.784 7.3e-09
## train_set$age_onset -0.021935 0.978304 0.009806 -2.237 0.02530
## train_set$psychiatric_pre_any -0.286702 0.750735 0.174715 -1.641 0.10080
## train_set$aeds -0.356764 0.699937 0.110788 -3.220 0.00128
##
## Likelihood ratio test=71.22 on 4 df, p=1.254e-14
## n= 231, number of events= 139
model1f_train <-
coxph(
Surv(time = train_set$wd_all_time, event = train_set$wd_all) ~ train_set$aeds + train_set$began_wd_time + train_set$age_onset + train_set$psychiatric_pre_any
)
summary(model1f_train)## Call:
## coxph(formula = Surv(time = train_set$wd_all_time, event = train_set$wd_all) ~
## train_set$aeds + train_set$began_wd_time + train_set$age_onset +
## train_set$psychiatric_pre_any)
##
## n= 231, number of events= 139
##
## coef exp(coef) se(coef) z
## train_set$aeds -0.356764 0.699937 0.110788 -3.220
## train_set$began_wd_time -0.250527 0.778391 0.043315 -5.784
## train_set$age_onset -0.021935 0.978304 0.009806 -2.237
## train_set$psychiatric_pre_any -0.286702 0.750735 0.174715 -1.641
## Pr(>|z|)
## train_set$aeds 0.00128 **
## train_set$began_wd_time 7.3e-09 ***
## train_set$age_onset 0.02530 *
## train_set$psychiatric_pre_any 0.10080
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## exp(coef) exp(-coef) lower .95 upper .95
## train_set$aeds 0.6999 1.429 0.5633 0.8697
## train_set$began_wd_time 0.7784 1.285 0.7150 0.8474
## train_set$age_onset 0.9783 1.022 0.9597 0.9973
## train_set$psychiatric_pre_any 0.7507 1.332 0.5331 1.0573
##
## Concordance= 0.737 (se = 0.021 )
## Likelihood ratio test= 71.22 on 4 df, p=1e-14
## Wald test = 46.78 on 4 df, p=2e-09
## Score (logrank) test = 48.08 on 4 df, p=9e-10
fitmodel1f_train <-
cph(
Surv(time = wd_all_time, event = wd_all) ~ began_wd_time + aeds + psychiatric_pre_any + age_onset,
data = train_set,
x = TRUE,
y = TRUE,
surv = TRUE,
time.inc = 2
)
fitmodel1f_train## Cox Proportional Hazards Model
##
## cph(formula = Surv(time = wd_all_time, event = wd_all) ~ began_wd_time +
## aeds + psychiatric_pre_any + age_onset, data = train_set,
## x = TRUE, y = TRUE, surv = TRUE, time.inc = 2)
##
## Model Tests Discrimination
## Indexes
## Obs 231 LR chi2 71.22 R2 0.266
## Events 139 d.f. 4 Dxy 0.473
## Center -1.9599 Pr(> chi2) 0.0000 g 0.965
## Score chi2 48.08 gr 2.625
## Pr(> chi2) 0.0000
##
## Coef S.E. Wald Z Pr(>|Z|)
## began_wd_time -0.2505 0.0433 -5.78 <0.0001
## aeds -0.3568 0.1108 -3.22 0.0013
## psychiatric_pre_any -0.2867 0.1747 -1.64 0.1008
## age_onset -0.0219 0.0098 -2.24 0.0253
##
rms::validate(fitmodel1f_train, dxy = TRUE, B = 1000)## index.orig training test optimism index.corrected n
## Dxy 0.4732 0.4839 0.4598 0.0241 0.4491 1000
## R2 0.2661 0.2813 0.2553 0.0260 0.2401 1000
## Slope 1.0000 1.0000 0.9176 0.0824 0.9176 1000
## D 0.0518 0.0558 0.0493 0.0065 0.0453 1000
## U -0.0015 -0.0015 0.0012 -0.0027 0.0012 1000
## Q 0.0532 0.0573 0.0481 0.0092 0.0441 1000
## g 0.9652 1.0286 0.9284 0.1001 0.8650 1000
fitmode1f_train <-
cph(
Surv(time = wd_all_time, event = wd_all) ~ began_wd_time + aeds + psychiatric_pre_any + age_onset ,
data = train_set,
x = TRUE,
y = TRUE,
surv = TRUE,
time.inc = 2
)
calibrate1_train <- calibrate(
fitmodel1f_train,
u = 2,
cmethod = 'KM',
B = 1000,
m = 40
)## Using Cox survival estimates at 2 Days
plot(calibrate1_train, xlim = c(0,1),ylim = c(0,1))fitmodel1f_train2 <-
cph(
Surv(time = wd_all_time, event = wd_all) ~ began_wd_time + aeds + psychiatric_pre_any + age_onset,
data = train_set,
x = TRUE,
y = TRUE,
surv = TRUE,
time.inc = 5
)
calibrate_train2 <- calibrate(
fitmodel1f_train2,
u = 5,
cmethod = 'KM',
B = 1000,
m = 40
)## Using Cox survival estimates at 5 Days
plot2 <- plot(calibrate_train2, xlim = c(0,1),ylim = c(0,1))lapply(c('auras',
'withdraw1',
'sex',
'childconvul ',
'neuro_insult',
'status_epilepticus ',
'family_history',
'non_epileptic',
'gtcs',
'gtcs6',
'numsz6',
'MRI_normal',
'MRI_side',
'MRI_lobar',
'MRI_temp',
'EEG_ictal_side',
'EEG_ictal_temp',
'EEG_ictal_focal',
'EEG_interictal_normal',
'icEEG',
'PET',
'PET_side',
'learning_disability',
'psychiatric_pre_any',
'opside',
'optemp',
'opextent',
'op_incomplete',
'pathology_HS ',
'pathology_FCD',
'pathology_DNT',
'pathology_CAV',
'pathology_GL',
'pathology_dual',
'pathology_other',
'pathology_normal',
'acutepostszauras',
'sz',
'szaurafree1st',
'aura',
'szaura',
'began_wd',
'wd_all',
'aeds',
'age_onset ',
'duration',
'age_at_surgery',
'sz_time',
'aura_time',
'szaura_time',
'began_wd_time',
'age_began_wd',
'wd_all_time',
'years_follow_up'),
function(var) {
formula <-
as.formula(paste("Surv(time = test_set$sz_time, event = test_set$sz) ~", var))
res.logist <-
coxph(formula, data = test_set)
summary(res.logist)
}
)## [[1]]
## Call:
## coxph(formula = formula, data = test_set)
##
## n= 119, number of events= 34
##
## coef exp(coef) se(coef) z Pr(>|z|)
## auras 1.3802 3.9757 0.5392 2.56 0.0105 *
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## exp(coef) exp(-coef) lower .95 upper .95
## auras 3.976 0.2515 1.382 11.44
##
## Concordance= 0.55 (se = 0.029 )
## Likelihood ratio test= 4.71 on 1 df, p=0.03
## Wald test = 6.55 on 1 df, p=0.01
## Score (logrank) test = 7.66 on 1 df, p=0.006
##
##
## [[2]]
## Call:
## coxph(formula = formula, data = test_set)
##
## n= 119, number of events= 34
##
## coef exp(coef) se(coef) z Pr(>|z|)
## withdraw1 -0.8671 0.4202 0.3439 -2.522 0.0117 *
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## exp(coef) exp(-coef) lower .95 upper .95
## withdraw1 0.4202 2.38 0.2141 0.8244
##
## Concordance= 0.601 (se = 0.044 )
## Likelihood ratio test= 6.17 on 1 df, p=0.01
## Wald test = 6.36 on 1 df, p=0.01
## Score (logrank) test = 6.76 on 1 df, p=0.009
##
##
## [[3]]
## Call:
## coxph(formula = formula, data = test_set)
##
## n= 119, number of events= 34
##
## coef exp(coef) se(coef) z Pr(>|z|)
## sex -0.6488 0.5227 0.3543 -1.831 0.0671 .
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## exp(coef) exp(-coef) lower .95 upper .95
## sex 0.5227 1.913 0.261 1.047
##
## Concordance= 0.586 (se = 0.045 )
## Likelihood ratio test= 3.47 on 1 df, p=0.06
## Wald test = 3.35 on 1 df, p=0.07
## Score (logrank) test = 3.47 on 1 df, p=0.06
##
##
## [[4]]
## Call:
## coxph(formula = formula, data = test_set)
##
## n= 119, number of events= 34
##
## coef exp(coef) se(coef) z Pr(>|z|)
## childconvul -0.2456 0.7823 0.3431 -0.716 0.474
##
## exp(coef) exp(-coef) lower .95 upper .95
## childconvul 0.7823 1.278 0.3993 1.533
##
## Concordance= 0.537 (se = 0.046 )
## Likelihood ratio test= 0.51 on 1 df, p=0.5
## Wald test = 0.51 on 1 df, p=0.5
## Score (logrank) test = 0.51 on 1 df, p=0.5
##
##
## [[5]]
## Call:
## coxph(formula = formula, data = test_set)
##
## n= 119, number of events= 34
##
## coef exp(coef) se(coef) z Pr(>|z|)
## neuro_insult -0.2811 0.7549 0.3460 -0.813 0.416
##
## exp(coef) exp(-coef) lower .95 upper .95
## neuro_insult 0.7549 1.325 0.3832 1.487
##
## Concordance= 0.529 (se = 0.046 )
## Likelihood ratio test= 0.67 on 1 df, p=0.4
## Wald test = 0.66 on 1 df, p=0.4
## Score (logrank) test = 0.66 on 1 df, p=0.4
##
##
## [[6]]
## Call:
## coxph(formula = formula, data = test_set)
##
## n= 119, number of events= 34
##
## coef exp(coef) se(coef) z Pr(>|z|)
## status_epilepticus 0.689 1.992 0.485 1.421 0.155
##
## exp(coef) exp(-coef) lower .95 upper .95
## status_epilepticus 1.992 0.5021 0.7698 5.153
##
## Concordance= 0.538 (se = 0.03 )
## Likelihood ratio test= 1.72 on 1 df, p=0.2
## Wald test = 2.02 on 1 df, p=0.2
## Score (logrank) test = 2.1 on 1 df, p=0.1
##
##
## [[7]]
## Call:
## coxph(formula = formula, data = test_set)
##
## n= 119, number of events= 34
##
## coef exp(coef) se(coef) z Pr(>|z|)
## family_history 0.8574 2.3569 0.3475 2.467 0.0136 *
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## exp(coef) exp(-coef) lower .95 upper .95
## family_history 2.357 0.4243 1.193 4.657
##
## Concordance= 0.597 (se = 0.043 )
## Likelihood ratio test= 5.74 on 1 df, p=0.02
## Wald test = 6.09 on 1 df, p=0.01
## Score (logrank) test = 6.46 on 1 df, p=0.01
##
##
## [[8]]
## Call:
## coxph(formula = formula, data = test_set)
##
## n= 119, number of events= 34
##
## coef exp(coef) se(coef) z Pr(>|z|)
## non_epileptic -0.3479 0.7062 1.0157 -0.343 0.732
##
## exp(coef) exp(-coef) lower .95 upper .95
## non_epileptic 0.7062 1.416 0.09647 5.17
##
## Concordance= 0.506 (se = 0.014 )
## Likelihood ratio test= 0.13 on 1 df, p=0.7
## Wald test = 0.12 on 1 df, p=0.7
## Score (logrank) test = 0.12 on 1 df, p=0.7
##
##
## [[9]]
## Call:
## coxph(formula = formula, data = test_set)
##
## n= 119, number of events= 34
##
## coef exp(coef) se(coef) z Pr(>|z|)
## gtcs 0.2348 1.2647 0.3889 0.604 0.546
##
## exp(coef) exp(-coef) lower .95 upper .95
## gtcs 1.265 0.7907 0.5902 2.71
##
## Concordance= 0.542 (se = 0.039 )
## Likelihood ratio test= 0.38 on 1 df, p=0.5
## Wald test = 0.36 on 1 df, p=0.5
## Score (logrank) test = 0.37 on 1 df, p=0.5
##
##
## [[10]]
## Call:
## coxph(formula = formula, data = test_set)
##
## n= 119, number of events= 34
##
## coef exp(coef) se(coef) z Pr(>|z|)
## gtcs6 0.8323 2.2985 0.3439 2.42 0.0155 *
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## exp(coef) exp(-coef) lower .95 upper .95
## gtcs6 2.298 0.4351 1.171 4.51
##
## Concordance= 0.634 (se = 0.043 )
## Likelihood ratio test= 5.7 on 1 df, p=0.02
## Wald test = 5.86 on 1 df, p=0.02
## Score (logrank) test = 6.2 on 1 df, p=0.01
##
##
## [[11]]
## Call:
## coxph(formula = formula, data = test_set)
##
## n= 119, number of events= 34
##
## coef exp(coef) se(coef) z Pr(>|z|)
## numsz6 0.008902 1.008942 0.004514 1.972 0.0486 *
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## exp(coef) exp(-coef) lower .95 upper .95
## numsz6 1.009 0.9911 1 1.018
##
## Concordance= 0.488 (se = 0.059 )
## Likelihood ratio test= 2.71 on 1 df, p=0.1
## Wald test = 3.89 on 1 df, p=0.05
## Score (logrank) test = 3.82 on 1 df, p=0.05
##
##
## [[12]]
## Call:
## coxph(formula = formula, data = test_set)
##
## n= 119, number of events= 34
##
## coef exp(coef) se(coef) z Pr(>|z|)
## MRI_normal -0.1561 0.8555 1.0166 -0.154 0.878
##
## exp(coef) exp(-coef) lower .95 upper .95
## MRI_normal 0.8555 1.169 0.1166 6.275
##
## Concordance= 0.501 (se = 0.018 )
## Likelihood ratio test= 0.02 on 1 df, p=0.9
## Wald test = 0.02 on 1 df, p=0.9
## Score (logrank) test = 0.02 on 1 df, p=0.9
##
##
## [[13]]
## Call:
## coxph(formula = formula, data = test_set)
##
## n= 119, number of events= 34
##
## coef exp(coef) se(coef) z Pr(>|z|)
## MRI_side 0.03995 1.04076 0.25240 0.158 0.874
##
## exp(coef) exp(-coef) lower .95 upper .95
## MRI_side 1.041 0.9608 0.6346 1.707
##
## Concordance= 0.518 (se = 0.048 )
## Likelihood ratio test= 0.02 on 1 df, p=0.9
## Wald test = 0.03 on 1 df, p=0.9
## Score (logrank) test = 0.03 on 1 df, p=0.9
##
##
## [[14]]
## Call:
## coxph(formula = formula, data = test_set)
##
## n= 119, number of events= 34
##
## coef exp(coef) se(coef) z Pr(>|z|)
## MRI_lobar -0.2769 0.7581 0.4981 -0.556 0.578
##
## exp(coef) exp(-coef) lower .95 upper .95
## MRI_lobar 0.7581 1.319 0.2856 2.012
##
## Concordance= 0.517 (se = 0.027 )
## Likelihood ratio test= 0.34 on 1 df, p=0.6
## Wald test = 0.31 on 1 df, p=0.6
## Score (logrank) test = 0.31 on 1 df, p=0.6
##
##
## [[15]]
## Call:
## coxph(formula = formula, data = test_set)
##
## n= 119, number of events= 34
##
## coef exp(coef) se(coef) z Pr(>|z|)
## MRI_temp 0.1352 1.1448 0.2387 0.566 0.571
##
## exp(coef) exp(-coef) lower .95 upper .95
## MRI_temp 1.145 0.8735 0.717 1.828
##
## Concordance= 0.524 (se = 0.047 )
## Likelihood ratio test= 0.31 on 1 df, p=0.6
## Wald test = 0.32 on 1 df, p=0.6
## Score (logrank) test = 0.32 on 1 df, p=0.6
##
##
## [[16]]
## Call:
## coxph(formula = formula, data = test_set)
##
## n= 119, number of events= 34
##
## coef exp(coef) se(coef) z Pr(>|z|)
## EEG_ictal_side -0.1406 0.8688 0.2426 -0.579 0.562
##
## exp(coef) exp(-coef) lower .95 upper .95
## EEG_ictal_side 0.8688 1.151 0.54 1.398
##
## Concordance= 0.532 (se = 0.047 )
## Likelihood ratio test= 0.35 on 1 df, p=0.6
## Wald test = 0.34 on 1 df, p=0.6
## Score (logrank) test = 0.34 on 1 df, p=0.6
##
##
## [[17]]
## Call:
## coxph(formula = formula, data = test_set)
##
## n= 119, number of events= 34
##
## coef exp(coef) se(coef) z Pr(>|z|)
## EEG_ictal_temp -0.07221 0.93034 0.39707 -0.182 0.856
##
## exp(coef) exp(-coef) lower .95 upper .95
## EEG_ictal_temp 0.9303 1.075 0.4272 2.026
##
## Concordance= 0.509 (se = 0.037 )
## Likelihood ratio test= 0.03 on 1 df, p=0.9
## Wald test = 0.03 on 1 df, p=0.9
## Score (logrank) test = 0.03 on 1 df, p=0.9
##
##
## [[18]]
## Call:
## coxph(formula = formula, data = test_set)
##
## n= 119, number of events= 34
##
## coef exp(coef) se(coef) z Pr(>|z|)
## EEG_ictal_focal 0.4143 1.5133 0.4844 0.855 0.392
##
## exp(coef) exp(-coef) lower .95 upper .95
## EEG_ictal_focal 1.513 0.6608 0.5856 3.911
##
## Concordance= 0.534 (se = 0.032 )
## Likelihood ratio test= 0.8 on 1 df, p=0.4
## Wald test = 0.73 on 1 df, p=0.4
## Score (logrank) test = 0.74 on 1 df, p=0.4
##
##
## [[19]]
## Call:
## coxph(formula = formula, data = test_set)
##
## n= 119, number of events= 34
##
## coef exp(coef) se(coef) z Pr(>|z|)
## EEG_interictal_normal 0.2758 1.3176 0.4248 0.649 0.516
##
## exp(coef) exp(-coef) lower .95 upper .95
## EEG_interictal_normal 1.318 0.7589 0.573 3.03
##
## Concordance= 0.501 (se = 0.031 )
## Likelihood ratio test= 0.4 on 1 df, p=0.5
## Wald test = 0.42 on 1 df, p=0.5
## Score (logrank) test = 0.42 on 1 df, p=0.5
##
##
## [[20]]
## Call:
## coxph(formula = formula, data = test_set)
##
## n= 119, number of events= 34
##
## coef exp(coef) se(coef) z Pr(>|z|)
## icEEG NA NA 0 NA NA
##
## exp(coef) exp(-coef) lower .95 upper .95
## icEEG NA NA NA NA
##
## Concordance= 0.5 (se = 0 )
## Likelihood ratio test= 0 on 0 df, p=1
## Wald test = NA on 0 df, p=NA
## Score (logrank) test = 0 on 0 df, p=1
##
##
## [[21]]
## Call:
## coxph(formula = formula, data = test_set)
##
## n= 119, number of events= 34
##
## coef exp(coef) se(coef) z Pr(>|z|)
## PET -0.2727 0.7613 1.0173 -0.268 0.789
##
## exp(coef) exp(-coef) lower .95 upper .95
## PET 0.7613 1.314 0.1037 5.59
##
## Concordance= 0.504 (se = 0.018 )
## Likelihood ratio test= 0.08 on 1 df, p=0.8
## Wald test = 0.07 on 1 df, p=0.8
## Score (logrank) test = 0.07 on 1 df, p=0.8
##
##
## [[22]]
## Call:
## coxph(formula = formula, data = test_set)
##
## n= 119, number of events= 34
##
## coef exp(coef) se(coef) z Pr(>|z|)
## PET_side 0.2192 1.2451 0.4238 0.517 0.605
##
## exp(coef) exp(-coef) lower .95 upper .95
## PET_side 1.245 0.8032 0.5425 2.857
##
## Concordance= 0.504 (se = 0.018 )
## Likelihood ratio test= 0.33 on 1 df, p=0.6
## Wald test = 0.27 on 1 df, p=0.6
## Score (logrank) test = 0.28 on 1 df, p=0.6
##
##
## [[23]]
## Call:
## coxph(formula = formula, data = test_set)
##
## n= 119, number of events= 34
##
## coef exp(coef) se(coef) z Pr(>|z|)
## learning_disability -0.04645 0.95462 0.72932 -0.064 0.949
##
## exp(coef) exp(-coef) lower .95 upper .95
## learning_disability 0.9546 1.048 0.2286 3.987
##
## Concordance= 0.495 (se = 0.025 )
## Likelihood ratio test= 0 on 1 df, p=0.9
## Wald test = 0 on 1 df, p=0.9
## Score (logrank) test = 0 on 1 df, p=0.9
##
##
## [[24]]
## Call:
## coxph(formula = formula, data = test_set)
##
## n= 119, number of events= 34
##
## coef exp(coef) se(coef) z Pr(>|z|)
## psychiatric_pre_any 0.5436 1.7221 0.3450 1.576 0.115
##
## exp(coef) exp(-coef) lower .95 upper .95
## psychiatric_pre_any 1.722 0.5807 0.8758 3.386
##
## Concordance= 0.582 (se = 0.045 )
## Likelihood ratio test= 2.48 on 1 df, p=0.1
## Wald test = 2.48 on 1 df, p=0.1
## Score (logrank) test = 2.54 on 1 df, p=0.1
##
##
## [[25]]
## Call:
## coxph(formula = formula, data = test_set)
##
## n= 119, number of events= 34
##
## coef exp(coef) se(coef) z Pr(>|z|)
## opside -0.06939 0.93296 0.34414 -0.202 0.84
##
## exp(coef) exp(-coef) lower .95 upper .95
## opside 0.933 1.072 0.4753 1.831
##
## Concordance= 0.494 (se = 0.046 )
## Likelihood ratio test= 0.04 on 1 df, p=0.8
## Wald test = 0.04 on 1 df, p=0.8
## Score (logrank) test = 0.04 on 1 df, p=0.8
##
##
## [[26]]
## Call:
## coxph(formula = formula, data = test_set)
##
## n= 119, number of events= 34
##
## coef exp(coef) se(coef) z Pr(>|z|)
## optemp 0.2416 1.2733 0.6047 0.4 0.689
##
## exp(coef) exp(-coef) lower .95 upper .95
## optemp 1.273 0.7853 0.3892 4.166
##
## Concordance= 0.503 (se = 0.031 )
## Likelihood ratio test= 0.17 on 1 df, p=0.7
## Wald test = 0.16 on 1 df, p=0.7
## Score (logrank) test = 0.16 on 1 df, p=0.7
##
##
## [[27]]
## Call:
## coxph(formula = formula, data = test_set)
##
## n= 119, number of events= 34
##
## coef exp(coef) se(coef) z Pr(>|z|)
## opextent 0.04277 1.04370 0.45715 0.094 0.925
##
## exp(coef) exp(-coef) lower .95 upper .95
## opextent 1.044 0.9581 0.426 2.557
##
## Concordance= 0.507 (se = 0.024 )
## Likelihood ratio test= 0.01 on 1 df, p=0.9
## Wald test = 0.01 on 1 df, p=0.9
## Score (logrank) test = 0.01 on 1 df, p=0.9
##
##
## [[28]]
## Call:
## coxph(formula = formula, data = test_set)
##
## n= 119, number of events= 34
##
## coef exp(coef) se(coef) z Pr(>|z|)
## op_incomplete NA NA 0 NA NA
##
## exp(coef) exp(-coef) lower .95 upper .95
## op_incomplete NA NA NA NA
##
## Concordance= 0.5 (se = 0 )
## Likelihood ratio test= 0 on 0 df, p=1
## Wald test = NA on 0 df, p=NA
## Score (logrank) test = 0 on 0 df, p=1
##
##
## [[29]]
## Call:
## coxph(formula = formula, data = test_set)
##
## n= 119, number of events= 34
##
## coef exp(coef) se(coef) z Pr(>|z|)
## pathology_HS 0.1339 1.1433 0.4045 0.331 0.741
##
## exp(coef) exp(-coef) lower .95 upper .95
## pathology_HS 1.143 0.8746 0.5174 2.526
##
## Concordance= 0.515 (se = 0.039 )
## Likelihood ratio test= 0.11 on 1 df, p=0.7
## Wald test = 0.11 on 1 df, p=0.7
## Score (logrank) test = 0.11 on 1 df, p=0.7
##
##
## [[30]]
## Call:
## coxph(formula = formula, data = test_set)
##
## n= 119, number of events= 34
##
## coef exp(coef) se(coef) z Pr(>|z|)
## pathology_FCD 0.3818 1.4649 1.0164 0.376 0.707
##
## exp(coef) exp(-coef) lower .95 upper .95
## pathology_FCD 1.465 0.6827 0.1998 10.74
##
## Concordance= 0.509 (se = 0.02 )
## Likelihood ratio test= 0.13 on 1 df, p=0.7
## Wald test = 0.14 on 1 df, p=0.7
## Score (logrank) test = 0.14 on 1 df, p=0.7
##
##
## [[31]]
## Call:
## coxph(formula = formula, data = test_set)
##
## n= 119, number of events= 34
##
## coef exp(coef) se(coef) z Pr(>|z|)
## pathology_DNT 0.1423 1.1529 0.5328 0.267 0.789
##
## exp(coef) exp(-coef) lower .95 upper .95
## pathology_DNT 1.153 0.8674 0.4058 3.275
##
## Concordance= 0.509 (se = 0.028 )
## Likelihood ratio test= 0.07 on 1 df, p=0.8
## Wald test = 0.07 on 1 df, p=0.8
## Score (logrank) test = 0.07 on 1 df, p=0.8
##
##
## [[32]]
## Call:
## coxph(formula = formula, data = test_set)
##
## n= 119, number of events= 34
##
## coef exp(coef) se(coef) z Pr(>|z|)
## pathology_CAV -0.1199 0.8870 0.7290 -0.165 0.869
##
## exp(coef) exp(-coef) lower .95 upper .95
## pathology_CAV 0.887 1.127 0.2125 3.702
##
## Concordance= 0.515 (se = 0.015 )
## Likelihood ratio test= 0.03 on 1 df, p=0.9
## Wald test = 0.03 on 1 df, p=0.9
## Score (logrank) test = 0.03 on 1 df, p=0.9
##
##
## [[33]]
## Call:
## coxph(formula = formula, data = test_set)
##
## n= 119, number of events= 34
##
## coef exp(coef) se(coef) z Pr(>|z|)
## pathology_GL 0.7669 2.1531 0.7303 1.05 0.294
##
## exp(coef) exp(-coef) lower .95 upper .95
## pathology_GL 2.153 0.4644 0.5146 9.009
##
## Concordance= 0.519 (se = 0.022 )
## Likelihood ratio test= 0.89 on 1 df, p=0.3
## Wald test = 1.1 on 1 df, p=0.3
## Score (logrank) test = 1.16 on 1 df, p=0.3
##
##
## [[34]]
## Call:
## coxph(formula = formula, data = test_set)
##
## n= 119, number of events= 34
##
## coef exp(coef) se(coef) z Pr(>|z|)
## pathology_dual 0.4037 1.4973 1.0181 0.396 0.692
##
## exp(coef) exp(-coef) lower .95 upper .95
## pathology_dual 1.497 0.6679 0.2035 11.01
##
## Concordance= 0.503 (se = 0.012 )
## Likelihood ratio test= 0.14 on 1 df, p=0.7
## Wald test = 0.16 on 1 df, p=0.7
## Score (logrank) test = 0.16 on 1 df, p=0.7
##
##
## [[35]]
## Call:
## coxph(formula = formula, data = test_set)
##
## n= 119, number of events= 34
##
## coef exp(coef) se(coef) z Pr(>|z|)
## pathology_other -1.709e+01 3.793e-08 3.732e+03 -0.005 0.996
##
## exp(coef) exp(-coef) lower .95 upper .95
## pathology_other 3.793e-08 26366865 0 Inf
##
## Concordance= 0.528 (se = 0.011 )
## Likelihood ratio test= 3.68 on 1 df, p=0.05
## Wald test = 0 on 1 df, p=1
## Score (logrank) test = 1.89 on 1 df, p=0.2
##
##
## [[36]]
## Call:
## coxph(formula = formula, data = test_set)
##
## n= 119, number of events= 34
##
## coef exp(coef) se(coef) z Pr(>|z|)
## pathology_normal NA NA 0 NA NA
##
## exp(coef) exp(-coef) lower .95 upper .95
## pathology_normal NA NA NA NA
##
## Concordance= 0.5 (se = 0 )
## Likelihood ratio test= 0 on 0 df, p=1
## Wald test = NA on 0 df, p=NA
## Score (logrank) test = 0 on 0 df, p=1
##
##
## [[37]]
## Call:
## coxph(formula = formula, data = test_set)
##
## n= 119, number of events= 34
##
## coef exp(coef) se(coef) z Pr(>|z|)
## acutepostszauras -0.7486 0.4730 1.0155 -0.737 0.461
##
## exp(coef) exp(-coef) lower .95 upper .95
## acutepostszauras 0.473 2.114 0.06464 3.461
##
## Concordance= 0.521 (se = 0.012 )
## Likelihood ratio test= 0.69 on 1 df, p=0.4
## Wald test = 0.54 on 1 df, p=0.5
## Score (logrank) test = 0.57 on 1 df, p=0.5
##
##
## [[38]]
## Call:
## coxph(formula = formula, data = test_set)
##
## n= 119, number of events= 34
##
## coef exp(coef) se(coef) z Pr(>|z|)
## sz 2.292e+01 9.024e+09 6.424e+03 0.004 0.997
##
## exp(coef) exp(-coef) lower .95 upper .95
## sz 9.024e+09 1.108e-10 0 Inf
##
## Concordance= 0.92 (se = 0.015 )
## Likelihood ratio test= 125.8 on 1 df, p=<2e-16
## Wald test = 0 on 1 df, p=1
## Score (logrank) test = 164.6 on 1 df, p=<2e-16
##
##
## [[39]]
## Call:
## coxph(formula = formula, data = test_set)
##
## n= 119, number of events= 34
##
## coef exp(coef) se(coef) z Pr(>|z|)
## szaurafree1st NA NA 0 NA NA
##
## exp(coef) exp(-coef) lower .95 upper .95
## szaurafree1st NA NA NA NA
##
## Concordance= 0.52 (se = 0.02 )
## Likelihood ratio test= 9.56 on 0 df, p=<2e-16
## Wald test = NA on 0 df, p=NA
## Score (logrank) test = 118 on 0 df, p=<2e-16
##
##
## [[40]]
## Call:
## coxph(formula = formula, data = test_set)
##
## n= 119, number of events= 34
##
## coef exp(coef) se(coef) z Pr(>|z|)
## aura 1.3300 3.7810 0.4278 3.109 0.00188 **
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## exp(coef) exp(-coef) lower .95 upper .95
## aura 3.781 0.2645 1.635 8.744
##
## Concordance= 0.569 (se = 0.03 )
## Likelihood ratio test= 7.39 on 1 df, p=0.007
## Wald test = 9.67 on 1 df, p=0.002
## Score (logrank) test = 11.16 on 1 df, p=8e-04
##
##
## [[41]]
## Call:
## coxph(formula = formula, data = test_set)
##
## n= 119, number of events= 34
##
## coef exp(coef) se(coef) z Pr(>|z|)
## szaura 2.221e+01 4.440e+09 5.208e+03 0.004 0.997
##
## exp(coef) exp(-coef) lower .95 upper .95
## szaura 4.44e+09 2.252e-10 0 Inf
##
## Concordance= 0.909 (se = 0.016 )
## Likelihood ratio test= 114.2 on 1 df, p=<2e-16
## Wald test = 0 on 1 df, p=1
## Score (logrank) test = 140.4 on 1 df, p=<2e-16
##
##
## [[42]]
## Call:
## coxph(formula = formula, data = test_set)
##
## n= 119, number of events= 34
##
## coef exp(coef) se(coef) z Pr(>|z|)
## began_wd -1.1637 0.3123 0.4654 -2.5 0.0124 *
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## exp(coef) exp(-coef) lower .95 upper .95
## began_wd 0.3123 3.202 0.1255 0.7776
##
## Concordance= 0.569 (se = 0.035 )
## Likelihood ratio test= 4.96 on 1 df, p=0.03
## Wald test = 6.25 on 1 df, p=0.01
## Score (logrank) test = 6.95 on 1 df, p=0.008
##
##
## [[43]]
## Call:
## coxph(formula = formula, data = test_set)
##
## n= 119, number of events= 34
##
## coef exp(coef) se(coef) z Pr(>|z|)
## wd_all -0.3083 0.7347 0.3435 -0.897 0.37
##
## exp(coef) exp(-coef) lower .95 upper .95
## wd_all 0.7347 1.361 0.3747 1.441
##
## Concordance= 0.544 (se = 0.045 )
## Likelihood ratio test= 0.8 on 1 df, p=0.4
## Wald test = 0.81 on 1 df, p=0.4
## Score (logrank) test = 0.81 on 1 df, p=0.4
##
##
## [[44]]
## Call:
## coxph(formula = formula, data = test_set)
##
## n= 119, number of events= 34
##
## coef exp(coef) se(coef) z Pr(>|z|)
## aeds 0.7178 2.0499 0.2628 2.732 0.0063 **
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## exp(coef) exp(-coef) lower .95 upper .95
## aeds 2.05 0.4878 1.225 3.431
##
## Concordance= 0.625 (se = 0.051 )
## Likelihood ratio test= 7.71 on 1 df, p=0.005
## Wald test = 7.46 on 1 df, p=0.006
## Score (logrank) test = 7.6 on 1 df, p=0.006
##
##
## [[45]]
## Call:
## coxph(formula = formula, data = test_set)
##
## n= 119, number of events= 34
##
## coef exp(coef) se(coef) z Pr(>|z|)
## age_onset -0.01391 0.98619 0.01906 -0.73 0.466
##
## exp(coef) exp(-coef) lower .95 upper .95
## age_onset 0.9862 1.014 0.95 1.024
##
## Concordance= 0.55 (se = 0.049 )
## Likelihood ratio test= 0.56 on 1 df, p=0.5
## Wald test = 0.53 on 1 df, p=0.5
## Score (logrank) test = 0.53 on 1 df, p=0.5
##
##
## [[46]]
## Call:
## coxph(formula = formula, data = test_set)
##
## n= 119, number of events= 34
##
## coef exp(coef) se(coef) z Pr(>|z|)
## duration 0.02321 1.02348 0.01261 1.84 0.0658 .
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## exp(coef) exp(-coef) lower .95 upper .95
## duration 1.023 0.9771 0.9985 1.049
##
## Concordance= 0.608 (se = 0.048 )
## Likelihood ratio test= 3.31 on 1 df, p=0.07
## Wald test = 3.39 on 1 df, p=0.07
## Score (logrank) test = 3.43 on 1 df, p=0.06
##
##
## [[47]]
## Call:
## coxph(formula = formula, data = test_set)
##
## n= 119, number of events= 34
##
## coef exp(coef) se(coef) z Pr(>|z|)
## age_at_surgery 0.02431 1.02461 0.01550 1.569 0.117
##
## exp(coef) exp(-coef) lower .95 upper .95
## age_at_surgery 1.025 0.976 0.994 1.056
##
## Concordance= 0.579 (se = 0.054 )
## Likelihood ratio test= 2.42 on 1 df, p=0.1
## Wald test = 2.46 on 1 df, p=0.1
## Score (logrank) test = 2.49 on 1 df, p=0.1
##
##
## [[48]]
## Call:
## coxph(formula = formula, data = test_set)
##
## n= 119, number of events= 34
##
## coef exp(coef) se(coef) z Pr(>|z|)
## sz_time -7.886e+01 5.669e-35 1.354e+02 -0.582 0.56
##
## exp(coef) exp(-coef) lower .95 upper .95
## sz_time 5.669e-35 1.764e+34 2.936e-150 1.095e+81
##
## Concordance= 0.991 (se = 0.003 )
## Likelihood ratio test= 207.3 on 1 df, p=<2e-16
## Wald test = 0.34 on 1 df, p=0.6
## Score (logrank) test = 57.81 on 1 df, p=3e-14
##
##
## [[49]]
## Call:
## coxph(formula = formula, data = test_set)
##
## n= 119, number of events= 34
##
## coef exp(coef) se(coef) z Pr(>|z|)
## aura_time -0.05997 0.94180 0.03094 -1.938 0.0526 .
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## exp(coef) exp(-coef) lower .95 upper .95
## aura_time 0.9418 1.062 0.8864 1.001
##
## Concordance= 0.62 (se = 0.058 )
## Likelihood ratio test= 4.03 on 1 df, p=0.04
## Wald test = 3.76 on 1 df, p=0.05
## Score (logrank) test = 3.83 on 1 df, p=0.05
##
##
## [[50]]
## Call:
## coxph(formula = formula, data = test_set)
##
## n= 119, number of events= 34
##
## coef exp(coef) se(coef) z Pr(>|z|)
## szaura_time -0.53891 0.58338 0.08999 -5.988 2.12e-09 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## exp(coef) exp(-coef) lower .95 upper .95
## szaura_time 0.5834 1.714 0.489 0.6959
##
## Concordance= 0.972 (se = 0.007 )
## Likelihood ratio test= 88.72 on 1 df, p=<2e-16
## Wald test = 35.86 on 1 df, p=2e-09
## Score (logrank) test = 54.21 on 1 df, p=2e-13
##
##
## [[51]]
## Call:
## coxph(formula = formula, data = test_set)
##
## n= 119, number of events= 34
##
## coef exp(coef) se(coef) z Pr(>|z|)
## began_wd_time -0.03165 0.96884 0.04990 -0.634 0.526
##
## exp(coef) exp(-coef) lower .95 upper .95
## began_wd_time 0.9688 1.032 0.8786 1.068
##
## Concordance= 0.494 (se = 0.052 )
## Likelihood ratio test= 0.44 on 1 df, p=0.5
## Wald test = 0.4 on 1 df, p=0.5
## Score (logrank) test = 0.4 on 1 df, p=0.5
##
##
## [[52]]
## Call:
## coxph(formula = formula, data = test_set)
##
## n= 119, number of events= 34
##
## coef exp(coef) se(coef) z Pr(>|z|)
## age_began_wd 0.01902 1.01920 0.01489 1.277 0.202
##
## exp(coef) exp(-coef) lower .95 upper .95
## age_began_wd 1.019 0.9812 0.9899 1.049
##
## Concordance= 0.567 (se = 0.053 )
## Likelihood ratio test= 1.62 on 1 df, p=0.2
## Wald test = 1.63 on 1 df, p=0.2
## Score (logrank) test = 1.64 on 1 df, p=0.2
##
##
## [[53]]
## Call:
## coxph(formula = formula, data = test_set)
##
## n= 119, number of events= 34
##
## coef exp(coef) se(coef) z Pr(>|z|)
## wd_all_time -0.03718 0.96350 0.03444 -1.08 0.28
##
## exp(coef) exp(-coef) lower .95 upper .95
## wd_all_time 0.9635 1.038 0.9006 1.031
##
## Concordance= 0.616 (se = 0.053 )
## Likelihood ratio test= 1.26 on 1 df, p=0.3
## Wald test = 1.17 on 1 df, p=0.3
## Score (logrank) test = 1.18 on 1 df, p=0.3
##
##
## [[54]]
## Call:
## coxph(formula = formula, data = test_set)
##
## n= 119, number of events= 34
##
## coef exp(coef) se(coef) z Pr(>|z|)
## years_follow_up -0.02424 0.97605 0.03063 -0.791 0.429
##
## exp(coef) exp(-coef) lower .95 upper .95
## years_follow_up 0.9761 1.025 0.9192 1.036
##
## Concordance= 0.563 (se = 0.059 )
## Likelihood ratio test= 0.64 on 1 df, p=0.4
## Wald test = 0.63 on 1 df, p=0.4
## Score (logrank) test = 0.63 on 1 df, p=0.4
km_test<- survfit(Surv(test_set$wd_all_time, test_set$wd_all) ~ 1, data= test_set, type =
"kaplan-meier", conf.type = "plain")
summary(km_test, times = c(0,1,2,5,10,15, 20,23))## Call: survfit(formula = Surv(test_set$wd_all_time, test_set$wd_all) ~
## 1, data = test_set, type = "kaplan-meier", conf.type = "plain")
##
## time n.risk n.event survival std.err lower 95% CI upper 95% CI
## 0 119 0 1.000 0.0000 1.000 1.000
## 1 119 5 0.958 0.0184 0.922 0.994
## 2 110 12 0.855 0.0324 0.792 0.919
## 5 59 33 0.536 0.0487 0.441 0.632
## 10 27 12 0.380 0.0519 0.278 0.482
## 15 14 1 0.360 0.0528 0.256 0.464
## 20 6 0 0.360 0.0528 0.256 0.464
## 23 1 0 0.360 0.0528 0.256 0.464
km1_test<- ggsurvplot(km_test, data = test_set, xlab = "Time (years)", ylab = "Proportion of patients acheiving complete AED withdrawal", palette = 'black', xlim = c(0,15),ylim = c(0,1), break.time.by = 5, font.x =14 ,font.y = 10, font.tickslab = 10, show.legend.text = F, fun= 'event')
km1_testmodel1f_test <-
coxph(
Surv(time = test_set$wd_all_time, event = test_set$wd_all) ~ test_set$aeds+ test_set$began_wd_time + test_set$age_onset + test_set$psychiatric_pre_any
)
summary(model1f_test)## Call:
## coxph(formula = Surv(time = test_set$wd_all_time, event = test_set$wd_all) ~
## test_set$aeds + test_set$began_wd_time + test_set$age_onset +
## test_set$psychiatric_pre_any)
##
## n= 119, number of events= 63
##
## coef exp(coef) se(coef) z Pr(>|z|)
## test_set$aeds -0.28507 0.75196 0.19399 -1.470 0.141696
## test_set$began_wd_time -0.24832 0.78011 0.06877 -3.611 0.000305
## test_set$age_onset 0.01785 1.01801 0.01253 1.424 0.154511
## test_set$psychiatric_pre_any -0.10279 0.90232 0.25647 -0.401 0.688578
##
## test_set$aeds
## test_set$began_wd_time ***
## test_set$age_onset
## test_set$psychiatric_pre_any
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## exp(coef) exp(-coef) lower .95 upper .95
## test_set$aeds 0.7520 1.3299 0.5141 1.0998
## test_set$began_wd_time 0.7801 1.2819 0.6817 0.8927
## test_set$age_onset 1.0180 0.9823 0.9933 1.0433
## test_set$psychiatric_pre_any 0.9023 1.1083 0.5458 1.4916
##
## Concordance= 0.693 (se = 0.035 )
## Likelihood ratio test= 31.03 on 4 df, p=3e-06
## Wald test = 19.47 on 4 df, p=6e-04
## Score (logrank) test = 22.18 on 4 df, p=2e-04
fitmodel1f_train <-
cph(
Surv(time = wd_all_time, event = wd_all) ~ aeds+ began_wd_time + age_onset + psychiatric_pre_any,
data = test_set,
x = TRUE,
y = TRUE,
surv = TRUE,
time.inc = 2
)
fitmodel1f_train## Cox Proportional Hazards Model
##
## cph(formula = Surv(time = wd_all_time, event = wd_all) ~ aeds +
## began_wd_time + age_onset + psychiatric_pre_any, data = test_set,
## x = TRUE, y = TRUE, surv = TRUE, time.inc = 2)
##
## Model Tests Discrimination
## Indexes
## Obs 119 LR chi2 31.03 R2 0.232
## Events 63 d.f. 4 Dxy 0.385
## Center -1.2077 Pr(> chi2) 0.0000 g 0.941
## Score chi2 22.18 gr 2.562
## Pr(> chi2) 0.0002
##
## Coef S.E. Wald Z Pr(>|Z|)
## aeds -0.2851 0.1940 -1.47 0.1417
## began_wd_time -0.2482 0.0688 -3.61 0.0003
## age_onset 0.0178 0.0125 1.42 0.1545
## psychiatric_pre_any -0.1028 0.2565 -0.40 0.6886
##
rms::validate(fitmodel1f_train, dxy = TRUE, B = 1000)## index.orig training test optimism index.corrected n
## Dxy 0.3851 0.4187 0.3704 0.0482 0.3369 1000
## R2 0.2321 0.2555 0.2147 0.0407 0.1914 1000
## Slope 1.0000 1.0000 0.8525 0.1475 0.8525 1000
## D 0.0562 0.0638 0.0513 0.0124 0.0438 1000
## U -0.0037 -0.0038 0.0033 -0.0071 0.0033 1000
## Q 0.0600 0.0675 0.0480 0.0195 0.0405 1000
## g 0.9407 1.0423 0.8656 0.1767 0.7641 1000
fitmode1f_train <-
cph(
Surv(time = wd_all_time, event = wd_all) ~ aeds+ began_wd_time + age_onset + psychiatric_pre_any,
data = test_set,
x = TRUE,
y = TRUE,
surv = TRUE,
time.inc = 2
)
calibrate1_train <- calibrate(
fitmodel1f_train,
u = 2,
cmethod = 'KM',
B = 1000,
m = 20
)## Using Cox survival estimates at 2 Days
plot(calibrate1_train, xlim = c(0,1),ylim = c(0,1))fitmodel1f_train2 <-
cph(
Surv(time = wd_all_time, event = wd_all) ~ aeds+ began_wd_time + age_onset + psychiatric_pre_any,
data = test_set,
x = TRUE,
y = TRUE,
surv = TRUE,
time.inc = 5
)
calibrate_train2 <- calibrate(
fitmodel1f_train2,
u = 5,
cmethod = 'KM',
B = 1000,
m = 20
)## Using Cox survival estimates at 5 Days
plot2 <- plot(calibrate_train2, xlim = c(0,1),ylim = c(0,1))model <- coxph(
Surv(time = wd_all_time, event = wd_all) ~ aeds+ began_wd_time + age_onset + psychiatric_pre_any,
data = data)
summary(model)## Call:
## coxph(formula = Surv(time = wd_all_time, event = wd_all) ~ aeds +
## began_wd_time + age_onset + psychiatric_pre_any, data = data)
##
## n= 350, number of events= 202
##
## coef exp(coef) se(coef) z Pr(>|z|)
## aeds -0.352068 0.703232 0.097497 -3.611 0.000305 ***
## began_wd_time -0.251746 0.777442 0.036497 -6.898 5.29e-12 ***
## age_onset -0.008139 0.991894 0.007704 -1.056 0.290778
## psychiatric_pre_any -0.219736 0.802731 0.144076 -1.525 0.127226
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## exp(coef) exp(-coef) lower .95 upper .95
## aeds 0.7032 1.422 0.5809 0.8513
## began_wd_time 0.7774 1.286 0.7238 0.8351
## age_onset 0.9919 1.008 0.9770 1.0070
## psychiatric_pre_any 0.8027 1.246 0.6052 1.0647
##
## Concordance= 0.721 (se = 0.019 )
## Likelihood ratio test= 94.34 on 4 df, p=<2e-16
## Wald test = 58.48 on 4 df, p=6e-12
## Score (logrank) test = 63.34 on 4 df, p=6e-13
``{r, warning= FALSE} ddist <- datadist(data) options(datadist = ‘ddist’) fitmodel2f\(Design\)label <- c( “Number of AEDs at time of surgery”, “Time to begin withdrawal (Years from surgery)”, “Age at epilepsy onset (Years)”, “Presurgical psychiatric comorbidity (Yes=1, No=0)” )
surv.fitmodel2f <- Survival(fitmodel2f)
nomo2 <- nomogram( fitmodel2f, fun = list(function(x) surv.fitmodel2f(2, x), function(x) surv.fitmodel2f(5, x)), funlabel = c( “2-years AED freedom”, “5-years AED freedom” ), lp = F, fun.at = c(0.9, 0.8, 0.7, 0.6, 0.5, 0.4, 0.3, 0.2)
) pdf( “nomo2final.pdf”, width = cm(17), height = cm(10) )
plot( nomo2, cex.axis = 4, cex.var = 4.5 , col.grid = gray(c(0.8, 0.95)), theme(text = element_text( family = “Times New Roman”, face = “bold”, size = 20 )) )
dev.off
## Dynamic Nomogram
``{r, warning = FALSE}
data <- read.csv("/Users/carolinaferreiraatuesta/Documents/UCL/Reserach Project/Thesis Databases/Database_thesis_final_R.csv")
ddist<-datadist(data)
options(datadist='ddist')
web2 <-
cph(
Surv(time = Time, event = all) ~ age_at_surgery + drugs + time_begin + psychiatric_pre_any,
data = data
)
DNbuilder(
web2,
data = data,
clevel = 0.95,
covariate = c("numeric"),
ptype = c("1-st")
)