0.0.1 Download libraries

library(survminer)
library(survival)
library(readxl)
library(MatchIt)
library(stddiff)
library(tableone)
library(mice)
library(VIM)
library(table1)
library(pROC)
library(sensitivity)

0.0.2 Load Data and Handle Missings (Multiple Imputation)

datawithmissings <- read_excel("data_for_analysis.xlsx")
tempdata <- mice(datawithmissings, m = 5, maxit = 50, meth = 'pmm', seed = 500, printFlag = FALSE)
## Warning: Number of logged events: 251
data <- complete(tempdata,1)

1 Thrombolysis

1.1 Table One

data2 <- data

data2$male <- 
  factor(data2$male, levels=c(0,1),
         labels=c("Female ", 
                  "Male"))
 
data2$nihss_middle <- 
  factor(data2$nihss_middle, levels=c(0,1),
         labels=c("No", 
                  "Yes"))
data2$nihss_high <- 
  factor(data2$nihss_high, levels=c(0,1),
         labels=c("No", 
                  "Yes"))
data2$macro <- 
  factor(data2$macro, levels=c(0,1),
         labels=c("No", 
                  "Yes"))
data2$micro <- 
  factor(data2$micro, levels=c(0,1),
         labels=c("No", 
                  "Yes"))
data2$cortical <- 
  factor(data2$cortical, levels=c(0,1),
         labels=c("No", 
                  "Yes"))
data2$mca <- 
  factor(data2$mca, levels=c(0,1),
         labels=c("No", 
                  "Yes"))
data2$thrombolysis <- 
  factor(data2$thrombolysis, levels=c(0,1),
         labels=c("No thrombolysis", 
                  "Thrombolysis"))
data2$iv_thrombolysis <- 
  factor(data2$iv_thrombolysis, levels=c(0,1),
         labels=c("No", 
                  "Yes"))
data2$ia_thrombolysis <- 
  factor(data2$ia_thrombolysis, levels=c(0,1),
         labels=c("No", 
                  "Yes"))

data2$early <- 
  factor(data2$early, levels=c(0,1),
         labels=c("No", 
                  "Yes"))
data2$early_treatment <- 
  factor(data2$early_treatment, levels=c(0,1),
         labels=c("No", 
                  "Yes"))
data2$los <- 
  factor(data2$los, levels=c(0,1),
         labels=c("No late seizures", 
                  "Late seizures"))


label(data2$male)   <- "Sex"
label(data2$age)   <- "Age"
label(data2$source)   <- "Cohort"
label(data2$nihss_middle)    <- "NIHSS Middle"
label(data2$nihss_high) <- "NIHSS High"
label(data2$macro)   <- "Large-artery artherosclerosis(embolus/thrombosis)"
label(data2$micro)   <- "Small-vessel occulsion(lacune)"
label(data2$cortical)    <- "Cortical compromise"
label(data2$mca) <- "Middle cerebral artery compromise"
label(data2$iv_thrombolysis)   <- "IV thrombolysis"
label(data2$ia_thrombolysis)   <- "Intraarterial thrombolysis"
label(data2$thrombolysis)    <- "Thrombolysis"
label(data2$early) <- "Early seizures"
label(data2$los)   <- "Late seizures"
label(data2$early_treatment)   <- "Early AED treament"
label(data2$time)    <- "Time to late seizures"
units(data$age)   <- "Days"


rndr <- function(x, name, ...) {
    if (length(x) == 0) {
        y <- data2[[name]]
        s <- rep("", length(render.default(x=y, name=name, ...)))
        if (is.numeric(y)) {
            p <- fisher.test(y ~ data2$thrombolysis)$p.value
        } else {
            p <- chisq.test(table(y, droplevels(data2$thrombolysis)))$p.value
        }
        s[2] <- sub("<", "&lt;", format.pval(p, digits=3, eps=0.001))
        s
    } else {
        render.default(x=x, name=name, ...)
    }
}

rndr.strat <- function(label, n, ...) {
    ifelse(n==0, label, render.strat.default(label, n, ...))
}

table1(~source +male + age + nihss_middle+  nihss_high + macro+ micro +mca +cortical +iv_thrombolysis +ia_thrombolysis +early +early_treatment +los +time| thrombolysis, data=data2, render=rndr, render.strat=rndr.strat)
No thrombolysis
(n=2501)
Thrombolysis
(n=700)
Overall
(n=3201)
Cohort
bentes 46 (1.8%) 93 (13.3%) 139 (4.3%)
hebron 275 (11.0%) 236 (33.7%) 511 (16.0%)
kssg 1061 (42.4%) 139 (19.9%) 1200 (37.5%)
linz 357 (14.3%) 102 (14.6%) 459 (14.3%)
muenster 238 (9.5%) 73 (10.4%) 311 (9.7%)
saar 136 (5.4%) 46 (6.6%) 182 (5.7%)
udine 388 (15.5%) 11 (1.6%) 399 (12.5%)
Sex
Female 1114 (44.5%) 292 (41.7%) 1406 (43.9%)
Male 1387 (55.5%) 408 (58.3%) 1795 (56.1%)
Age
Mean (SD) 71.3 (13.6) 70.0 (13.6) 71.0 (13.6)
Median [Min, Max] 74.0 [19.0, 109] 73.0 [18.0, 99.0] 73.0 [18.0, 109]
NIHSS Middle
No 1746 (69.8%) 405 (57.9%) 2151 (67.2%)
Yes 755 (30.2%) 295 (42.1%) 1050 (32.8%)
NIHSS High
No 2119 (84.7%) 356 (50.9%) 2475 (77.3%)
Yes 382 (15.3%) 344 (49.1%) 726 (22.7%)
Large-artery artherosclerosis(embolus/thrombosis)
No 2048 (81.9%) 519 (74.1%) 2567 (80.2%)
Yes 453 (18.1%) 181 (25.9%) 634 (19.8%)
Small-vessel occulsion(lacune)
No 1829 (73.1%) 628 (89.7%) 2457 (76.8%)
Yes 672 (26.9%) 72 (10.3%) 744 (23.2%)
Middle cerebral artery compromise
No 915 (36.6%) 170 (24.3%) 1085 (33.9%)
Yes 1586 (63.4%) 530 (75.7%) 2116 (66.1%)
Cortical compromise
No 1374 (54.9%) 318 (45.4%) 1692 (52.9%)
Yes 1127 (45.1%) 382 (54.6%) 1509 (47.1%)
IV thrombolysis
No 2501 (100%) 32 (4.6%) 2533 (79.1%)
Yes 0 (0%) 668 (95.4%) 668 (20.9%)
Intraarterial thrombolysis
No 2501 (100%) 634 (90.6%) 3135 (97.9%)
Yes 0 (0%) 66 (9.4%) 66 (2.1%)
Early seizures
No 2387 (95.4%) 648 (92.6%) 3035 (94.8%)
Yes 114 (4.6%) 52 (7.4%) 166 (5.2%)
Early AED treament
No 2421 (96.8%) 650 (92.9%) 3071 (95.9%)
Yes 80 (3.2%) 50 (7.1%) 130 (4.1%)
Late seizures
No late seizures 2368 (94.7%) 626 (89.4%) 2994 (93.5%)
Late seizures 133 (5.3%) 74 (10.6%) 207 (6.5%)
Time to late seizures
Mean (SD) 971 (1110) 936 (759) 963 (1040)
Median [Min, Max] 731 [0.00, 43800] 724 [0.00, 3660] 731 [0.00, 43800]

1.2 Unmatched data

tab1 <- CreateTableOne(data = data, strata = "thrombolysis", testApprox = chisq.test, testExact = fisher.test)
cat <- c("source", "los", "early", "early_treatment", "male",  "nihss_middle", "nihss_high", "macro", "micro", "mca", "cortical",  "thrombolysis", "iv_thrombolysis", "ia_thrombolysis", "early_treatment")
cont <- c("time","age")
tab2 <- print(tab1, nonnormal = cont, smd = TRUE, missing = TRUE)
##                              Stratified by thrombolysis
##                               0                        
##   n                              2501                  
##   ID (mean (SD))              1490.60 (932.63)         
##   source (%)                                           
##      bentes                        46 ( 1.8)           
##      hebron                       275 (11.0)           
##      kssg                        1061 (42.4)           
##      linz                         357 (14.3)           
##      muenster                     238 ( 9.5)           
##      saar                         136 ( 5.4)           
##      udine                        388 (15.5)           
##   time (median [IQR])          731.00 [401.00, 1563.00]
##   los (mean (SD))                0.05 (0.22)           
##   male (mean (SD))               0.55 (0.50)           
##   age (median [IQR])            74.00 [63.00, 81.00]   
##   nihss_middle (mean (SD))       0.30 (0.46)           
##   nihss_high (mean (SD))         0.15 (0.36)           
##   macro (mean (SD))              0.18 (0.39)           
##   cardio (mean (SD))             0.29 (0.45)           
##   micro (mean (SD))              0.27 (0.44)           
##   mca (mean (SD))                0.63 (0.48)           
##   cortical (mean (SD))           0.45 (0.50)           
##   thrombolysis (mean (SD))       0.00 (0.00)           
##   iv_thrombolysis (mean (SD))    0.00 (0.00)           
##   ia_thrombolysis (mean (SD))    0.00 (0.00)           
##   early (mean (SD))              0.05 (0.21)           
##   early_treatment (mean (SD))    0.03 (0.18)           
##                              Stratified by thrombolysis
##                               1                         p      test   
##   n                               700                                 
##   ID (mean (SD))              2114.18 (909.08)          <0.001        
##   source (%)                                            <0.001        
##      bentes                        93 (13.3)                          
##      hebron                       236 (33.7)                          
##      kssg                         139 (19.9)                          
##      linz                         102 (14.6)                          
##      muenster                      73 (10.4)                          
##      saar                          46 ( 6.6)                          
##      udine                         11 ( 1.6)                          
##   time (median [IQR])          723.50 [365.00, 1733.50]  0.037 nonnorm
##   los (mean (SD))                0.11 (0.31)            <0.001        
##   male (mean (SD))               0.58 (0.49)             0.183        
##   age (median [IQR])            73.00 [62.00, 80.00]     0.048 nonnorm
##   nihss_middle (mean (SD))       0.42 (0.49)            <0.001        
##   nihss_high (mean (SD))         0.49 (0.50)            <0.001        
##   macro (mean (SD))              0.26 (0.44)            <0.001        
##   cardio (mean (SD))             0.37 (0.48)            <0.001        
##   micro (mean (SD))              0.10 (0.30)            <0.001        
##   mca (mean (SD))                0.76 (0.43)            <0.001        
##   cortical (mean (SD))           0.55 (0.50)            <0.001        
##   thrombolysis (mean (SD))       1.00 (0.00)            <0.001        
##   iv_thrombolysis (mean (SD))    0.95 (0.21)            <0.001        
##   ia_thrombolysis (mean (SD))    0.09 (0.29)            <0.001        
##   early (mean (SD))              0.07 (0.26)             0.002        
##   early_treatment (mean (SD))    0.07 (0.26)            <0.001        
##                              Stratified by thrombolysis
##                               SMD    Missing
##   n                                         
##   ID (mean (SD))               0.677 0.0    
##   source (%)                   0.999 0.0    
##      bentes                                 
##      hebron                                 
##      kssg                                   
##      linz                                   
##      muenster                               
##      saar                                   
##      udine                                  
##   time (median [IQR])          0.037 0.0    
##   los (mean (SD))              0.195 0.0    
##   male (mean (SD))             0.057 0.0    
##   age (median [IQR])           0.092 0.0    
##   nihss_middle (mean (SD))     0.251 0.0    
##   nihss_high (mean (SD))       0.777 0.0    
##   macro (mean (SD))            0.188 0.0    
##   cardio (mean (SD))           0.167 0.0    
##   micro (mean (SD))            0.436 0.0    
##   mca (mean (SD))              0.270 0.0    
##   cortical (mean (SD))         0.191 0.0    
##   thrombolysis (mean (SD))     Inf   0.0    
##   iv_thrombolysis (mean (SD))  6.457 0.0    
##   ia_thrombolysis (mean (SD))  0.456 0.0    
##   early (mean (SD))            0.121 0.0    
##   early_treatment (mean (SD))  0.179 0.0
write.csv(tab2, 'tableonedata.csv')

listvars <- c(
  "source",
  "age",
  "male",
  "nihss_middle",
  "nihss_high",
  "macro",
  "micro",
  "cardio",
  "mca",
  "cortical",
  "early_treatment")

tabUnmatched <- CreateTableOne(vars = listvars, strata = "thrombolysis", data = data, test = TRUE, testApprox = chisq.test )
tabUnmatched2 <- print(tabUnmatched, smd = TRUE)
##                              Stratified by thrombolysis
##                               0             1             p      test
##   n                            2501           700                    
##   source (%)                                              <0.001     
##      bentes                      46 ( 1.8)     93 (13.3)             
##      hebron                     275 (11.0)    236 (33.7)             
##      kssg                      1061 (42.4)    139 (19.9)             
##      linz                       357 (14.3)    102 (14.6)             
##      muenster                   238 ( 9.5)     73 (10.4)             
##      saar                       136 ( 5.4)     46 ( 6.6)             
##      udine                      388 (15.5)     11 ( 1.6)             
##   age (mean (SD))             71.28 (13.64) 70.03 (13.61)  0.031     
##   male (mean (SD))             0.55 (0.50)   0.58 (0.49)   0.183     
##   nihss_middle (mean (SD))     0.30 (0.46)   0.42 (0.49)  <0.001     
##   nihss_high (mean (SD))       0.15 (0.36)   0.49 (0.50)  <0.001     
##   macro (mean (SD))            0.18 (0.39)   0.26 (0.44)  <0.001     
##   micro (mean (SD))            0.27 (0.44)   0.10 (0.30)  <0.001     
##   cardio (mean (SD))           0.29 (0.45)   0.37 (0.48)  <0.001     
##   mca (mean (SD))              0.63 (0.48)   0.76 (0.43)  <0.001     
##   cortical (mean (SD))         0.45 (0.50)   0.55 (0.50)  <0.001     
##   early_treatment (mean (SD))  0.03 (0.18)   0.07 (0.26)  <0.001     
##                              Stratified by thrombolysis
##                               SMD   
##   n                                 
##   source (%)                   0.999
##      bentes                         
##      hebron                         
##      kssg                           
##      linz                           
##      muenster                       
##      saar                           
##      udine                          
##   age (mean (SD))              0.092
##   male (mean (SD))             0.057
##   nihss_middle (mean (SD))     0.251
##   nihss_high (mean (SD))       0.777
##   macro (mean (SD))            0.188
##   micro (mean (SD))            0.436
##   cardio (mean (SD))           0.167
##   mca (mean (SD))              0.270
##   cortical (mean (SD))         0.191
##   early_treatment (mean (SD))  0.179
addmargins(table(ExtractSmd(tabUnmatched) > 0.1))
## 
## FALSE  TRUE   Sum 
##     2     9    11

1.3 Matched data

set.seed(12347)
psm <- matchit(thrombolysis ~
                 source+
                 age +
                 male+
                 nihss_middle +
                 nihss_high+
                 macro+
                 micro+
                 cardio+
                 mca+
                 cortical+
                 early_treatment,
               data = data, method = "nearest", distance = "logit" ,replace = FALSE, caliper = 0.2)

psm_matchdata <- match.data(psm)
tabMatched <- CreateTableOne(vars = listvars, strata = "thrombolysis",data = psm_matchdata, test = TRUE, testApprox = chisq.test, smd = TRUE)
tabMatched2 <- print(tabMatched, smd = TRUE)
##                              Stratified by thrombolysis
##                               0             1             p      test
##   n                             598           598                    
##   source (%)                                               0.218     
##      bentes                      45 ( 7.5)     67 (11.2)             
##      hebron                     154 (25.8)    172 (28.8)             
##      kssg                       154 (25.8)    139 (23.2)             
##      linz                       108 (18.1)     98 (16.4)             
##      muenster                    71 (11.9)     70 (11.7)             
##      saar                        51 ( 8.5)     41 ( 6.9)             
##      udine                       15 ( 2.5)     11 ( 1.8)             
##   age (mean (SD))             70.25 (14.60) 69.44 (13.73)  0.320     
##   male (mean (SD))             0.56 (0.50)   0.59 (0.49)   0.293     
##   nihss_middle (mean (SD))     0.48 (0.50)   0.46 (0.50)   0.487     
##   nihss_high (mean (SD))       0.42 (0.49)   0.44 (0.50)   0.521     
##   macro (mean (SD))            0.24 (0.42)   0.26 (0.44)   0.316     
##   micro (mean (SD))            0.11 (0.31)   0.11 (0.31)   0.853     
##   cardio (mean (SD))           0.39 (0.49)   0.36 (0.48)   0.403     
##   mca (mean (SD))              0.73 (0.45)   0.75 (0.43)   0.431     
##   cortical (mean (SD))         0.57 (0.50)   0.56 (0.50)   0.684     
##   early_treatment (mean (SD))  0.06 (0.24)   0.07 (0.26)   0.355     
##                              Stratified by thrombolysis
##                               SMD   
##   n                                 
##   source (%)                   0.167
##      bentes                         
##      hebron                         
##      kssg                           
##      linz                           
##      muenster                       
##      saar                           
##      udine                          
##   age (mean (SD))              0.058
##   male (mean (SD))             0.061
##   nihss_middle (mean (SD))     0.040
##   nihss_high (mean (SD))       0.037
##   macro (mean (SD))            0.058
##   micro (mean (SD))            0.011
##   cardio (mean (SD))           0.048
##   mca (mean (SD))              0.046
##   cortical (mean (SD))         0.024
##   early_treatment (mean (SD))  0.054
addmargins(table(ExtractSmd(tabMatched) > 0.1))
## 
## FALSE  TRUE   Sum 
##    10     1    11

1.3.1 Examine matching performance

plot(psm, type = "hist")

resCombo <- cbind(print(tabUnmatched,  printToggle = FALSE),
                  print(tabMatched, printToggle = FALSE))
resCombo <- rbind(Group = rep(c("No Thrombolysis", "Thrombolysis", "P-value","", "No Thrombolysis", "Thrombolysis", "P-value", ""),6), resCombo)
colnames(resCombo) <- c("Unmatched","","","", "Matched","","", "")
print(resCombo, quote = FALSE)
##                             Unmatched                             
## Group                       No Thrombolysis Thrombolysis  P-value 
## n                            2501             700                 
## source (%)                                                <0.001  
##    bentes                      46 ( 1.8)       93 (13.3)          
##    hebron                     275 (11.0)      236 (33.7)          
##    kssg                      1061 (42.4)      139 (19.9)          
##    linz                       357 (14.3)      102 (14.6)          
##    muenster                   238 ( 9.5)       73 (10.4)          
##    saar                       136 ( 5.4)       46 ( 6.6)          
##    udine                      388 (15.5)       11 ( 1.6)          
## age (mean (SD))             71.28 (13.64)   70.03 (13.61)  0.031  
## male (mean (SD))             0.55 (0.50)     0.58 (0.49)   0.183  
## nihss_middle (mean (SD))     0.30 (0.46)     0.42 (0.49)  <0.001  
## nihss_high (mean (SD))       0.15 (0.36)     0.49 (0.50)  <0.001  
## macro (mean (SD))            0.18 (0.39)     0.26 (0.44)  <0.001  
## micro (mean (SD))            0.27 (0.44)     0.10 (0.30)  <0.001  
## cardio (mean (SD))           0.29 (0.45)     0.37 (0.48)  <0.001  
## mca (mean (SD))              0.63 (0.48)     0.76 (0.43)  <0.001  
## cortical (mean (SD))         0.45 (0.50)     0.55 (0.50)  <0.001  
## early_treatment (mean (SD))  0.03 (0.18)     0.07 (0.26)  <0.001  
##                             Matched                               
## Group                       No Thrombolysis Thrombolysis  P-value 
## n                             598             598                 
## source (%)                                                 0.218  
##    bentes                      45 ( 7.5)       67 (11.2)          
##    hebron                     154 (25.8)      172 (28.8)          
##    kssg                       154 (25.8)      139 (23.2)          
##    linz                       108 (18.1)       98 (16.4)          
##    muenster                    71 (11.9)       70 (11.7)          
##    saar                        51 ( 8.5)       41 ( 6.9)          
##    udine                       15 ( 2.5)       11 ( 1.8)          
## age (mean (SD))             70.25 (14.60)   69.44 (13.73)  0.320  
## male (mean (SD))             0.56 (0.50)     0.59 (0.49)   0.293  
## nihss_middle (mean (SD))     0.48 (0.50)     0.46 (0.50)   0.487  
## nihss_high (mean (SD))       0.42 (0.49)     0.44 (0.50)   0.521  
## macro (mean (SD))            0.24 (0.42)     0.26 (0.44)   0.316  
## micro (mean (SD))            0.11 (0.31)     0.11 (0.31)   0.853  
## cardio (mean (SD))           0.39 (0.49)     0.36 (0.48)   0.403  
## mca (mean (SD))              0.73 (0.45)     0.75 (0.43)   0.431  
## cortical (mean (SD))         0.57 (0.50)     0.56 (0.50)   0.684  
## early_treatment (mean (SD))  0.06 (0.24)     0.07 (0.26)   0.355
write.csv(resCombo, 'selectmatched.csv')

1.4 Analysis

1.4.1 Time to first seizure unmatched data

formula <- glm(formula = early ~ thrombolysis, data = data, family=binomial)
predicted <- predict(formula, data=data, type="response")
summary(formula)
## 
## Call:
## glm(formula = early ~ thrombolysis, family = binomial, data = data)
## 
## Deviance Residuals: 
##     Min       1Q   Median       3Q      Max  
## -0.3929  -0.3055  -0.3055  -0.3055   2.4853  
## 
## Coefficients:
##              Estimate Std. Error z value Pr(>|z|)    
## (Intercept)  -3.04159    0.09586 -31.730  < 2e-16 ***
## thrombolysis  0.51895    0.17310   2.998  0.00272 ** 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## (Dispersion parameter for binomial family taken to be 1)
## 
##     Null deviance: 1305.7  on 3200  degrees of freedom
## Residual deviance: 1297.3  on 3199  degrees of freedom
## AIC: 1301.3
## 
## Number of Fisher Scoring iterations: 5

1.4.2 Time to first seizure matched data

formula <- glm(formula = early ~ thrombolysis, data = psm_matchdata, family=binomial)
predicted <- predict(formula, data=psm_matchdata, type="response")
summary(formula)
## 
## Call:
## glm(formula = early ~ thrombolysis, family = binomial, data = psm_matchdata)
## 
## Deviance Residuals: 
##     Min       1Q   Median       3Q      Max  
## -0.4001  -0.4001  -0.3624  -0.3624   2.3478  
## 
## Coefficients:
##              Estimate Std. Error z value Pr(>|z|)    
## (Intercept)   -2.6904     0.1676 -16.049   <2e-16 ***
## thrombolysis   0.2054     0.2273   0.904    0.366    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## (Dispersion parameter for binomial family taken to be 1)
## 
##     Null deviance: 608.15  on 1195  degrees of freedom
## Residual deviance: 607.33  on 1194  degrees of freedom
## AIC: 611.33
## 
## Number of Fisher Scoring iterations: 5

1.4.3 Time to late seizure unmatched data

formula <- coxph(Surv(time,los) ~ thrombolysis, data = data)
summary(formula)
## Call:
## coxph(formula = Surv(time, los) ~ thrombolysis, data = data)
## 
##   n= 3201, number of events= 207 
## 
##                coef exp(coef) se(coef)     z Pr(>|z|)    
## thrombolysis 0.7315    2.0781   0.1453 5.034  4.8e-07 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
##              exp(coef) exp(-coef) lower .95 upper .95
## thrombolysis     2.078     0.4812     1.563     2.763
## 
## Concordance= 0.562  (se = 0.017 )
## Likelihood ratio test= 23.26  on 1 df,   p=1e-06
## Wald test            = 25.34  on 1 df,   p=5e-07
## Score (logrank) test = 26.48  on 1 df,   p=3e-07
km <- Surv(time = as.numeric(data$time), event = data$los)
fit <- survfit(km ~ thrombolysis, data = data)
ggsurvplot(fit, data = data, pval = TRUE, risk.table = TRUE, tables.theme = clean_theme(), conf.int = TRUE, tables.height = 0.25, title =  "Time to late seizure (Unmatched)", legend.labs = c("No Thrombolysis", "Thrombolysis"), legend = c(0.8, 0.2), font.main = c(13, "bold"),  font.x = c(11, "bold" ),font.y = c(11, "bold"),font.tickslab = c(10, "plain"), xlim = c(0, 2500), ylim = c(0.5, 1), pval.size = 4, break.time.by = 500, risk.table.fontsize = 4, risk.table.title.fontsize = 10, xlab = "Time (days)", palette = c("#808080", "#90ab09"))

1.4.4 Time to late seizure matched data

formula2 <- coxph(Surv(as.numeric(psm_matchdata$time),psm_matchdata$los) ~ psm_matchdata$thrombolysis, data = psm_matchdata)
summary(formula2)
## Call:
## coxph(formula = Surv(as.numeric(psm_matchdata$time), psm_matchdata$los) ~ 
##     psm_matchdata$thrombolysis, data = psm_matchdata)
## 
##   n= 1196, number of events= 120 
## 
##                              coef exp(coef) se(coef)     z Pr(>|z|)
## psm_matchdata$thrombolysis 0.2298    1.2583   0.1840 1.249    0.212
## 
##                            exp(coef) exp(-coef) lower .95 upper .95
## psm_matchdata$thrombolysis     1.258     0.7947    0.8773     1.805
## 
## Concordance= 0.529  (se = 0.025 )
## Likelihood ratio test= 1.57  on 1 df,   p=0.2
## Wald test            = 1.56  on 1 df,   p=0.2
## Score (logrank) test = 1.57  on 1 df,   p=0.2
km2 <- Surv(time = as.numeric(psm_matchdata$time), event =psm_matchdata$los)
fit2 <- survfit(km2 ~ thrombolysis, data = psm_matchdata)
ggsurvplot(fit2, data = psm_matchdata, pval = TRUE, risk.table = TRUE, tables.theme = clean_theme(), conf.int = TRUE, tables.height = 0.25, title =  "Time to late seizure (Matched)", legend.labs = c("No Thrombolysis", "Thrombolysis"), legend = c(0.8, 0.2), font.main = c(13, "bold"),  font.x = c(11, "bold" ),font.y = c(11, "bold"),font.tickslab = c(10, "plain"), xlim = c(0, 2500), ylim = c(0.5, 1), pval.size = 4, break.time.by = 500, risk.table.fontsize = 4, risk.table.title.fontsize = 10, xlab = "Time (days)", palette = c("#808080", "#90ab09"))

2 IV Thrombolysis

2.1 Unmatched data

data <- read_excel("data_for_analysis_iv.xlsx")
tabiv <- CreateTableOne(data = data, strata = "iv_thrombolysis")
cat <- c("source", "los", "early", "early_treatment", "male",  "nihss_middle", "nihss_high", "macro", "micro", "mca", "cortical",  "thrombolysis", "iv_thrombolysis", "ia_thrombolysis")
cont <- c("time","age")
tab2iv <- print(tabiv, nonnormal = cont, smd = TRUE, missing = TRUE)
##                              Stratified by iv_thrombolysis
##                               0                        
##   n                              2506                  
##   ID (mean (SD))              1492.72 (933.89)         
##   source (%)                                           
##      bentes                        46 ( 1.8)           
##      hebron                       275 (11.0)           
##      kssg                        1061 (42.3)           
##      linz                         359 (14.3)           
##      muenster                     238 ( 9.5)           
##      saar                         139 ( 5.5)           
##      udine                        388 (15.5)           
##   time (median [IQR])          731.00 [401.75, 1563.75]
##   los (mean (SD))                0.05 (0.23)           
##   male (mean (SD))               0.56 (0.50)           
##   age (median [IQR])            74.00 [63.00, 81.00]   
##   nihss_middle (mean (SD))       0.30 (0.46)           
##   nihss_high (mean (SD))         0.15 (0.36)           
##   macro (mean (SD))              0.18 (0.39)           
##   cardio (mean (SD))             0.29 (0.45)           
##   micro (mean (SD))              0.27 (0.44)           
##   mca (mean (SD))                0.63 (0.48)           
##   cortical (mean (SD))           0.45 (0.50)           
##   thrombolysis (mean (SD))       0.00 (0.04)           
##   iv_thrombolysis (mean (SD))    0.00 (0.00)           
##   ia_thrombolysis (mean (SD))    0.00 (0.04)           
##   early (mean (SD))              0.05 (0.21)           
##   early_treatment (mean (SD))    0.03 (0.18)           
##                              Stratified by iv_thrombolysis
##                               1                         p      test   
##   n                               622                                 
##   ID (mean (SD))              2144.96 (953.63)          <0.001        
##   source (%)                                            <0.001        
##      bentes                        93 (15.0)                          
##      hebron                       236 (37.9)                          
##      kssg                         139 (22.3)                          
##      linz                         100 (16.1)                          
##      muenster                       0 ( 0.0)                          
##      saar                          43 ( 6.9)                          
##      udine                         11 ( 1.8)                          
##   time (median [IQR])          723.50 [365.00, 1743.00]  0.045 nonnorm
##   los (mean (SD))                0.10 (0.31)            <0.001        
##   male (mean (SD))               0.59 (0.49)             0.175        
##   age (median [IQR])            73.00 [63.00, 80.75]     0.464 nonnorm
##   nihss_middle (mean (SD))       0.41 (0.49)            <0.001        
##   nihss_high (mean (SD))         0.50 (0.50)            <0.001        
##   macro (mean (SD))              0.26 (0.44)            <0.001        
##   cardio (mean (SD))             0.37 (0.48)            <0.001        
##   micro (mean (SD))              0.12 (0.32)            <0.001        
##   mca (mean (SD))                0.74 (0.44)            <0.001        
##   cortical (mean (SD))           0.59 (0.49)            <0.001        
##   thrombolysis (mean (SD))       1.00 (0.00)            <0.001        
##   iv_thrombolysis (mean (SD))    1.00 (0.00)            <0.001        
##   ia_thrombolysis (mean (SD))    0.05 (0.22)            <0.001        
##   early (mean (SD))              0.08 (0.26)             0.003        
##   early_treatment (mean (SD))    0.07 (0.26)            <0.001        
##                              Stratified by iv_thrombolysis
##                               SMD     Missing
##   n                                          
##   ID (mean (SD))               0.691  0.0    
##   source (%)                   1.185  0.0    
##      bentes                                  
##      hebron                                  
##      kssg                                    
##      linz                                    
##      muenster                                
##      saar                                    
##      udine                                   
##   time (median [IQR])          0.034  0.0    
##   los (mean (SD))              0.190  0.0    
##   male (mean (SD))             0.061  0.0    
##   age (median [IQR])           0.026  0.0    
##   nihss_middle (mean (SD))     0.230  0.0    
##   nihss_high (mean (SD))       0.795  0.0    
##   macro (mean (SD))            0.198  0.0    
##   cardio (mean (SD))           0.173  0.0    
##   micro (mean (SD))            0.394  0.0    
##   mca (mean (SD))              0.224  0.0    
##   cortical (mean (SD))         0.278  0.0    
##   thrombolysis (mean (SD))     31.623 0.0    
##   iv_thrombolysis (mean (SD))  Inf    0.0    
##   ia_thrombolysis (mean (SD))  0.316  0.0    
##   early (mean (SD))            0.124  0.0    
##   early_treatment (mean (SD))  0.186  0.0
write.csv(tab2iv, 'tableonedata_iv.csv')

listvars <- c(
  "source",
  "age",
  "male",
  "nihss_middle",
  "nihss_high",
  "macro",
  "micro",
  "cardio",
  "mca",
  "cortical",
  "early_treatment")

tabUnmatchediv <- CreateTableOne(vars = listvars, strata = "iv_thrombolysis", data = data, test = TRUE, testApprox = chisq.test )
tabUnmatched2iv <- print(tabUnmatchediv, smd = TRUE)
##                              Stratified by iv_thrombolysis
##                               0             1             p      test
##   n                            2506           622                    
##   source (%)                                              <0.001     
##      bentes                      46 ( 1.8)     93 (15.0)             
##      hebron                     275 (11.0)    236 (37.9)             
##      kssg                      1061 (42.3)    139 (22.3)             
##      linz                       359 (14.3)    100 (16.1)             
##      muenster                   238 ( 9.5)      0 ( 0.0)             
##      saar                       139 ( 5.5)     43 ( 6.9)             
##      udine                      388 (15.5)     11 ( 1.8)             
##   age (mean (SD))             71.28 (13.63) 70.94 (12.83)  0.573     
##   male (mean (SD))             0.56 (0.50)   0.59 (0.49)   0.175     
##   nihss_middle (mean (SD))     0.30 (0.46)   0.41 (0.49)  <0.001     
##   nihss_high (mean (SD))       0.15 (0.36)   0.50 (0.50)  <0.001     
##   macro (mean (SD))            0.18 (0.39)   0.26 (0.44)  <0.001     
##   micro (mean (SD))            0.27 (0.44)   0.12 (0.32)  <0.001     
##   cardio (mean (SD))           0.29 (0.45)   0.37 (0.48)  <0.001     
##   mca (mean (SD))              0.63 (0.48)   0.74 (0.44)  <0.001     
##   cortical (mean (SD))         0.45 (0.50)   0.59 (0.49)  <0.001     
##   early_treatment (mean (SD))  0.03 (0.18)   0.07 (0.26)  <0.001     
##                              Stratified by iv_thrombolysis
##                               SMD   
##   n                                 
##   source (%)                   1.185
##      bentes                         
##      hebron                         
##      kssg                           
##      linz                           
##      muenster                       
##      saar                           
##      udine                          
##   age (mean (SD))              0.026
##   male (mean (SD))             0.061
##   nihss_middle (mean (SD))     0.230
##   nihss_high (mean (SD))       0.795
##   macro (mean (SD))            0.198
##   micro (mean (SD))            0.394
##   cardio (mean (SD))           0.173
##   mca (mean (SD))              0.224
##   cortical (mean (SD))         0.278
##   early_treatment (mean (SD))  0.186
addmargins(table(ExtractSmd(tabUnmatchediv) > 0.1))
## 
## FALSE  TRUE   Sum 
##     2     9    11

2.2 Matched data

set.seed(122457)
psmiv <- matchit(iv_thrombolysis ~
                 source +
                 age +
                 male +
                 nihss_middle +
                 nihss_high +
                 macro +
                 micro +
                 cardio + 
                 mca +
                cortical +
                early_treatment,
               data = data, method = "nearest", distance = "logit" ,replace = FALSE, caliper = 0.2)

psm_matchdataiv <- match.data(psmiv)
tabMatchediv <- CreateTableOne(vars = listvars, strata = "iv_thrombolysis", data = psm_matchdataiv, test = TRUE, testApprox = chisq.test, smd = TRUE)
tabMatched2iv <- print(tabMatchediv, smd = TRUE)
##                              Stratified by iv_thrombolysis
##                               0             1             p      test
##   n                             515           515                    
##   source (%)                                               0.215     
##      bentes                      46 ( 8.9)     64 (12.4)             
##      hebron                     159 (30.9)    165 (32.0)             
##      kssg                       145 (28.2)    139 (27.0)             
##      linz                       107 (20.8)     95 (18.4)             
##      muenster                     3 ( 0.6)      0 ( 0.0)             
##      saar                        48 ( 9.3)     41 ( 8.0)             
##      udine                        7 ( 1.4)     11 ( 2.1)             
##   age (mean (SD))             71.17 (14.31) 70.25 (13.05)  0.281     
##   male (mean (SD))             0.58 (0.49)   0.60 (0.49)   0.448     
##   nihss_middle (mean (SD))     0.45 (0.50)   0.44 (0.50)   0.707     
##   nihss_high (mean (SD))       0.43 (0.50)   0.45 (0.50)   0.415     
##   macro (mean (SD))            0.26 (0.44)   0.25 (0.43)   0.775     
##   micro (mean (SD))            0.13 (0.34)   0.12 (0.33)   0.638     
##   cardio (mean (SD))           0.37 (0.48)   0.38 (0.49)   0.700     
##   mca (mean (SD))              0.70 (0.46)   0.73 (0.45)   0.336     
##   cortical (mean (SD))         0.60 (0.49)   0.60 (0.49)   0.849     
##   early_treatment (mean (SD))  0.07 (0.25)   0.08 (0.27)   0.470     
##                              Stratified by iv_thrombolysis
##                               SMD   
##   n                                 
##   source (%)                   0.181
##      bentes                         
##      hebron                         
##      kssg                           
##      linz                           
##      muenster                       
##      saar                           
##      udine                          
##   age (mean (SD))              0.067
##   male (mean (SD))             0.047
##   nihss_middle (mean (SD))     0.023
##   nihss_high (mean (SD))       0.051
##   macro (mean (SD))            0.018
##   micro (mean (SD))            0.029
##   cardio (mean (SD))           0.024
##   mca (mean (SD))              0.060
##   cortical (mean (SD))         0.012
##   early_treatment (mean (SD))  0.045
addmargins(table(ExtractSmd(tabMatchediv) > 0.1))
## 
## FALSE  TRUE   Sum 
##    10     1    11

2.2.1 Examine matching performance

plot(psmiv, type = "hist")

resComboiv <- cbind(print(tabUnmatchediv,  printToggle = FALSE),
                  print(tabMatchediv, printToggle = FALSE))
resComboiv <- rbind(Group = rep(c("No IV Thrombolysis", "IV Thrombolysis", "P-value","", "No IV Thrombolysis", "IV Thrombolysis", "P-value", ""),6), resComboiv)
colnames(resComboiv) <- c("Unmatched","","","", "Matched","","", "")
print(resComboiv, quote = FALSE)
##                             Unmatched                                  
## Group                       No IV Thrombolysis IV Thrombolysis P-value 
## n                            2506                622                   
## source (%)                                                     <0.001  
##    bentes                      46 ( 1.8)          93 (15.0)            
##    hebron                     275 (11.0)         236 (37.9)            
##    kssg                      1061 (42.3)         139 (22.3)            
##    linz                       359 (14.3)         100 (16.1)            
##    muenster                   238 ( 9.5)           0 ( 0.0)            
##    saar                       139 ( 5.5)          43 ( 6.9)            
##    udine                      388 (15.5)          11 ( 1.8)            
## age (mean (SD))             71.28 (13.63)      70.94 (12.83)    0.573  
## male (mean (SD))             0.56 (0.50)        0.59 (0.49)     0.175  
## nihss_middle (mean (SD))     0.30 (0.46)        0.41 (0.49)    <0.001  
## nihss_high (mean (SD))       0.15 (0.36)        0.50 (0.50)    <0.001  
## macro (mean (SD))            0.18 (0.39)        0.26 (0.44)    <0.001  
## micro (mean (SD))            0.27 (0.44)        0.12 (0.32)    <0.001  
## cardio (mean (SD))           0.29 (0.45)        0.37 (0.48)    <0.001  
## mca (mean (SD))              0.63 (0.48)        0.74 (0.44)    <0.001  
## cortical (mean (SD))         0.45 (0.50)        0.59 (0.49)    <0.001  
## early_treatment (mean (SD))  0.03 (0.18)        0.07 (0.26)    <0.001  
##                             Matched                                    
## Group                       No IV Thrombolysis IV Thrombolysis P-value 
## n                             515                515                   
## source (%)                                                      0.215  
##    bentes                      46 ( 8.9)          64 (12.4)            
##    hebron                     159 (30.9)         165 (32.0)            
##    kssg                       145 (28.2)         139 (27.0)            
##    linz                       107 (20.8)          95 (18.4)            
##    muenster                     3 ( 0.6)           0 ( 0.0)            
##    saar                        48 ( 9.3)          41 ( 8.0)            
##    udine                        7 ( 1.4)          11 ( 2.1)            
## age (mean (SD))             71.17 (14.31)      70.25 (13.05)    0.281  
## male (mean (SD))             0.58 (0.49)        0.60 (0.49)     0.448  
## nihss_middle (mean (SD))     0.45 (0.50)        0.44 (0.50)     0.707  
## nihss_high (mean (SD))       0.43 (0.50)        0.45 (0.50)     0.415  
## macro (mean (SD))            0.26 (0.44)        0.25 (0.43)     0.775  
## micro (mean (SD))            0.13 (0.34)        0.12 (0.33)     0.638  
## cardio (mean (SD))           0.37 (0.48)        0.38 (0.49)     0.700  
## mca (mean (SD))              0.70 (0.46)        0.73 (0.45)     0.336  
## cortical (mean (SD))         0.60 (0.49)        0.60 (0.49)     0.849  
## early_treatment (mean (SD))  0.07 (0.25)        0.08 (0.27)     0.470
write.csv(resComboiv, 'selectmatched_iv.csv')

2.3 Analysis

2.3.1 Time to first seizure unmatched data

formula <- glm(formula = early ~ iv_thrombolysis, data = data, family=binomial)
predicted <- predict(formula, data=data, type="response")
summary(formula)
## 
## Call:
## glm(formula = early ~ iv_thrombolysis, family = binomial, data = data)
## 
## Deviance Residuals: 
##     Min       1Q   Median       3Q      Max  
## -0.3964  -0.3065  -0.3065  -0.3065   2.4825  
## 
## Coefficients:
##                 Estimate Std. Error z value Pr(>|z|)    
## (Intercept)     -3.03453    0.09546 -31.790  < 2e-16 ***
## iv_thrombolysis  0.53031    0.17924   2.959  0.00309 ** 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## (Dispersion parameter for binomial family taken to be 1)
## 
##     Null deviance: 1274.7  on 3127  degrees of freedom
## Residual deviance: 1266.5  on 3126  degrees of freedom
## AIC: 1270.5
## 
## Number of Fisher Scoring iterations: 5

2.3.2 Time to first seizure matched data

formula <- glm(formula = early ~ iv_thrombolysis, data = psm_matchdataiv, family=binomial)
predicted <- predict(formula, data=psm_matchdataiv, type="response")
summary(formula)
## 
## Call:
## glm(formula = early ~ iv_thrombolysis, family = binomial, data = psm_matchdataiv)
## 
## Deviance Residuals: 
##     Min       1Q   Median       3Q      Max  
## -0.4125  -0.4125  -0.3969  -0.3969   2.2718  
## 
## Coefficients:
##                 Estimate Std. Error z value Pr(>|z|)    
## (Intercept)     -2.50186    0.16656 -15.021   <2e-16 ***
## iv_thrombolysis  0.08043    0.23166   0.347    0.728    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## (Dispersion parameter for binomial family taken to be 1)
## 
##     Null deviance: 567.40  on 1029  degrees of freedom
## Residual deviance: 567.28  on 1028  degrees of freedom
## AIC: 571.28
## 
## Number of Fisher Scoring iterations: 5

2.3.3 Time to late seizure unmatched data

formula <- coxph(Surv(time,los) ~ iv_thrombolysis, data = data)
summary(formula)
## Call:
## coxph(formula = Surv(time, los) ~ iv_thrombolysis, data = data)
## 
##   n= 3128, number of events= 199 
## 
##                   coef exp(coef) se(coef)     z Pr(>|z|)    
## iv_thrombolysis 0.7143    2.0427   0.1515 4.715 2.41e-06 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
##                 exp(coef) exp(-coef) lower .95 upper .95
## iv_thrombolysis     2.043     0.4895     1.518     2.749
## 
## Concordance= 0.553  (se = 0.017 )
## Likelihood ratio test= 20.19  on 1 df,   p=7e-06
## Wald test            = 22.23  on 1 df,   p=2e-06
## Score (logrank) test = 23.19  on 1 df,   p=1e-06
km <- Surv(time = as.numeric(data$time), event = data$los)
fit <- survfit(km ~ iv_thrombolysis, data = data)
ggsurvplot(fit, data = data, pval = TRUE, risk.table = TRUE, tables.theme = clean_theme(), conf.int = TRUE, tables.height = 0.25, title =  "Time to late seizure (Unmatched)", legend.labs = c("No  IV Thrombolysis", "IV Thrombolysis"), legend = c(0.8, 0.2), font.main = c(13, "bold"),  font.x = c(11, "bold" ),font.y = c(11, "bold"),font.tickslab = c(10, "plain"), xlim = c(0, 2500), ylim = c(0.5, 1), pval.size = 4, break.time.by = 500, risk.table.fontsize = 4, risk.table.title.fontsize = 10, xlab = "Time (days)", palette = c("#808080", "#90ab09"))

2.3.4 Time to late seizure matched data

formula2 <- coxph(Surv(as.numeric(psm_matchdataiv$time),psm_matchdataiv$los) ~ psm_matchdataiv$iv_thrombolysis, data = psm_matchdataiv)
summary(formula2)
## Call:
## coxph(formula = Surv(as.numeric(psm_matchdataiv$time), psm_matchdataiv$los) ~ 
##     psm_matchdataiv$iv_thrombolysis, data = psm_matchdataiv)
## 
##   n= 1030, number of events= 98 
## 
##                                   coef exp(coef) se(coef)     z Pr(>|z|)
## psm_matchdataiv$iv_thrombolysis 0.1508    1.1627   0.2031 0.742    0.458
## 
##                                 exp(coef) exp(-coef) lower .95 upper .95
## psm_matchdataiv$iv_thrombolysis     1.163       0.86     0.781     1.731
## 
## Concordance= 0.512  (se = 0.028 )
## Likelihood ratio test= 0.55  on 1 df,   p=0.5
## Wald test            = 0.55  on 1 df,   p=0.5
## Score (logrank) test = 0.55  on 1 df,   p=0.5
km2 <- Surv(time = as.numeric(psm_matchdataiv$time), event =psm_matchdataiv$los)
fit2 <- survfit(km2 ~ iv_thrombolysis, data = psm_matchdataiv)
ggsurvplot(fit2, data = psm_matchdataiv, pval = TRUE, risk.table = TRUE, tables.theme = clean_theme(), conf.int = TRUE, tables.height = 0.25, title =  "Time to late seizure (Matched)", legend.labs = c("No IV Thrombolysis", "IV Thrombolysis"), legend = c(0.8, 0.2), font.main = c(13, "bold"),  font.x = c(11, "bold" ),font.y = c(11, "bold"),font.tickslab = c(10, "plain"), xlim = c(0, 2500), ylim = c(0.5, 1), pval.size = 4, break.time.by = 500, risk.table.fontsize = 4, risk.table.title.fontsize = 10, xlab = "Time (days)", palette = c("#808080", "#90ab09"))