library(readxl)
library(janitor)
##
## Attaching package: 'janitor'
## The following objects are masked from 'package:stats':
##
## chisq.test, fisher.test
library(tidyverse)
## ── Attaching packages ─────────────────────────────────────── tidyverse 1.3.1 ──
## ✔ ggplot2 3.3.6 ✔ purrr 0.3.4
## ✔ tibble 3.1.7 ✔ dplyr 1.0.9
## ✔ tidyr 1.2.0 ✔ stringr 1.4.0
## ✔ readr 2.1.2 ✔ forcats 0.5.1
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ dplyr::filter() masks stats::filter()
## ✖ dplyr::lag() masks stats::lag()
#Importing data
data1 <- read_excel("~/Library/CloudStorage/OneDrive-AlexandriaUniversity/Acute Stroke_Data/THROMBECTOMY_New.xlsx") %>% clean_names() %>%
mutate_if(is.character, ~as.factor(as.character(.)))
#Preparing data
data1$no_of_trials <- as.factor(data1$no_of_trials)
data1$location <- factor(data1$location,
levels= c("basilar","basilar+VERT","carotid","MCA","MCA+CAR","t-carotid"),
labels = c("BASILAR","OTHERS","CAROTID","MCA","OTHERS","OTHERS"))
data1$tici_binary <- as.character(data1$tici)
data1$tici_binary = replace(data1$tici_binary , data1$tici_binary == "2A", "Failure of reperfusion")
data1$tici_binary = replace(data1$tici_binary , data1$tici_binary == "2B", "Successful reperfusion")
data1$tici_binary = replace(data1$tici_binary , data1$tici_binary == "3" , "Successful reperfusion")
data1$tici_binary <- as.factor(data1$tici_binary )
library(MatchIt)
library(tableone)
library(knitr)
library(mice)
##
## Attaching package: 'mice'
## The following object is masked from 'package:stats':
##
## filter
## The following objects are masked from 'package:base':
##
## cbind, rbind
library(VIM)
## Loading required package: colorspace
## Loading required package: grid
## VIM is ready to use.
## Suggestions and bug-reports can be submitted at: https://github.com/statistikat/VIM/issues
##
## Attaching package: 'VIM'
## The following object is masked from 'package:datasets':
##
## sleep
aggr_plot <- aggr(data1, col=c('navyblue','red'), numbers=TRUE,
sortVars=TRUE, labels=names(data), cex.axis=.7,
gap=3, ylab=c("Histogram of missing data","Pattern"))
##
## Variables sorted by number of missings:
## Variable Count
## age 0
## se_x 0
## htn 0
## diabetes_mellitus 0
## lipid 0
## smoking 0
## atrial_fibrilation 0
## time_from_symptoms_to_admission 0
## admission_to_procedure 0
## time_from_onset_to_proderure 0
## location 0
## rtpa 0
## endovascular_treatment 0
## tici 0
## no_of_trials 0
## nihss 0
## mrs_90_0 0
## mrs_90_3_6 0
## ich 0
## s_ich 0
## death 0
## tici_binary 0
#Matching the samples
set.seed(1234)
match.it <- matchit(rtpa ~ age + se_x + htn + lipid + atrial_fibrilation
+ time_from_onset_to_proderure
+ location + no_of_trials
, data = data1, method="nearest", ratio=1)
a <- summary(match.it)
kable(a$nn, digits = 2, align = 'c',
caption = 'Table 2: Sample sizes')
| Control | Treated | |
|---|---|---|
| All (ESS) | 35 | 15 |
| All | 35 | 15 |
| Matched (ESS) | 15 | 15 |
| Matched | 15 | 15 |
| Unmatched | 20 | 0 |
| Discarded | 0 | 0 |
plot(match.it, type = 'jitter', interactive = FALSE)
df.match <- match.data(match.it)[1:ncol(data1)]
pacman::p_load(tableone)
#test for imbalance
vars = c('age','se_x','htn','lipid','atrial_fibrilation'
,'time_from_onset_to_proderure'
,'location','no_of_trials' )
tabMatched <- CreateTableOne(vars = vars, strata = "rtpa", data = df.match, test = FALSE)
print(tabMatched, smd = TRUE)
## Stratified by rtpa
## NO YES SMD
## n 15 15
## age (mean (SD)) 62.93 (9.19) 61.53 (5.51) 0.185
## se_x = M (%) 7 (46.7) 7 (46.7) <0.001
## htn = YES (%) 12 (80.0) 11 (73.3) 0.158
## lipid = YES (%) 10 (66.7) 8 (53.3) 0.275
## atrial_fibrilation = YES (%) 2 (13.3) 5 (33.3) 0.487
## time_from_onset_to_proderure (mean (SD)) 7.17 (1.28) 5.48 (1.00) 1.470
## location (%) 0.302
## BASILAR 0 ( 0.0) 0 ( 0.0)
## OTHERS 2 (13.3) 3 (20.0)
## CAROTID 6 (40.0) 4 (26.7)
## MCA 7 (46.7) 8 (53.3)
## no_of_trials (%) <0.001
## 1 10 (66.7) 10 (66.7)
## 2 5 (33.3) 5 (33.3)
## 3 0 ( 0.0) 0 ( 0.0)
addmargins(table(ExtractSmd(tabMatched) < 0.1))
##
## FALSE TRUE Sum
## 6 2 8
#Comparison of outcomes before and after matching
#Comparison of matched samples
table2 <- CreateTableOne(vars = c("tici","tici_binary","nihss","mrs_90_0","mrs_90_3_6","ich","s_ich","death"),
data = df.match,
strata = 'rtpa')
table2 <- print(table2, printToggle = FALSE,
noSpaces = TRUE)
kable(table2[,1:3], align = 'c',
caption = 'Table 2: Comparison of matched samples ')
| NO | YES | p | |
|---|---|---|---|
| n | 15 | 15 | |
| tici (%) | 0.260 | ||
| 2A | 2 (13.3) | 0 (0.0) | |
| 2B | 11 (73.3) | 14 (93.3) | |
| 3 | 2 (13.3) | 1 (6.7) | |
| tici_binary = Successful reperfusion (%) | 13 (86.7) | 15 (100.0) | 0.464 |
| nihss = SAME (%) | 3 (20.0) | 7 (46.7) | 0.245 |
| mrs_90_0 = YES (%) | 11 (73.3) | 10 (66.7) | 1.000 |
| mrs_90_3_6 = YES (%) | 4 (26.7) | 5 (33.3) | 1.000 |
| ich = YES (%) | 7 (46.7) | 12 (80.0) | 0.130 |
| s_ich = YES (%) | 1 (6.7) | 6 (40.0) | 0.084 |
| death = YES (%) | 2 (13.3) | 2 (13.3) | 1.000 |
#Comparison of unmatched samples
table1 <- CreateTableOne(vars = c("tici","tici_binary","nihss","mrs_90_0","mrs_90_3_6","ich","s_ich","death"),
data = data1,
strata = 'rtpa')
table1 <- print(table1, printToggle = FALSE,
noSpaces = TRUE)
kable(table1[,1:3], align = 'c',
caption = 'Table 1: Comparison of unmatched samples')
| NO | YES | p | |
|---|---|---|---|
| n | 35 | 15 | |
| tici (%) | 0.614 | ||
| 2A | 2 (5.7) | 0 (0.0) | |
| 2B | 30 (85.7) | 14 (93.3) | |
| 3 | 3 (8.6) | 1 (6.7) | |
| tici_binary = Successful reperfusion (%) | 33 (94.3) | 15 (100.0) | 0.875 |
| nihss = SAME (%) | 12 (34.3) | 7 (46.7) | 0.611 |
| mrs_90_0 = YES (%) | 24 (68.6) | 10 (66.7) | 1.000 |
| mrs_90_3_6 = YES (%) | 11 (31.4) | 5 (33.3) | 1.000 |
| ich = YES (%) | 8 (22.9) | 12 (80.0) | 0.001 |
| s_ich = YES (%) | 1 (2.9) | 6 (40.0) | 0.002 |
| death = YES (%) | 2 (5.7) | 2 (13.3) | 0.733 |
write.csv(table1, file = "~/Library/CloudStorage/OneDrive-AlexandriaUniversity/Acute Stroke_Data/Comparison of unmatched samples.csv")
write.csv(table2, file = "~/Library/CloudStorage/OneDrive-AlexandriaUniversity/Acute Stroke_Data/Comparison of matched samples.csv")
variables = c(names(data1))
#Descriptive
tabledesc <- CreateTableOne(vars = variables ,
data = data1)
tabledesc <- print(tabledesc,
printToggle = FALSE,
noSpaces = TRUE)
write.csv(tabledesc, file = "~/Library/CloudStorage/OneDrive-AlexandriaUniversity/Acute Stroke_Data/descriptive table .csv")
#Multible comparisons
tableich <- CreateTableOne(vars = variables , strata = "ich" ,
data = data1)
tableich <- print(tableich, printToggle = FALSE,
noSpaces = TRUE)
write.csv(tableich, file = "~/Library/CloudStorage/OneDrive-AlexandriaUniversity/Acute Stroke_Data/ICH table .csv")
#########################
tablesich <- CreateTableOne(vars = variables , strata = "s_ich" ,
data = data1)
tablesich <- print(tablesich, printToggle = FALSE,
noSpaces = TRUE)
write.csv(tablesich, file = "~/Library/CloudStorage/OneDrive-AlexandriaUniversity/Acute Stroke_Data/SICH table .csv")
#################################
tablesatrial_fibrilation <- CreateTableOne(vars = variables , strata = "atrial_fibrilation" ,
data = data1)
tablesatrial_fibrilation <- print(tablesatrial_fibrilation, printToggle = FALSE,
noSpaces = TRUE)
write.csv(tablesatrial_fibrilation, file = "~/Library/CloudStorage/OneDrive-AlexandriaUniversity/Acute Stroke_Data/tablesatrial_fibrilation table .csv")
#############################################
tablelocation <- CreateTableOne(vars = variables , strata = "location" ,
data = data1)
tablelocation <- print(tablelocation, printToggle = FALSE,
noSpaces = TRUE)
write.csv(tablelocation, file = "~/Library/CloudStorage/OneDrive-AlexandriaUniversity/Acute Stroke_Data/location table .csv")
##############################################
tableendovascular_treatment <- CreateTableOne(vars = variables , strata = "endovascular_treatment" ,
data = data1)
tableendovascular_treatment <- print(tableendovascular_treatment, printToggle = FALSE,
noSpaces = TRUE)
write.csv(tableendovascular_treatment, file = "~/Library/CloudStorage/OneDrive-AlexandriaUniversity/Acute Stroke_Data/endovascular_treatment table .csv")
##############################################
tableno_of_trials <- CreateTableOne(vars = variables , strata = "no_of_trials" ,
data = data1)
tableno_of_trials <- print(tableno_of_trials, printToggle = FALSE,
noSpaces = TRUE)
write.csv(tableno_of_trials, file = "~/Library/CloudStorage/OneDrive-AlexandriaUniversity/Acute Stroke_Data/no_of_trials table .csv")
##############################################
tablertpa <- CreateTableOne(vars = variables , strata = "rtpa" ,
data = data1)
tablertpa <- print(tablertpa, printToggle = FALSE,
noSpaces = TRUE)
write.csv(tablertpa, file = "~/Library/CloudStorage/OneDrive-AlexandriaUniversity/Acute Stroke_Data/rtpa table .csv")
##############################################
tablese_x <- CreateTableOne(vars = variables , strata = "se_x" ,
data = data1)
tablese_x <- print(tablese_x, printToggle = FALSE,
noSpaces = TRUE)
write.csv(tablese_x, file = "~/Library/CloudStorage/OneDrive-AlexandriaUniversity/Acute Stroke_Data/sex table .csv")
##############################################
tablehtn <- CreateTableOne(vars = variables , strata = "htn" ,
data = data1)
tablehtn <- print(tablehtn, printToggle = FALSE,
noSpaces = TRUE)
write.csv(tablehtn, file = "~/Library/CloudStorage/OneDrive-AlexandriaUniversity/Acute Stroke_Data/htn table .csv")
##############################################
tablediabetes_mellitus <- CreateTableOne(vars = variables , strata = "diabetes_mellitus" ,
data = data1)
tablediabetes_mellitus <- print(tablediabetes_mellitus, printToggle = FALSE,
noSpaces = TRUE)
write.csv(tablediabetes_mellitus, file = "~/Library/CloudStorage/OneDrive-AlexandriaUniversity/Acute Stroke_Data/diabetes_mellitus table .csv")
##############################################
tablelipid <- CreateTableOne(vars = variables , strata = "lipid" ,
data = data1)
tablelipid <- print(tablelipid, printToggle = FALSE,
noSpaces = TRUE)
write.csv(tablelipid, file = "~/Library/CloudStorage/OneDrive-AlexandriaUniversity/Acute Stroke_Data/lipid table .csv")
##############################################
tablesmoking <- CreateTableOne(vars = variables , strata = "smoking" ,
data = data1)
tablesmoking <- print(tablesmoking, printToggle = FALSE,
noSpaces = TRUE)
write.csv(tablesmoking, file = "~/Library/CloudStorage/OneDrive-AlexandriaUniversity/Acute Stroke_Data/smoking table .csv")
##############################################
data1$time = as.numeric(data1$time_from_symptoms_to_admission)
data1$time = replace(data1$time, data1$time > 3.0, "More than 3H")
data1$time = replace(data1$time, data1$time <= 3.0, "Less than or equal to 3H")
tabletime <- CreateTableOne(vars = variables , strata = "time" ,
data = data1)
tabletime <- print(tabletime, printToggle = FALSE,
noSpaces = TRUE)
write.csv(tabletime, file = "~/Library/CloudStorage/OneDrive-AlexandriaUniversity/Acute Stroke_Data/time table .csv")
#goodness of fit for location
library(EMT)
observed = c(7, 1, 13, 24, 4, 1)
theoretical = c(.17,.16,.17,.17,.17, .16)
Test = chisq.test(x = observed,
p = theoretical)
Test
##
## Chi-squared test for given probabilities
##
## data: observed
## X-squared = 45.544, df = 5, p-value = 1.125e-08
Test$expected
## [1] 8.5 8.0 8.5 8.5 8.5 8.0
#effect size for goodness of fit k=6 (effect size is large)
library(rcompanion)
cramerVFit(x = observed,
p = theoretical)
## Cramer V
## 0.4268
##Bar plot for location
observed = c(7, 1, 13, 24, 1, 4)
theoretical = c(.165,.165,.17,.17,.165, .165)
Observed.prop = observed / sum(observed)
Theoretical.prop = theoretical
Observed.prop = round(Observed.prop, 3)
Theoretical.prop = round(Theoretical.prop, 3)
XT = rbind(Theoretical.prop, Observed.prop)
colnames(XT) = c( "BASILAR","BASILAR+VERT","CAROTID"
,"MCA","MCA+CAR","T-CAROTID" )
XT
## BASILAR BASILAR+VERT CAROTID MCA MCA+CAR T-CAROTID
## Theoretical.prop 0.165 0.165 0.17 0.17 0.165 0.165
## Observed.prop 0.140 0.020 0.26 0.48 0.020 0.080
barplot(XT,
beside = T,
xlab = "Location",
col = c("cornflowerblue","blue"))
legend("topright", legend=c("Theoretical", "Observed"),
col=c("cornflowerblue","blue"), fill= c("cornflowerblue","blue"), cex=0.8)
#goodness of fit for END with and without
observedd = c(15, 35)
theoreticall = c(0.5,0.5)
Testt = chisq.test(x = observedd,
p = theoreticall)
Testt
##
## Chi-squared test for given probabilities
##
## data: observedd
## X-squared = 8, df = 1, p-value = 0.004678
Testt$expected
## [1] 25 25
#effect size for goodness of fit
cramerVFit(x = observedd,
p = theoreticall)
## Cramer V
## 0.4
#Multi variate logistic
data1$tici <- factor(data1$tici, levels = c("2A","2B", "3"), ordered = TRUE)
library(Publish)
## Loading required package: prodlim
## Registered S3 method overwritten by 'Publish':
## method from
## print.ci coin
#tici
fit.tici = glm(tici ~ time_from_onset_to_proderure+ location + no_of_trials
+ endovascular_treatment + rtpa
, data = data1, family = binomial )
## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred
summary(fit.tici)
##
## Call:
## glm(formula = tici ~ time_from_onset_to_proderure + location +
## no_of_trials + endovascular_treatment + rtpa, family = binomial,
## data = data1)
##
## Deviance Residuals:
## Min 1Q Median 3Q Max
## -1.99895 0.00000 0.00001 0.00005 1.06939
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 1.668e+01 1.519e+04 0.001 0.999
## time_from_onset_to_proderure 9.369e-01 7.891e-01 1.187 0.235
## locationOTHERS -9.766e-01 2.211e+04 0.000 1.000
## locationCAROTID 4.805e-02 1.810e+04 0.000 1.000
## locationMCA -2.232e+01 1.519e+04 -0.001 0.999
## no_of_trials2 -2.531e+00 2.382e+00 -1.063 0.288
## no_of_trials3 2.082e+00 3.147e+04 0.000 1.000
## endovascular_treatmentASP+STENT 1.831e+01 1.347e+04 0.001 0.999
## endovascular_treatmentSTENT 1.859e+01 1.234e+04 0.002 0.999
## rtpaYES 2.306e+01 9.508e+03 0.002 0.998
##
## (Dispersion parameter for binomial family taken to be 1)
##
## Null deviance: 16.7944 on 49 degrees of freedom
## Residual deviance: 6.7705 on 40 degrees of freedom
## AIC: 26.77
##
## Number of Fisher Scoring iterations: 21
publish(fit.tici)
## Variable Units OddsRatio CI.95 p-value
## time_from_onset_to_proderure 2.55 [0.54;11.98] 0.2351
## location BASILAR Ref
## OTHERS 0.38 [0.00;Inf] 1.0000
## CAROTID 1.05 [0.00;Inf] 1.0000
## MCA 0.00 [0.00;Inf] 0.9988
## no_of_trials 1 Ref
## 2 0.08 [0.00;8.47] 0.2878
## 3 8.02 [0.00;Inf] 0.9999
## endovascular_treatment ASP Ref
## ASP+STENT 89330019.41 [0.00;Inf] 0.9989
## STENT 117933570.37 [0.00;Inf] 0.9988
## rtpa NO Ref
## YES 10306638994.71 [0.00;Inf] 0.9981
#nihss
levels(data1$nihss)
## [1] "DECREASED" "SAME"
data1$nihss = factor(data1$nihss, levels=c("SAME","DECREASED"), ordered = TRUE)
fit.nihss = glm(nihss ~ age + se_x + htn + diabetes_mellitus + lipid +smoking
+ atrial_fibrilation
+ time_from_onset_to_proderure+ location + no_of_trials
+ endovascular_treatment + rtpa
, data = data1, family = binomial )
summary(fit.nihss)
##
## Call:
## glm(formula = nihss ~ age + se_x + htn + diabetes_mellitus +
## lipid + smoking + atrial_fibrilation + time_from_onset_to_proderure +
## location + no_of_trials + endovascular_treatment + rtpa,
## family = binomial, data = data1)
##
## Deviance Residuals:
## Min 1Q Median 3Q Max
## -2.0256 -0.6413 0.1830 0.6281 2.3263
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) -3.89331 4.42855 -0.879 0.3793
## age -0.04037 0.06446 -0.626 0.5311
## se_xM -0.27192 1.02834 -0.264 0.7914
## htnYES 2.49684 1.10491 2.260 0.0238 *
## diabetes_mellitusYES 0.44776 1.18373 0.378 0.7052
## lipidYES 1.53957 0.99421 1.549 0.1215
## smokingYES 0.51502 1.08856 0.473 0.6361
## atrial_fibrilationYES 0.55068 1.41638 0.389 0.6974
## time_from_onset_to_proderure 0.34651 0.31077 1.115 0.2648
## locationOTHERS 2.72347 1.87798 1.450 0.1470
## locationCAROTID 4.22172 1.82075 2.319 0.0204 *
## locationMCA 1.18709 1.50255 0.790 0.4295
## no_of_trials2 -1.51036 1.22719 -1.231 0.2184
## no_of_trials3 -0.03448 2.17684 -0.016 0.9874
## endovascular_treatmentASP+STENT 0.09547 1.31796 0.072 0.9423
## endovascular_treatmentSTENT 2.28467 1.48874 1.535 0.1249
## rtpaYES -0.93855 1.29958 -0.722 0.4702
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for binomial family taken to be 1)
##
## Null deviance: 66.406 on 49 degrees of freedom
## Residual deviance: 41.245 on 33 degrees of freedom
## AIC: 75.245
##
## Number of Fisher Scoring iterations: 6
publish(fit.nihss)
## Variable Units OddsRatio CI.95 p-value
## age 0.96 [0.85;1.09] 0.53113
## se_x F Ref
## M 0.76 [0.10;5.72] 0.79145
## htn NO Ref
## YES 12.14 [1.39;105.89] 0.02383
## diabetes_mellitus NO Ref
## YES 1.56 [0.15;15.92] 0.70524
## lipid NO Ref
## YES 4.66 [0.66;32.73] 0.12149
## smoking NO Ref
## YES 1.67 [0.20;14.13] 0.63613
## atrial_fibrilation NO Ref
## YES 1.73 [0.11;27.85] 0.69743
## time_from_onset_to_proderure 1.41 [0.77;2.60] 0.26484
## location BASILAR Ref
## OTHERS 15.23 [0.38;604.40] 0.14700
## CAROTID 68.15 [1.92;2417.11] 0.02041
## MCA 3.28 [0.17;62.30] 0.42950
## no_of_trials 1 Ref
## 2 0.22 [0.02;2.45] 0.21842
## 3 0.97 [0.01;68.86] 0.98736
## endovascular_treatment ASP Ref
## ASP+STENT 1.10 [0.08;14.57] 0.94225
## STENT 9.82 [0.53;181.73] 0.12487
## rtpa NO Ref
## YES 0.39 [0.03;5.00] 0.47017
#mrs_90_3_6
fit.mrs_90_3_6 = glm(mrs_90_3_6 ~ age + se_x + htn + diabetes_mellitus + lipid +smoking
+ atrial_fibrilation
+ time_from_onset_to_proderure+ location + no_of_trials
+ endovascular_treatment + rtpa
, data = data1, family = binomial )
summary(fit.mrs_90_3_6)
##
## Call:
## glm(formula = mrs_90_3_6 ~ age + se_x + htn + diabetes_mellitus +
## lipid + smoking + atrial_fibrilation + time_from_onset_to_proderure +
## location + no_of_trials + endovascular_treatment + rtpa,
## family = binomial, data = data1)
##
## Deviance Residuals:
## Min 1Q Median 3Q Max
## -1.31551 -0.53887 -0.17523 0.06745 2.15147
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) -13.1928 8.6501 -1.525 0.1272
## age 0.1386 0.1072 1.293 0.1959
## se_xM 1.0390 1.3585 0.765 0.4444
## htnYES -5.6240 2.4762 -2.271 0.0231 *
## diabetes_mellitusYES -1.4726 1.2971 -1.135 0.2563
## lipidYES 1.1033 1.2764 0.864 0.3874
## smokingYES 0.6346 1.2967 0.489 0.6246
## atrial_fibrilationYES -1.2585 1.7035 -0.739 0.4601
## time_from_onset_to_proderure 0.6113 0.4278 1.429 0.1531
## locationOTHERS -0.2523 2.4944 -0.101 0.9194
## locationCAROTID -2.0922 2.0747 -1.008 0.3133
## locationMCA 2.2431 1.9308 1.162 0.2454
## no_of_trials2 -0.6343 1.5026 -0.422 0.6729
## no_of_trials3 -3.5841 2.6979 -1.328 0.1840
## endovascular_treatmentASP+STENT 3.0182 1.9878 1.518 0.1289
## endovascular_treatmentSTENT 2.0347 1.6944 1.201 0.2298
## rtpaYES 2.5263 1.7962 1.406 0.1596
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for binomial family taken to be 1)
##
## Null deviance: 62.687 on 49 degrees of freedom
## Residual deviance: 31.677 on 33 degrees of freedom
## AIC: 65.677
##
## Number of Fisher Scoring iterations: 7
publish(fit.mrs_90_3_6)
## Variable Units OddsRatio CI.95 p-value
## age 1.15 [0.93;1.42] 0.19591
## se_x F Ref
## M 2.83 [0.20;40.51] 0.44440
## htn NO Ref
## YES 0.00 [0.00;0.46] 0.02313
## diabetes_mellitus NO Ref
## YES 0.23 [0.02;2.91] 0.25628
## lipid NO Ref
## YES 3.01 [0.25;36.78] 0.38738
## smoking NO Ref
## YES 1.89 [0.15;23.95] 0.62458
## atrial_fibrilation NO Ref
## YES 0.28 [0.01;8.01] 0.46005
## time_from_onset_to_proderure 1.84 [0.80;4.26] 0.15306
## location BASILAR Ref
## OTHERS 0.78 [0.01;103.20] 0.91944
## CAROTID 0.12 [0.00;7.20] 0.31325
## MCA 9.42 [0.21;414.66] 0.24535
## no_of_trials 1 Ref
## 2 0.53 [0.03;10.08] 0.67295
## 3 0.03 [0.00;5.49] 0.18402
## endovascular_treatment ASP Ref
## ASP+STENT 20.45 [0.42;1006.50] 0.12892
## STENT 7.65 [0.28;211.79] 0.22980
## rtpa NO Ref
## YES 12.51 [0.37;422.77] 0.15960
#mrs_90_0
fit.mrs_90_0 = glm(mrs_90_0 ~age + se_x + htn + diabetes_mellitus + lipid +smoking
+ atrial_fibrilation
+ time_from_onset_to_proderure+ location + no_of_trials
+ endovascular_treatment + rtpa
, data = data1, family = binomial )
summary(fit.mrs_90_0)
##
## Call:
## glm(formula = mrs_90_0 ~ age + se_x + htn + diabetes_mellitus +
## lipid + smoking + atrial_fibrilation + time_from_onset_to_proderure +
## location + no_of_trials + endovascular_treatment + rtpa,
## family = binomial, data = data1)
##
## Deviance Residuals:
## Min 1Q Median 3Q Max
## -2.15147 -0.06745 0.17523 0.53887 1.31551
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 13.1928 8.6501 1.525 0.1272
## age -0.1386 0.1072 -1.293 0.1959
## se_xM -1.0390 1.3585 -0.765 0.4444
## htnYES 5.6240 2.4762 2.271 0.0231 *
## diabetes_mellitusYES 1.4726 1.2971 1.135 0.2563
## lipidYES -1.1033 1.2764 -0.864 0.3874
## smokingYES -0.6346 1.2967 -0.489 0.6246
## atrial_fibrilationYES 1.2585 1.7035 0.739 0.4601
## time_from_onset_to_proderure -0.6113 0.4278 -1.429 0.1531
## locationOTHERS 0.2523 2.4944 0.101 0.9194
## locationCAROTID 2.0922 2.0747 1.008 0.3133
## locationMCA -2.2431 1.9308 -1.162 0.2454
## no_of_trials2 0.6343 1.5026 0.422 0.6729
## no_of_trials3 3.5841 2.6979 1.328 0.1840
## endovascular_treatmentASP+STENT -3.0182 1.9878 -1.518 0.1289
## endovascular_treatmentSTENT -2.0347 1.6944 -1.201 0.2298
## rtpaYES -2.5263 1.7962 -1.406 0.1596
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for binomial family taken to be 1)
##
## Null deviance: 62.687 on 49 degrees of freedom
## Residual deviance: 31.677 on 33 degrees of freedom
## AIC: 65.677
##
## Number of Fisher Scoring iterations: 7
publish(fit.mrs_90_0)
## Variable Units OddsRatio CI.95 p-value
## age 0.87 [0.71;1.07] 0.19591
## se_x F Ref
## M 0.35 [0.02;5.07] 0.44440
## htn NO Ref
## YES 277.01 [2.16;35500.01] 0.02313
## diabetes_mellitus NO Ref
## YES 4.36 [0.34;55.42] 0.25628
## lipid NO Ref
## YES 0.33 [0.03;4.05] 0.38738
## smoking NO Ref
## YES 0.53 [0.04;6.73] 0.62458
## atrial_fibrilation NO Ref
## YES 3.52 [0.12;99.21] 0.46005
## time_from_onset_to_proderure 0.54 [0.23;1.26] 0.15306
## location BASILAR Ref
## OTHERS 1.29 [0.01;170.92] 0.91944
## CAROTID 8.10 [0.14;472.71] 0.31325
## MCA 0.11 [0.00;4.67] 0.24535
## no_of_trials 1 Ref
## 2 1.89 [0.10;35.85] 0.67295
## 3 36.02 [0.18;7129.57] 0.18402
## endovascular_treatment ASP Ref
## ASP+STENT 0.05 [0.00;2.41] 0.12892
## STENT 0.13 [0.00;3.62] 0.22980
## rtpa NO Ref
## YES 0.08 [0.00;2.70] 0.15960
#ich age, sex, hypertension, atrial fibrillation,
#and time from onset to procedure
fit.ich = glm(ich ~ age + rtpa + se_x + htn + lipid + atrial_fibrilation
+ time_from_onset_to_proderure+ location + no_of_trials
, data = data1, family = binomial )
summary(fit.ich)
##
## Call:
## glm(formula = ich ~ age + rtpa + se_x + htn + lipid + atrial_fibrilation +
## time_from_onset_to_proderure + location + no_of_trials, family = binomial,
## data = data1)
##
## Deviance Residuals:
## Min 1Q Median 3Q Max
## -1.9539 -0.5543 -0.1536 0.4660 2.4990
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) -7.0708 6.5164 -1.085 0.2779
## age 0.1715 0.1071 1.601 0.1093
## rtpaYES 1.7528 1.2804 1.369 0.1710
## se_xM -1.3052 1.1162 -1.169 0.2423
## htnYES -1.9210 1.4102 -1.362 0.1731
## lipidYES 1.1822 1.0789 1.096 0.2732
## atrial_fibrilationYES 1.7539 1.3927 1.259 0.2079
## time_from_onset_to_proderure -0.6712 0.3688 -1.820 0.0688 .
## locationOTHERS 1.2457 2.3713 0.525 0.5994
## locationCAROTID 2.8582 1.7053 1.676 0.0937 .
## locationMCA 1.4759 1.7679 0.835 0.4038
## no_of_trials2 -1.8330 1.0914 -1.680 0.0930 .
## no_of_trials3 -16.9227 2763.7278 -0.006 0.9951
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for binomial family taken to be 1)
##
## Null deviance: 67.301 on 49 degrees of freedom
## Residual deviance: 35.935 on 37 degrees of freedom
## AIC: 61.935
##
## Number of Fisher Scoring iterations: 16
publish(fit.ich)
## Variable Units OddsRatio CI.95 p-value
## age 1.19 [0.96;1.46] 0.10933
## rtpa NO Ref
## YES 5.77 [0.47;70.98] 0.17103
## se_x F Ref
## M 0.27 [0.03;2.42] 0.24227
## htn NO Ref
## YES 0.15 [0.01;2.32] 0.17312
## lipid NO Ref
## YES 3.26 [0.39;27.02] 0.27319
## atrial_fibrilation NO Ref
## YES 5.78 [0.38;88.55] 0.20791
## time_from_onset_to_proderure 0.51 [0.25;1.05] 0.06878
## location BASILAR Ref
## OTHERS 3.48 [0.03;362.62] 0.59936
## CAROTID 17.43 [0.62;493.05] 0.09373
## MCA 4.37 [0.14;139.90] 0.40382
## no_of_trials 1 Ref
## 2 0.16 [0.02;1.36] 0.09305
## 3 0.00 [0.00;Inf] 0.99511
#s_ich
fit.sich = glm(s_ich ~ age + rtpa + se_x + htn + atrial_fibrilation
+ time_from_onset_to_proderure
, data = data1, family = binomial )
summary(fit.sich)
##
## Call:
## glm(formula = s_ich ~ age + rtpa + se_x + htn + atrial_fibrilation +
## time_from_onset_to_proderure, family = binomial, data = data1)
##
## Deviance Residuals:
## Min 1Q Median 3Q Max
## -1.2654 -0.2882 -0.2479 -0.1739 2.8040
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) -5.92024 6.31675 -0.937 0.3486
## age 0.05900 0.09507 0.621 0.5349
## rtpaYES 2.93065 1.60076 1.831 0.0671 .
## se_xM 0.20640 1.14960 0.180 0.8575
## htnYES -0.25743 1.12052 -0.230 0.8183
## atrial_fibrilationYES 0.06995 1.15071 0.061 0.9515
## time_from_onset_to_proderure -0.18087 0.42528 -0.425 0.6706
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for binomial family taken to be 1)
##
## Null deviance: 40.496 on 49 degrees of freedom
## Residual deviance: 28.419 on 43 degrees of freedom
## AIC: 42.419
##
## Number of Fisher Scoring iterations: 6
publish(fit.sich)
## Variable Units OddsRatio CI.95 p-value
## age 1.06 [0.88;1.28] 0.53487
## rtpa NO Ref
## YES 18.74 [0.81;431.85] 0.06713
## se_x F Ref
## M 1.23 [0.13;11.70] 0.85751
## htn NO Ref
## YES 0.77 [0.09;6.95] 0.81829
## atrial_fibrilation NO Ref
## YES 1.07 [0.11;10.23] 0.95153
## time_from_onset_to_proderure 0.83 [0.36;1.92] 0.67062
#death
fit.death = glm(death ~ age + rtpa + se_x + htn + lipid + atrial_fibrilation
+ time_from_onset_to_proderure+ location + no_of_trials
, data = data1, family = binomial )
## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred
summary(fit.death)
##
## Call:
## glm(formula = death ~ age + rtpa + se_x + htn + lipid + atrial_fibrilation +
## time_from_onset_to_proderure + location + no_of_trials, family = binomial,
## data = data1)
##
## Deviance Residuals:
## Min 1Q Median 3Q Max
## -1.09936 -0.33285 -0.00006 0.00000 2.18271
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) -1.840e+01 9.516e+03 -0.002 0.998
## age 5.258e-02 1.097e-01 0.479 0.632
## rtpaYES -4.359e-01 1.984e+00 -0.220 0.826
## se_xM -1.122e+00 1.548e+00 -0.725 0.468
## htnYES -1.744e+00 1.509e+00 -1.155 0.248
## lipidYES -2.255e-01 1.465e+00 -0.154 0.878
## atrial_fibrilationYES -1.765e+01 7.713e+03 -0.002 0.998
## time_from_onset_to_proderure -4.822e-01 5.244e-01 -0.920 0.358
## locationOTHERS -1.917e+00 1.385e+04 0.000 1.000
## locationCAROTID 1.877e+01 9.516e+03 0.002 0.998
## locationMCA 1.925e+01 9.516e+03 0.002 0.998
## no_of_trials2 -1.828e+01 6.441e+03 -0.003 0.998
## no_of_trials3 -1.833e+01 1.784e+04 -0.001 0.999
##
## (Dispersion parameter for binomial family taken to be 1)
##
## Null deviance: 27.877 on 49 degrees of freedom
## Residual deviance: 16.823 on 37 degrees of freedom
## AIC: 42.823
##
## Number of Fisher Scoring iterations: 20
publish(fit.death)
## Variable Units OddsRatio CI.95 p-value
## age 1.05 [0.85;1.31] 0.6317
## rtpa NO Ref
## YES 0.65 [0.01;31.56] 0.8261
## se_x F Ref
## M 0.33 [0.02;6.76] 0.4685
## htn NO Ref
## YES 0.17 [0.01;3.37] 0.2479
## lipid NO Ref
## YES 0.80 [0.05;14.10] 0.8777
## atrial_fibrilation NO Ref
## YES 0.00 [0.00;Inf] 0.9982
## time_from_onset_to_proderure 0.62 [0.22;1.73] 0.3578
## location BASILAR Ref
## OTHERS 0.15 [0.00;Inf] 0.9999
## CAROTID 142354991.39 [0.00;Inf] 0.9984
## MCA 228416322.95 [0.00;Inf] 0.9984
## no_of_trials 1 Ref
## 2 0.00 [0.00;Inf] 0.9977
## 3 0.00 [0.00;Inf] 0.9992
#Univariate logistic
fitt.ich = glm(ich ~ rtpa
, data = data1, family = binomial )
summary(fitt.ich)
##
## Call:
## glm(formula = ich ~ rtpa, family = binomial, data = data1)
##
## Deviance Residuals:
## Min 1Q Median 3Q Max
## -1.7941 -0.7204 -0.7204 0.6681 1.7181
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) -1.2164 0.4025 -3.022 0.002513 **
## rtpaYES 2.6027 0.7607 3.421 0.000623 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for binomial family taken to be 1)
##
## Null deviance: 67.301 on 49 degrees of freedom
## Residual deviance: 52.640 on 48 degrees of freedom
## AIC: 56.64
##
## Number of Fisher Scoring iterations: 4
publish(fitt.ich)
## Variable Units OddsRatio CI.95 p-value
## rtpa NO Ref
## YES 13.50 [3.04;59.96] 0.0006232
fitt.sich= glm(ich ~ rtpa
, data = data1, family = binomial )
summary(fitt.sich)
##
## Call:
## glm(formula = ich ~ rtpa, family = binomial, data = data1)
##
## Deviance Residuals:
## Min 1Q Median 3Q Max
## -1.7941 -0.7204 -0.7204 0.6681 1.7181
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) -1.2164 0.4025 -3.022 0.002513 **
## rtpaYES 2.6027 0.7607 3.421 0.000623 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for binomial family taken to be 1)
##
## Null deviance: 67.301 on 49 degrees of freedom
## Residual deviance: 52.640 on 48 degrees of freedom
## AIC: 56.64
##
## Number of Fisher Scoring iterations: 4
publish(fitt.sich)
## Variable Units OddsRatio CI.95 p-value
## rtpa NO Ref
## YES 13.50 [3.04;59.96] 0.0006232
#AVOVA for models
fit.sich = glm(s_ich ~ age + rtpa + se_x + htn + atrial_fibrilation
+ time_from_onset_to_proderure + location
, data = data1, family = binomial )
fit.sich.no.rtpa = glm(s_ich ~ age + se_x + htn + atrial_fibrilation
+ time_from_onset_to_proderure
, data = data1, family = binomial )
summary(fit.sich)
##
## Call:
## glm(formula = s_ich ~ age + rtpa + se_x + htn + atrial_fibrilation +
## time_from_onset_to_proderure + location, family = binomial,
## data = data1)
##
## Deviance Residuals:
## Min 1Q Median 3Q Max
## -1.19152 -0.37390 -0.21075 -0.00017 3.12561
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) -23.9227 2393.8661 -0.010 0.9920
## age 0.0891 0.1009 0.883 0.3773
## rtpaYES 2.9196 1.7628 1.656 0.0977 .
## se_xM 0.8966 1.4057 0.638 0.5236
## htnYES -0.1316 1.1996 -0.110 0.9127
## atrial_fibrilationYES 0.4673 1.2189 0.383 0.7014
## time_from_onset_to_proderure -0.1716 0.4477 -0.383 0.7015
## locationOTHERS 17.0855 2393.8565 0.007 0.9943
## locationCAROTID 15.6485 2393.8562 0.007 0.9948
## locationMCA 14.8407 2393.8562 0.006 0.9951
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for binomial family taken to be 1)
##
## Null deviance: 40.496 on 49 degrees of freedom
## Residual deviance: 25.914 on 40 degrees of freedom
## AIC: 45.914
##
## Number of Fisher Scoring iterations: 17
publish(fit.sich)
## Variable Units OddsRatio CI.95 p-value
## age 1.09 [0.90;1.33] 0.37731
## rtpa NO Ref
## YES 18.53 [0.59;586.79] 0.09768
## se_x F Ref
## M 2.45 [0.16;38.54] 0.52359
## htn NO Ref
## YES 0.88 [0.08;9.20] 0.91267
## atrial_fibrilation NO Ref
## YES 1.60 [0.15;17.40] 0.70145
## time_from_onset_to_proderure 0.84 [0.35;2.03] 0.70152
## location BASILAR Ref
## OTHERS 26309838.25 [0.00;Inf] 0.99431
## CAROTID 6252637.74 [0.00;Inf] 0.99478
## MCA 2787614.94 [0.00;Inf] 0.99505
publish(anova(fit.sich.no.rtpa , fit.sich , test = 'Chisq'))
## Resid. Df Resid. Dev Df Deviance Pr(>Chi)
## 1 44 33.7777997276428 NA NA NA
## 2 40 25.9142548291279 4 7.86354489851489 0.0967065636272354