Vascular

Quarto

Quarto enables you to weave together content and executable code into a finished document. To learn more about Quarto see https://quarto.org.

Running Code

When you click the Render button a document will be generated that includes both content and the output of embedded code. You can embed code like this:

library(tidyverse)
Warning: package 'tidyverse' was built under R version 4.3.2
Warning: package 'ggplot2' was built under R version 4.3.2
── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
✔ dplyr     1.1.2     ✔ readr     2.1.4
✔ forcats   1.0.0     ✔ stringr   1.5.0
✔ ggplot2   3.4.4     ✔ tibble    3.2.1
✔ lubridate 1.9.2     ✔ tidyr     1.3.0
✔ purrr     1.0.1     
── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
✖ dplyr::filter() masks stats::filter()
✖ dplyr::lag()    masks stats::lag()
ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
library(here)
Warning: package 'here' was built under R version 4.3.2
here() starts at C:/Users/GAMcleod/OneDrive - University of Dundee/Edin MSc/Vascular
library(janitor)
Warning: package 'janitor' was built under R version 4.3.2

Attaching package: 'janitor'

The following objects are masked from 'package:stats':

    chisq.test, fisher.test
library(skimr)
Warning: package 'skimr' was built under R version 4.3.2
library(gapminder)
Warning: package 'gapminder' was built under R version 4.3.2
library(lubridate)
library(survival)
library(Hmisc)
Warning: package 'Hmisc' was built under R version 4.3.2

Attaching package: 'Hmisc'

The following objects are masked from 'package:dplyr':

    src, summarize

The following objects are masked from 'package:base':

    format.pval, units
library(rms)
Warning: package 'rms' was built under R version 4.3.2
library(finalfit)
Warning: package 'finalfit' was built under R version 4.3.2
library(forcats)
library(survminer)
Warning: package 'survminer' was built under R version 4.3.3
Loading required package: ggpubr
Warning: package 'ggpubr' was built under R version 4.3.2

Attaching package: 'survminer'

The following object is masked from 'package:survival':

    myeloma
library(here)

The echo: false option disables the printing of code (only output is displayed).

vascular <- read_csv("C:/Users/GAMcleod/OneDrive - University of Dundee/Edin MSc/Vascular/data/vascular.csv")
New names:
Rows: 455 Columns: 358
── Column specification
──────────────────────────────────────────────────────── Delimiter: "," chr
(58): Date_Admission...9, Date_NSTI, Date_Admission...145, Date_Critica... dbl
(253): No, Age, Sex, Admissions, Admissions_Infection, Censor_NSTI, NSTI... lgl
(47): NSTI_13, NSTI_14, ...59, ...89, ...90, Duration_Hosp_11, Duration...
ℹ Use `spec()` to retrieve the full column specification for this data. ℹ
Specify the column types or set `show_col_types = FALSE` to quiet this message.
• `Date_Admission` -> `Date_Admission...9`
• `` -> `...59`
• `` -> `...80`
• `` -> `...89`
• `` -> `...90`
• `` -> `...105`
• `` -> `...106`
• `` -> `...107`
• `` -> `...136`
• `` -> `...137`
• `` -> `...138`
• `` -> `...139`
• `` -> `...140`
• `` -> `...141`
• `` -> `...142`
• `` -> `...143`
• `` -> `...144`
• `Date_Admission` -> `Date_Admission...145`
• `Date of Discharge` -> `Date of Discharge...147`
• `Date of Admission` -> `Date of Admission...148`
• `Date of Critical Care Admission` -> `Date of Critical Care Admission...149`
• `Date of Discharge` -> `Date of Discharge...150`
• `Date of Admission` -> `Date of Admission...151`
• `Date of Critical Care Admission` -> `Date of Critical Care Admission...152`
• `Date of Discharge` -> `Date of Discharge...153`
• `Date of Admission` -> `Date of Admission...154`
• `` -> `...155`
• `Date of Discharge` -> `Date of Discharge...156`
• `Date of Admission` -> `Date of Admission...157`
• `` -> `...158`
• `Date of Discharge` -> `Date of Discharge...159`
• `Date of Admission` -> `Date of Admission...160`
• `` -> `...161`
• `Date of Discharge` -> `Date of Discharge...162`
• `Date of Admission` -> `Date of Admission...163`
• `` -> `...164`
• `Date of Discharge` -> `Date of Discharge...165`
• `Date of Admission` -> `Date of Admission...166`
• `Date of Critical Care Admission` -> `Date of Critical Care Admission...167`
• `Date of Discharge` -> `Date of Discharge...168`
• `Date of Critical Care Admission` -> `Date of Critical Care Admission...170`
• `Date of Admin` -> `Date of Admin...172`
• `Date of Critical Care Admission` -> `Date of Critical Care Admission...173`
• `Date of Discharge` -> `Date of Discharge...174`
• `Date of Admin` -> `Date of Admin...175`
• `Date of Critical Care Admission` -> `Date of Critical Care Admission...176`
• `Date of Discharge` -> `Date of Discharge...177`
• `Date of Admin` -> `Date of Admin...178`
• `Date of Critical Care Admission` -> `Date of Critical Care Admission...179`
• `Date of Discharge` -> `Date of Discharge...180`
• `Date of Admin` -> `Date of Admin...181`
• `Date of Critical Care Admission` -> `Date of Critical Care Admission...182`
• `Date of Discharge` -> `Date of Discharge...183`
• `Date of Admin` -> `Date of Admin...184`
• `Date of Critical Care Admission` -> `Date of Critical Care Admission...185`
• `Date of Discharge` -> `Date of Discharge...186`
• `Date of Critical Care Admission` -> `Date of Critical Care Admission...188`
• `` -> `...345`
• `` -> `...346`
• `` -> `...347`
• `` -> `...348`
• `` -> `...349`
• `` -> `...350`
• `` -> `...351`
• `` -> `...352`
• `` -> `...353`
• `` -> `...354`
• `` -> `...355`
• `` -> `...356`
• `` -> `...357`
• `` -> `...358`
Vascular<-vascular %>% 
  mutate(Sex.factor = factor(Sex) %>%          
           fct_recode(           
             "Male" = "0",      
             "Female"   = "1"))

NSTI

attach(Vascular)
ddist<-datadist (Age, Sex, Sex.factor, Admissions, Admissions_Infection, Censor_NSTI, NSTI_Total, T_NSTI,NSTI_Position, Pseudoaneurysm, Dur_Hosp, Dur_Crit, Dur_Crit_Censor, Albumin, Creatinine, CRP, Glucose, Hb, Lactate, Na, Urea, WCC,Censor_Amp, Censor_Death)
options (datadist= 'ddist')

Covariate - Sex

survival_object <-vascular %$% Surv(T_NSTI/365, Censor_NSTI)
all_survfit <- survfit(survival_object ~ 1, data = vascular)
all_survfit
Call: survfit(formula = survival_object ~ 1, data = vascular)

       n events median 0.95LCL 0.95UCL
[1,] 455    138   10.8      NA      NA
fit_sex<- survfit(Surv(T_NSTI/365, Censor_NSTI) ~  Sex.factor, data=Vascular, conf.int = TRUE)
class(fit_sex)
[1] "survfit"
ggsurvplot(fit_sex,data=vascular, conf.int=TRUE, legend.title = "Sex",legend.labs = c("Female", "Male"), legend ="top", xlab = "Time (years)", ylab ="NSTI probability", title ="NSTI")

Covariate - No. of admissions

fit_adm_no<- survfit(Surv(T_NSTI/365, Censor_NSTI) ~  Admissions, data=vascular)
class(fit_adm_no)
[1] "survfit"
ggsurvplot(fit_adm_no,data=vascular, legend.title = "No. of admissions presenting with infection", legend.labs = c("1",
"2", "3", "4", "5", "6", "7", "8","9","10","11", "12", "13"),legend ="top", xlab = "Time (years)",ylab = "NSTI probability", title ="NSTI")

Covariate - Mortality

fit_nsti<- survfit(Surv(T_Death/365, Censor_Death) ~  Censor_NSTI, data=Vascular)
class(fit_nsti)
[1] "survfit"
ggsurvplot(fit_nsti,data
           =vascular, conf.int=TRUE,legend.title = "Nectrotising soft tissue infections",legend.labs = c("No",
"Yes"), legend ="top", xlab = "Time (years)", title ="Mortality")

NSTI -Survival model using coxzph

dependent_os  <- "Surv(T_NSTI, Censor_NSTI)"
explanatory   <- c("Age","Sex.factor","Admissions", "Admissions_Infection", "NSTI_Total", "Pseudoaneurysm", "Dur_Hosp", "Dur_Crit", "Dur_Crit_Censor", "Censor_Amp","Albumin", "Hb","WCC","CRP","Glucose", "Na", "Urea", "Creatinine", "Lactate")

vascular %>% 
    coxphmulti(dependent_os, explanatory) %>% 
    cox.zph()
                        chisq df       p
Age                   0.09771  1 0.75459
Sex.factor            0.00011  1 0.99162
Admissions           13.71986  1 0.00021
Admissions_Infection 16.63165  1 4.5e-05
NSTI_Total            8.95507  1 0.00277
Pseudoaneurysm        0.01116  1 0.91587
Dur_Hosp             12.33326  1 0.00044
Dur_Crit              4.94874  1 0.02611
Dur_Crit_Censor       3.22279  1 0.07262
Censor_Amp            1.24882  1 0.26378
Albumin               6.65030  1 0.00991
Hb                    4.58412  1 0.03227
WCC                   2.80165  1 0.09417
CRP                   4.16889  1 0.04117
Glucose               2.37415  1 0.12336
Na                    0.33399  1 0.56332
Urea                  2.09226  1 0.14805
Creatinine            1.19487  1 0.27435
Lactate               2.45584  1 0.11709
GLOBAL               31.78287 19 0.03306

NSTI Survival model using Surv Iteration_1

fit_nsti<- cph(Surv(T_NSTI, Censor_NSTI) ~  rcs(Age,3) + Sex  + Pseudoaneurysm+ Admissions+ Admissions_Infection+ rcs(Dur_Hosp,3) +  Dur_Crit_Censor +  Censor_Amp + rcs(Hb,3) + rcs(WCC,3) + rcs(CRP,3)+ +rcs(Na,3) + rcs(Albumin,3) + rcs(Urea,3) + rcs(Creatinine,3) +rcs(Lactate,3) + rcs(Glucose,3), x = TRUE, y = TRUE,surv=TRUE,data=vascular)

anova(fit_nsti)
                Wald Statistics          Response: Surv(T_NSTI, Censor_NSTI) 

 Factor               Chi-Square d.f. P     
 Age                   0.00       2   0.9992
  Nonlinear            0.00       1   0.9708
 Sex                   0.32       1   0.5736
 Pseudoaneurysm        4.62       1   0.0315
 Admissions            0.07       1   0.7893
 Admissions_Infection  1.64       1   0.2007
 Dur_Hosp              9.35       2   0.0093
  Nonlinear            1.20       1   0.2726
 Dur_Crit_Censor       0.48       1   0.4901
 Censor_Amp            1.96       1   0.1616
 Hb                    3.30       2   0.1923
  Nonlinear            2.43       1   0.1192
 WCC                   0.26       2   0.8794
  Nonlinear            0.05       1   0.8240
 CRP                   7.81       2   0.0201
  Nonlinear            0.00       1   0.9672
 Na                    0.41       2   0.8160
  Nonlinear            0.28       1   0.5935
 Albumin               0.17       2   0.9166
  Nonlinear            0.04       1   0.8510
 Urea                  4.63       2   0.0988
  Nonlinear            4.16       1   0.0414
 Creatinine            6.12       2   0.0470
  Nonlinear            5.86       1   0.0155
 Lactate               1.19       2   0.5529
  Nonlinear            1.15       1   0.2827
 Glucose               4.25       2   0.1193
  Nonlinear            0.47       1   0.4939
 TOTAL NONLINEAR       9.79      11   0.5497
 TOTAL                62.31      28   0.0002
validate(fit_nsti, B =50,dxy=TRUE)
      index.orig training    test optimism index.corrected  n
Dxy       0.5032   0.6089  0.4051   0.2038          0.2994 50
R2        0.2825   0.3836  0.1453   0.2383          0.0441 50
Slope     1.0000   1.0000  0.3998   0.6002          0.3998 50
D         0.0972   0.1465  0.0457   0.1008         -0.0036 50
U        -0.0033  -0.0034  0.4613  -0.4647          0.4614 50
Q         0.1005   0.1499 -0.4156   0.5655         -0.4650 50
g         1.1577   1.7380  0.7075   1.0305          0.1271 50

Iteration_2

fit_nsti<- cph(Surv(T_NSTI, Censor_NSTI) ~  Age + Sex  + Pseudoaneurysm+ Admissions+  Admissions_Infection + rcs(Dur_Hosp,3) + Dur_Crit + Dur_Crit_Censor +  Censor_Amp + Hb + WCC + CRP +Na +Albumin +rcs(Urea,3) +rcs(Creatinine,3) +Lactate +Glucose, x = TRUE, y = TRUE,surv=TRUE,data=vascular)

anova(fit_nsti)
                Wald Statistics          Response: Surv(T_NSTI, Censor_NSTI) 

 Factor               Chi-Square d.f. P     
 Age                   0.13       1   0.7196
 Sex                   0.01       1   0.9150
 Pseudoaneurysm        3.80       1   0.0514
 Admissions            0.08       1   0.7776
 Admissions_Infection  1.40       1   0.2364
 Dur_Hosp              9.15       2   0.0103
  Nonlinear            1.08       1   0.2992
 Dur_Crit              0.14       1   0.7095
 Dur_Crit_Censor       0.48       1   0.4904
 Censor_Amp            3.10       1   0.0782
 Hb                    1.00       1   0.3178
 WCC                   0.24       1   0.6276
 CRP                  10.55       1   0.0012
 Na                    0.18       1   0.6716
 Albumin               0.01       1   0.9080
 Urea                  3.16       2   0.2059
  Nonlinear            2.81       1   0.0939
 Creatinine            5.72       2   0.0571
  Nonlinear            5.46       1   0.0194
 Lactate               0.07       1   0.7978
 Glucose               6.40       1   0.0114
 TOTAL NONLINEAR       6.32       3   0.0968
 TOTAL                57.81      21   <.0001
validate(fit_nsti, B =50,dxy=TRUE)
      index.orig training    test optimism index.corrected  n
Dxy       0.4915   0.5560  0.4156   0.1404          0.3511 50
R2        0.2672   0.3391  0.1660   0.1731          0.0941 50
Slope     1.0000   1.0000  0.5206   0.4794          0.5206 50
D         0.0910   0.1202  0.0530   0.0672          0.0238 50
U        -0.0033  -0.0032  0.2248  -0.2280          0.2247 50
Q         0.0943   0.1234 -0.1718   0.2952         -0.2009 50
g         1.1039   1.4210  0.7505   0.6706          0.4334 50

Iteration_3

fit_nsti_cph3<- cph(Surv(T_NSTI, Censor_NSTI) ~  Pseudoaneurysm + Admissions_Infection+ Dur_Hosp  + CRP  +rcs(Urea,3) +rcs(Creatinine,3)  +Glucose, x = TRUE, y = TRUE,surv=TRUE,data=vascular)

anova(fit_nsti)
                Wald Statistics          Response: Surv(T_NSTI, Censor_NSTI) 

 Factor               Chi-Square d.f. P     
 Age                   0.13       1   0.7196
 Sex                   0.01       1   0.9150
 Pseudoaneurysm        3.80       1   0.0514
 Admissions            0.08       1   0.7776
 Admissions_Infection  1.40       1   0.2364
 Dur_Hosp              9.15       2   0.0103
  Nonlinear            1.08       1   0.2992
 Dur_Crit              0.14       1   0.7095
 Dur_Crit_Censor       0.48       1   0.4904
 Censor_Amp            3.10       1   0.0782
 Hb                    1.00       1   0.3178
 WCC                   0.24       1   0.6276
 CRP                  10.55       1   0.0012
 Na                    0.18       1   0.6716
 Albumin               0.01       1   0.9080
 Urea                  3.16       2   0.2059
  Nonlinear            2.81       1   0.0939
 Creatinine            5.72       2   0.0571
  Nonlinear            5.46       1   0.0194
 Lactate               0.07       1   0.7978
 Glucose               6.40       1   0.0114
 TOTAL NONLINEAR       6.32       3   0.0968
 TOTAL                57.81      21   <.0001
validate(fit_nsti, B =50,dxy=TRUE)
      index.orig training    test optimism index.corrected  n
Dxy       0.4915   0.5695  0.4175   0.1520          0.3395 50
R2        0.2672   0.3435  0.1576   0.1859          0.0813 50
Slope     1.0000   1.0000  0.4786   0.5214          0.4786 50
D         0.0910   0.1250  0.0500   0.0750          0.0160 50
U        -0.0033  -0.0033  0.2902  -0.2935          0.2902 50
Q         0.0943   0.1283 -0.2402   0.3685         -0.2743 50
g         1.1039   1.4467  0.7149   0.7317          0.3722 50
p<-Predict(fit_nsti_cph3, fun=function(x) 1/(1+exp(-x)), conf.int=0.9)
ggplot(p)

p<-Predict(fit_nsti_cph3, Admissions_Infection, fun=function(x) 1/(1+exp(-x)), conf.int=0.9)
b<-ggplot(p)
b+labs(x="Admissions with Infection (n)",y="Relative Hazard")+theme_classic()+theme(text = element_text(size = 18))

p<-Predict(fit_nsti_cph3, Creatinine, fun=function(x) 1/(1+exp(-x)), conf.int=0.9)
b<-ggplot(p)
b+labs(x="Creatinine ('µmol/L)",y="Relative Hazard")+theme_classic()+theme(text = element_text(size = 18))

p<-Predict(fit_nsti_cph3, CRP, fun=function(x) 1/(1+exp(-x)), conf.int=0.9)
b<-ggplot(p)
b+labs(x="CRP (mg/L)",y="Relative Hazard")+theme_classic()+theme(text = element_text(size = 18))

p<-Predict(fit_nsti_cph3, Dur_Hosp, fun=function(x) 1/(1+exp(-x)), conf.int=0.9)
b<-ggplot(p)
b+labs(x="Hospital stay (Days)",y="Relative Hazard")+theme_classic()+theme(text = element_text(size = 18))

p<-Predict(fit_nsti_cph3, Glucose, fun=function(x) 1/(1+exp(-x)), conf.int=0.9)
b<-ggplot(p)
b+labs(x="Glucose (mmol/L)",y="Relative Hazard")+theme_classic()+theme(text = element_text(size = 18))

p<-Predict(fit_nsti_cph3, Pseudoaneurysm, fun=function(x) 1/(1+exp(-x)), conf.int=0.9)
b<-ggplot(p)
b+labs(x="Pseudoaneurysm",y="Relative Hazard")+theme_classic()+theme(text = element_text(size = 18))

p<-Predict(fit_nsti_cph3, Pseudoaneurysm, fun=function(x) 1/(1+exp(-x)), conf.int=0.9)
b<-ggplot(p)
b+labs(x="Urea (mmol/L",y="Relative Hazard")+theme_classic()+theme(text = element_text(size = 18))

GLM model Iteration_1

glm(formula = Censor_NSTI ~ Age + Sex  +  Pseudoaneurysm+  + Dur_Hosp +  Dur_Crit_Censor + Hb + WCC + CRP +Na + Albumin + Urea + Creatinine +Lactate + Glucose, family = binomial(), data = vascular, x = TRUE, y = TRUE)

Call:  glm(formula = Censor_NSTI ~ Age + Sex + Pseudoaneurysm + +Dur_Hosp + 
    Dur_Crit_Censor + Hb + WCC + CRP + Na + Albumin + Urea + 
    Creatinine + Lactate + Glucose, family = binomial(), data = vascular, 
    x = TRUE, y = TRUE)

Coefficients:
    (Intercept)              Age              Sex   Pseudoaneurysm  
       3.530023        -0.002588         0.265342         0.943523  
       Dur_Hosp  Dur_Crit_Censor               Hb              WCC  
       0.032718         0.278834        -0.004619        -0.013181  
            CRP               Na          Albumin             Urea  
       0.005374        -0.044025        -0.003057         0.016215  
     Creatinine          Lactate          Glucose  
      -0.006894        -0.013897         0.100345  

Degrees of Freedom: 189 Total (i.e. Null);  175 Residual
  (265 observations deleted due to missingness)
Null Deviance:      242.8 
Residual Deviance: 187.1    AIC: 217.1

Iteration_2

fit_nsti_glm2 <-glm(formula = Censor_NSTI ~   Pseudoaneurysm +  Admissions_Infection + rcs(Dur_Hosp,3)    + CRP   +rcs(Urea,3) +rcs(Creatinine,3)  +Glucose,family = binomial(), x = TRUE, y = TRUE,data=vascular)
fit_nsti_glm2

Call:  glm(formula = Censor_NSTI ~ Pseudoaneurysm + Admissions_Infection + 
    rcs(Dur_Hosp, 3) + CRP + rcs(Urea, 3) + rcs(Creatinine, 3) + 
    Glucose, family = binomial(), data = vascular, x = TRUE, 
    y = TRUE)

Coefficients:
                  (Intercept)                 Pseudoaneurysm  
                    -5.055753                       0.917565  
         Admissions_Infection       rcs(Dur_Hosp, 3)Dur_Hosp  
                    -0.235011                      -0.032034  
    rcs(Dur_Hosp, 3)Dur_Hosp'                            CRP  
                     0.124988                       0.007813  
             rcs(Urea, 3)Urea              rcs(Urea, 3)Urea'  
                    -0.477282                       0.637192  
 rcs(Creatinine, 3)Creatinine  rcs(Creatinine, 3)Creatinine'  
                     0.065760                      -0.075464  
                      Glucose  
                     0.173923  

Degrees of Freedom: 203 Total (i.e. Null);  193 Residual
  (251 observations deleted due to missingness)
Null Deviance:      264.9 
Residual Deviance: 198.2    AIC: 220.2

Logistic model Iteration_1

fit_nsti_lrm<-lrm(formula = Censor_NSTI ~ rcs(Age,3) + Sex   + Pseudoaneurysm+Admissions+ Admissions_Infection+  rcs(Dur_Hosp,3) +  Dur_Crit_Censor +  Censor_Amp + rcs(Hb,3) + rcs(WCC,3) + rcs(CRP,3) +rcs(Na,3) + rcs(Albumin,3) + rcs(Urea,3) + rcs(Creatinine,3) +rcs(Lactate,3) + rcs(Glucose,3),data = vascular, x = TRUE, y = TRUE)
fit_nsti_lrm
Frequencies of Missing Values Due to Each Variable
         Censor_NSTI                  Age                  Sex 
                   0                    0                    0 
      Pseudoaneurysm           Admissions Admissions_Infection 
                   0                    0                    0 
            Dur_Hosp      Dur_Crit_Censor           Censor_Amp 
                   0                    0                    0 
                  Hb                  WCC                  CRP 
                   6                   47                   46 
                  Na              Albumin                 Urea 
                  57                   51                   47 
          Creatinine              Lactate              Glucose 
                 124                  127                  229 

Logistic Regression Model

lrm(formula = Censor_NSTI ~ rcs(Age, 3) + Sex + Pseudoaneurysm + 
    Admissions + Admissions_Infection + rcs(Dur_Hosp, 3) + Dur_Crit_Censor + 
    Censor_Amp + rcs(Hb, 3) + rcs(WCC, 3) + rcs(CRP, 3) + rcs(Na, 
    3) + rcs(Albumin, 3) + rcs(Urea, 3) + rcs(Creatinine, 3) + 
    rcs(Lactate, 3) + rcs(Glucose, 3), data = vascular, x = TRUE, 
    y = TRUE)

                        Model Likelihood       Discrimination    Rank Discrim.    
                              Ratio Test              Indexes          Indexes    
Obs            190    LR chi2      81.76       R2       0.485    C       0.846    
 0             126    d.f.            28      R2(28,190)0.246    Dxy     0.693    
 1              64    Pr(> chi2) <0.0001    R2(28,127.3)0.344    gamma   0.693    
max |deriv| 0.0002                             Brier    0.131    tau-a   0.311    

                     Coef    S.E.    Wald Z Pr(>|Z|)
Intercept             7.4900 16.6018  0.45  0.6519  
Age                   0.0052  0.0784  0.07  0.9475  
Age'                 -0.0568  0.1139 -0.50  0.6182  
Sex                   0.4174  0.4761  0.88  0.3806  
Pseudoaneurysm        1.1827  0.5341  2.21  0.0268  
Admissions            0.2475  0.2129  1.16  0.2451  
Admissions_Infection -0.3843  0.3099 -1.24  0.2149  
Dur_Hosp             -0.0857  0.0496 -1.73  0.0841  
Dur_Hosp'             0.1998  0.0784  2.55  0.0109  
Dur_Crit_Censor       0.1579  0.6197  0.25  0.7989  
Censor_Amp            2.8211  1.2529  2.25  0.0243  
Hb                   -0.0402  0.0210 -1.91  0.0556  
Hb'                   0.0509  0.0269  1.89  0.0586  
WCC                  -0.0483  0.0844 -0.57  0.5671  
WCC'                  0.0349  0.1016  0.34  0.7313  
CRP                   0.0099  0.0075  1.33  0.1848  
CRP'                 -0.0030  0.0074 -0.40  0.6859  
Na                   -0.0559  0.1135 -0.49  0.6221  
Na'                   0.0109  0.1301  0.08  0.9330  
Albumin              -0.0668  0.1040 -0.64  0.5207  
Albumin'              0.0269  0.1308  0.21  0.8369  
Urea                 -0.5540  0.2987 -1.85  0.0636  
Urea'                 0.7864  0.4640  1.69  0.0901  
Creatinine            0.0752  0.0392  1.92  0.0553  
Creatinine'          -0.0903  0.0423 -2.14  0.0327  
Lactate               0.7835  0.6865  1.14  0.2537  
Lactate'             -1.0471  0.8999 -1.16  0.2446  
Glucose               0.1115  0.2463  0.45  0.6508  
Glucose'              0.0192  0.2460  0.08  0.9378  

Iteration_2

fit_nsti_lrm2<-lrm(formula = Censor_NSTI ~  Sex   + Pseudoaneurysm + rcs(Dur_Hosp,3) + Admissions_Infection + rcs(Hb,3) + WCC + CRP +  Albumin + rcs(Urea,3) + rcs(Creatinine,3) +rcs(Lactate,3) ,data = vascular, x = TRUE, y = TRUE)
fit_nsti_lrm2
Frequencies of Missing Values Due to Each Variable
         Censor_NSTI                  Sex       Pseudoaneurysm 
                   0                    0                    0 
            Dur_Hosp Admissions_Infection                   Hb 
                   0                    0                    6 
                 WCC                  CRP              Albumin 
                  47                   46                   51 
                Urea           Creatinine              Lactate 
                  47                  124                  127 

Logistic Regression Model

lrm(formula = Censor_NSTI ~ Sex + Pseudoaneurysm + rcs(Dur_Hosp, 
    3) + Admissions_Infection + rcs(Hb, 3) + WCC + CRP + Albumin + 
    rcs(Urea, 3) + rcs(Creatinine, 3) + rcs(Lactate, 3), data = vascular, 
    x = TRUE, y = TRUE)

                        Model Likelihood       Discrimination    Rank Discrim.    
                              Ratio Test              Indexes          Indexes    
Obs            250    LR chi2      72.91       R2       0.350    C       0.780    
 0             165    d.f.            16      R2(16,250)0.204    Dxy     0.559    
 1              85    Pr(> chi2) <0.0001    R2(16,168.3)0.287    gamma   0.559    
max |deriv| 0.0003                             Brier    0.160    tau-a   0.252    

                     Coef    S.E.   Wald Z Pr(>|Z|)
Intercept            -0.1891 2.2989 -0.08  0.9344  
Sex                   0.5651 0.3591  1.57  0.1155  
Pseudoaneurysm        0.9110 0.4140  2.20  0.0278  
Dur_Hosp             -0.0697 0.0353 -1.97  0.0484  
Dur_Hosp'             0.1503 0.0538  2.79  0.0052  
Admissions_Infection -0.1160 0.1207 -0.96  0.3366  
Hb                   -0.0279 0.0161 -1.74  0.0821  
Hb'                   0.0328 0.0195  1.68  0.0932  
WCC                  -0.0175 0.0218 -0.80  0.4232  
CRP                   0.0065 0.0019  3.37  0.0007  
Albumin              -0.0544 0.0369 -1.47  0.1407  
Urea                 -0.2562 0.1964 -1.30  0.1922  
Urea'                 0.3932 0.2756  1.43  0.1536  
Creatinine            0.0439 0.0252  1.74  0.0816  
Creatinine'          -0.0531 0.0270 -1.97  0.0490  
Lactate               1.0189 0.5112  1.99  0.0462  
Lactate'             -1.3241 0.6734 -1.97  0.0493  
p<-Predict(fit_nsti_lrm2, fun=function(x) 1/(1+exp(-x)), conf.int=0.9)
ggplot(p)

p<-Predict(fit_nsti_lrm2, conf.int=0.9)
ggplot(p)

p<-Predict(fit_nsti_lrm2, Admissions_Infection, fun=function(x) 1/(1+exp(-x)), conf.int=0.9)
b<-ggplot(p)
b+labs(x="Admissions with Infection (n)",y="Odds")+theme_classic()+theme(text = element_text(size = 18))

p<-Predict(fit_nsti_lrm2, Albumin, fun=function(x) 1/(1+exp(-x)), conf.int=0.9)
b<-ggplot(p)
b+labs(x="Albumin (g/L)",y="Odds")+theme_classic()+theme(text = element_text(size = 18))

p<-Predict(fit_nsti_lrm2, Creatinine, fun=function(x) 1/(1+exp(-x)), conf.int=0.9)
b<-ggplot(p)
b+labs(x="Creatinine ('µmol/L)",y="Odds")+theme_classic()+theme(text = element_text(size = 18))

p<-Predict(fit_nsti_lrm2, CRP, fun=function(x) 1/(1+exp(-x)), conf.int=0.9)
b<-ggplot(p)
b+labs(x="CRP (mg/L)",y="Odds")+theme_classic()+theme(text = element_text(size = 18))

p<-Predict(fit_nsti_lrm2, Dur_Hosp, fun=function(x) 1/(1+exp(-x)), conf.int=0.9)
b<-ggplot(p)
b+labs(x="Hospital stay (Days)",y="Odds")+theme_classic()+theme(text = element_text(size = 18))

p<-Predict(fit_nsti_lrm2, Hb, fun=function(x) 1/(1+exp(-x)), conf.int=0.9)
b<-ggplot(p)
b+labs(x="Haemoglobin (g/dL)",y="Odds")+theme_classic()+theme(text = element_text(size = 18))

p<-Predict(fit_nsti_lrm2, Lactate, fun=function(x) 1/(1+exp(-x)), conf.int=0.9)
b<-ggplot(p)
b+labs(x="Lactate (mmol/L)",y="Odds")+theme_classic()+theme(text = element_text(size = 18))

p<-Predict(fit_nsti_lrm2, Pseudoaneurysm, fun=function(x) 1/(1+exp(-x)), conf.int=0.9)
b<-ggplot(p)
b+labs(x="Pseudoaneurysm",y="Odds")+theme_classic()+theme(text = element_text(size = 18))

p<-Predict(fit_nsti_lrm2, Sex, fun=function(x) 1/(1+exp(-x)), conf.int=0.9)
b<-ggplot(p)
b+labs(x="Sex",y="Odds")+theme_classic()+theme(text = element_text(size = 18))

p<-Predict(fit_nsti_lrm2, Urea, fun=function(x) 1/(1+exp(-x)), conf.int=0.9)
b<-ggplot(p)
b+labs(x="Urea (mmol/L)",y="Odds")+theme_classic()+theme(text = element_text(size = 18))

p<-Predict(fit_nsti_lrm2, WCC, fun=function(x) 1/(1+exp(-x)), conf.int=0.9)
b<-ggplot(p)
b+labs(x="WCC (10x9/L)",y="Odds")+theme_classic()+theme(text = element_text(size = 18))

Mortality Survival model using Surv

dependent_os  <- "Surv(T_Death, Censor_Death)"
explanatory   <- c("Age","Sex.factor", "Admissions", "Admissions_Infection", "Censor_NSTI","NSTI_Total", "Pseudoaneurysm", "Dur_Hosp", "Dur_Crit", "Dur_Crit_Censor", "Censor_Amp","Albumin", "Hb","WCC","CRP","Glucose", "Na", "Urea", "Creatinine", "Lactate")

vascular %>% 
    coxphmulti(dependent_os, explanatory) %>% 
    cox.zph()
                        chisq df      p
Age                  1.76e-04  1 0.9894
Sex.factor           1.26e+00  1 0.2622
Admissions           3.31e+00  1 0.0690
Admissions_Infection 2.48e+00  1 0.1153
Censor_NSTI          4.93e+00  1 0.0264
NSTI_Total           3.07e+00  1 0.0799
Pseudoaneurysm       4.31e-02  1 0.8355
Dur_Hosp             4.73e-01  1 0.4918
Dur_Crit             2.76e-01  1 0.5995
Dur_Crit_Censor      6.83e-01  1 0.4085
Censor_Amp           3.71e+00  1 0.0540
Albumin              2.27e+00  1 0.1316
Hb                   1.68e-02  1 0.8968
WCC                  5.50e+00  1 0.0190
CRP                  1.88e+00  1 0.1698
Glucose              1.18e+00  1 0.2778
Na                   2.12e+00  1 0.1449
Urea                 6.97e+00  1 0.0083
Creatinine           6.33e+00  1 0.0119
Lactate              3.09e+00  1 0.0787
GLOBAL               3.37e+01 20 0.0283

Covariate - Sex

survival_object <-vascular %$% Surv(T_Death/365, Censor_Death)
all_survfit <- survfit(survival_object ~ 1, data = vascular)
all_survfit
Call: survfit(formula = survival_object ~ 1, data = vascular)

       n events median 0.95LCL 0.95UCL
[1,] 455    107   9.86    8.83      NA
fit_sex<- survfit(Surv(T_Death/365, Censor_Death) ~  Sex.factor, data=vascular, conf.int = TRUE)
class(fit_sex)
[1] "survfit"
fit_sex
Call: survfit(formula = Surv(T_Death/365, Censor_Death) ~ Sex.factor, 
    data = vascular, conf.int = TRUE)

                    n events median 0.95LCL 0.95UCL
Sex.factor=Male   284     68  10.84    8.56      NA
Sex.factor=Female 171     39   9.86    8.83      NA
ggsurvplot(fit_sex,data=vascular, conf.int=TRUE,legend.title = "Sex",legend.labs = c("Female",
"Male"), legend ="top", xlab = "Time (years)", title ="Mortality")

Covariate - No. of admissions

fit_adm_no<- survfit(Surv(T_Death/365, Censor_Death) ~  Admissions, data=vascular)
class(fit_adm_no)
[1] "survfit"
ggsurvplot(fit_adm_no,data=vascular,legend.title = "No. of admissions presenting with infection", legend.labs = c("1",
"2", "3", "4", "5", "6", "7", "8","9","10","11", "12", "13"),legend ="top", xlab = "Time (years)", title ="Mortality")

Mortality - Survival model using Surv Iteration_1

fit_death<- cph(Surv(T_Death, Censor_Death) ~  rcs(Age,3) + Sex  + Censor_NSTI + Pseudoaneurysm+ Admissions+  Admissions_Infection + rcs(Dur_Hosp,3) +  Dur_Crit_Censor +  Censor_Amp + rcs(Hb,3) + rcs(WCC,3) + rcs(CRP,3) +rcs(Na,3) + rcs(Albumin,3) + rcs(Urea,3) + rcs(Creatinine,3) +rcs(Lactate,3) + rcs(Glucose,3), x = TRUE, y = TRUE,surv=TRUE,data=vascular)

anova(fit_death)
                Wald Statistics          Response: Surv(T_Death, Censor_Death) 

 Factor               Chi-Square d.f. P     
 Age                   7.19       2   0.0275
  Nonlinear            0.04       1   0.8506
 Sex                   4.53       1   0.0332
 Censor_NSTI           1.53       1   0.2168
 Pseudoaneurysm        3.66       1   0.0556
 Admissions            0.01       1   0.9243
 Admissions_Infection  0.24       1   0.6274
 Dur_Hosp              0.13       2   0.9393
  Nonlinear            0.11       1   0.7366
 Dur_Crit_Censor       4.00       1   0.0454
 Censor_Amp            1.11       1   0.2916
 Hb                    4.27       2   0.1180
  Nonlinear            3.44       1   0.0636
 WCC                   0.41       2   0.8154
  Nonlinear            0.05       1   0.8192
 CRP                   2.99       2   0.2239
  Nonlinear            0.12       1   0.7305
 Na                    4.27       2   0.1185
  Nonlinear            3.50       1   0.0612
 Albumin               2.24       2   0.3263
  Nonlinear            1.31       1   0.2521
 Urea                  3.20       2   0.2023
  Nonlinear            0.65       1   0.4186
 Creatinine            3.64       2   0.1624
  Nonlinear            0.08       1   0.7832
 Lactate               3.09       2   0.2137
  Nonlinear            0.73       1   0.3929
 Glucose               1.36       2   0.5066
  Nonlinear            0.20       1   0.6548
 TOTAL NONLINEAR      10.97      11   0.4460
 TOTAL                47.09      29   0.0182
validate(fit_death, B =50,dxy=TRUE)
Warning in fitter(..., strata = strata, rownames = rownames, offset = offset, :
Ran out of iterations and did not converge

Warning in fitter(..., strata = strata, rownames = rownames, offset = offset, :
Ran out of iterations and did not converge

Divergence or singularity in 5 samples
      index.orig training    test optimism index.corrected  n
Dxy       0.5862   0.7008  0.4446   0.2563          0.3299 45
R2        0.2759   0.4439  0.1187   0.3252         -0.0493 45
Slope     1.0000   1.0000  0.2663   0.7337          0.2663 45
D         0.1349   0.2479  0.0527   0.1952         -0.0603 45
U        -0.0053  -0.0056  0.5760  -0.5815          0.5762 45
Q         0.1402   0.2534 -0.5233   0.7767         -0.6365 45
g         1.5577   3.4216  0.8382   2.5834         -1.0257 45

Iteration_2

fit_death<- cph(Surv(T_Death, Censor_Death) ~  Age + Sex  + Censor_NSTI + Pseudoaneurysm+ Admissions+  Admissions_Infection + Dur_Crit + Dur_Crit_Censor +  Censor_Amp + rcs(Hb,3) + WCC + CRP +Na +Albumin +Urea +Creatinine +Lactate +Glucose, x = TRUE, y = TRUE,surv=TRUE,data=vascular)

anova(fit_death)
                Wald Statistics          Response: Surv(T_Death, Censor_Death) 

 Factor               Chi-Square d.f. P     
 Age                   5.17       1   0.0230
 Sex                   5.33       1   0.0209
 Censor_NSTI           0.97       1   0.3240
 Pseudoaneurysm        1.94       1   0.1634
 Admissions            0.01       1   0.9410
 Admissions_Infection  0.46       1   0.4983
 Dur_Crit              0.07       1   0.7887
 Dur_Crit_Censor       3.61       1   0.0574
 Censor_Amp            3.26       1   0.0709
 Hb                    4.67       2   0.0968
  Nonlinear            4.11       1   0.0427
 WCC                   0.46       1   0.4956
 CRP                   2.15       1   0.1427
 Na                    0.52       1   0.4700
 Albumin               0.55       1   0.4602
 Urea                  2.18       1   0.1400
 Creatinine            4.85       1   0.0276
 Lactate               3.76       1   0.0524
 Glucose               2.33       1   0.1270
 TOTAL                40.83      19   0.0025
validate(fit_death, B =50,dxy=TRUE)

Divergence or singularity in 2 samples
      index.orig training    test optimism index.corrected  n
Dxy       0.5380   0.6454  0.4483   0.1971          0.3409 48
R2        0.2427   0.3774  0.1162   0.2612         -0.0185 48
Slope     1.0000   1.0000  0.3811   0.6189          0.3811 48
D         0.1162   0.1978  0.0515   0.1463         -0.0301 48
U        -0.0053  -0.0054  0.2156  -0.2210          0.2157 48
Q         0.1215   0.2032 -0.1641   0.3673         -0.2458 48
g         1.3434   2.3750  0.8533   1.5217         -0.1782 48

Iteration_3

fit_death_surv3<- cph(Surv(T_Death, Censor_Death) ~  Age + Dur_Crit_Censor  + Hb + WCC + rcs(CRP,3) + Albumin + rcs(Urea,3) + Creatinine*Lactate, x = TRUE, y = TRUE,surv=TRUE,data=vascular)
anova(fit_death_surv3)
                Wald Statistics          Response: Surv(T_Death, Censor_Death) 

 Factor                                              Chi-Square d.f. P     
 Age                                                  7.53       1   0.0061
 Dur_Crit_Censor                                      8.02       1   0.0046
 Hb                                                   4.45       1   0.0349
 WCC                                                  2.22       1   0.1359
 CRP                                                  2.96       2   0.2274
  Nonlinear                                           2.80       1   0.0941
 Albumin                                              1.00       1   0.3168
 Urea                                                11.75       2   0.0028
  Nonlinear                                          10.92       1   0.0010
 Creatinine  (Factor+Higher Order Factors)            5.78       2   0.0556
  All Interactions                                    1.62       1   0.2031
 Lactate  (Factor+Higher Order Factors)               2.70       2   0.2595
  All Interactions                                    1.62       1   0.2031
 Creatinine * Lactate  (Factor+Higher Order Factors)  1.62       1   0.2031
 TOTAL NONLINEAR                                     12.53       2   0.0019
 TOTAL NONLINEAR + INTERACTION                       13.03       3   0.0046
 TOTAL                                               35.06      12   0.0005
validate(fit_death_surv3, B =50,dxy=TRUE)
      index.orig training    test optimism index.corrected  n
Dxy       0.4208   0.4802  0.3776   0.1026          0.3182 50
R2        0.1451   0.1949  0.0810   0.1139          0.0312 50
Slope     1.0000   1.0000  0.5310   0.4690          0.5310 50
D         0.0640   0.0903  0.0340   0.0563          0.0077 50
U        -0.0039  -0.0040  0.2073  -0.2112          0.2073 50
Q         0.0679   0.0943 -0.1733   0.2675         -0.1996 50
g         0.9628   1.2279  0.6419   0.5860          0.3769 50
fit_death_surv3
Frequencies of Missing Values Due to Each Variable
Surv(T_Death, Censor_Death)                         Age 
                          0                           0 
            Dur_Crit_Censor                          Hb 
                          0                           6 
                        WCC                         CRP 
                         47                          46 
                    Albumin                        Urea 
                         51                          47 
                 Creatinine                     Lactate 
                        124                         127 

Cox Proportional Hazards Model

cph(formula = Surv(T_Death, Censor_Death) ~ Age + Dur_Crit_Censor + 
    Hb + WCC + rcs(CRP, 3) + Albumin + rcs(Urea, 3) + Creatinine * 
    Lactate, data = vascular, x = TRUE, y = TRUE, surv = TRUE)

                       Model Tests     Discrimination    
                                              Indexes    
Obs       250    LR chi2     33.77     R2       0.145    
Events     56    d.f.           12    R2(12,250)0.083    
Center 2.3614    Pr(> chi2) 0.0007     R2(12,56)0.322    
                 Score chi2  39.28     Dxy      0.421    
                 Pr(> chi2) 0.0001                       

                     Coef    S.E.   Wald Z Pr(>|Z|)
Age                   0.0609 0.0222  2.74  0.0061  
Dur_Crit_Censor       0.9638 0.3403  2.83  0.0046  
Hb                    0.0197 0.0093  2.11  0.0349  
WCC                  -0.0420 0.0281 -1.49  0.1359  
CRP                   0.0085 0.0050  1.71  0.0879  
CRP'                 -0.0082 0.0049 -1.67  0.0941  
Albumin              -0.0360 0.0360 -1.00  0.3168  
Urea                 -0.5445 0.1732 -3.14  0.0017  
Urea'                 0.7828 0.2369  3.30  0.0010  
Creatinine            0.0106 0.0055  1.92  0.0548  
Lactate               0.2179 0.1457  1.50  0.1348  
Creatinine * Lactate -0.0023 0.0018 -1.27  0.2031  
p<-Predict(fit_death_surv3, fun=function(x) 1/(1+exp(-x)), conf.int=0.9)
ggplot(p)

p<-Predict(fit_death_surv3, Age, fun=function(x) 1/(1+exp(-x)), conf.int=0.9)
b<-ggplot(p)
b+labs(x="Age (years)",y="Relative Hazard")+theme_classic()+theme(text = element_text(size = 18))

p<-Predict(fit_death_surv3, Albumin, fun=function(x) 1/(1+exp(-x)), conf.int=0.9)
b<-ggplot(p)
b+labs(x="Albumin (g/L)",y="Relative Hazard")+theme_classic()+theme(text = element_text(size = 18))

p<-Predict(fit_death_surv3, Creatinine, fun=function(x) 1/(1+exp(-x)), conf.int=0.9)
b<-ggplot(p)
b+labs(x="Creatinine (µmol/L)",y="Relative Hazard")+theme_classic()+theme(text = element_text(size = 18))

p<-Predict(fit_death_surv3, CRP, fun=function(x) 1/(1+exp(-x)), conf.int=0.9)
b<-ggplot(p)
b+labs(x="CRP (mg/L)",y="Relative Hazard")+theme_classic()+theme(text = element_text(size = 18))

p<-Predict(fit_death_surv3, Dur_Crit_Censor, fun=function(x) 1/(1+exp(-x)), conf.int=0.9)
b<-ggplot(p)
b+labs(x="Critical care stay (Days)",y="Relative Hazard")+theme_classic()+theme(text = element_text(size = 18))

p<-Predict(fit_death_surv3, Hb, fun=function(x) 1/(1+exp(-x)), conf.int=0.9)
b<-ggplot(p)
b+labs(x="Haemaglobin (g/dL)",y="Relative Hazard")+theme_classic()+theme(text = element_text(size = 18))

p<-Predict(fit_death_surv3, Lactate, fun=function(x) 1/(1+exp(-x)), conf.int=0.9)
b<-ggplot(p)
b+labs(x="Lactate (mmol/L)",y="Relative Hazard")+theme_classic()+theme(text = element_text(size = 18))

p<-Predict(fit_death_surv3, Urea, fun=function(x) 1/(1+exp(-x)), conf.int=0.9)
b<-ggplot(p)
b+labs(x="Urea (mmol/L)",y="Relative Hazard")+theme_classic()+theme(text = element_text(size = 18))

p<-Predict(fit_death_surv3, WCC, fun=function(x) 1/(1+exp(-x)), conf.int=0.9)
b<-ggplot(p)
b+labs(x="WCC (10x9/L)",y="Relative Hazard")+theme_classic()+theme(text = element_text(size = 18))

Mortality - GLM model

glm(formula = Censor_Death ~ Age + Sex  + Dur_Crit_Censor + Pseudoaneurysm  + Dur_Hosp +  Dur_Crit_Censor  + Hb + WCC + CRP + Albumin + Urea + Creatinine +Lactate, family = binomial(), data = vascular, x = TRUE, y = TRUE)

Call:  glm(formula = Censor_Death ~ Age + Sex + Dur_Crit_Censor + Pseudoaneurysm + 
    Dur_Hosp + Dur_Crit_Censor + Hb + WCC + CRP + Albumin + Urea + 
    Creatinine + Lactate, family = binomial(), data = vascular, 
    x = TRUE, y = TRUE)

Coefficients:
    (Intercept)              Age              Sex  Dur_Crit_Censor  
      -2.865734         0.032457         0.945874         1.109779  
 Pseudoaneurysm         Dur_Hosp               Hb              WCC  
       0.003058         0.007323         0.009353        -0.014403  
            CRP          Albumin             Urea       Creatinine  
      -0.000359        -0.054742        -0.033030         0.006512  
        Lactate  
       0.028035  

Degrees of Freedom: 249 Total (i.e. Null);  237 Residual
  (205 observations deleted due to missingness)
Null Deviance:      266 
Residual Deviance: 235.4    AIC: 261.4

Mortality - Logistic regression model Iteration_1

glm(formula = Censor_Death ~  Age  + Admissions +   Dur_Crit_Censor  +Hb + WCC+ CRP +Na + Albumin + Urea+ Creatinine +Lactate, family = binomial(),  data = vascular, x = TRUE, y = TRUE)

Call:  glm(formula = Censor_Death ~ Age + Admissions + Dur_Crit_Censor + 
    Hb + WCC + CRP + Na + Albumin + Urea + Creatinine + Lactate, 
    family = binomial(), data = vascular, x = TRUE, y = TRUE)

Coefficients:
    (Intercept)              Age       Admissions  Dur_Crit_Censor  
     -3.829e+00        2.966e-02        1.309e-01        1.001e+00  
             Hb              WCC              CRP               Na  
      9.247e-03       -1.686e-02       -8.755e-05        8.263e-03  
        Albumin             Urea       Creatinine          Lactate  
     -5.071e-02       -2.995e-02        6.532e-03        2.522e-02  

Degrees of Freedom: 246 Total (i.e. Null);  235 Residual
  (208 observations deleted due to missingness)
Null Deviance:      264.4 
Residual Deviance: 238.7    AIC: 262.7

Logistic regression model Iteration_1

lrm(formula = Censor_Death ~ rcs(Age,3) + Sex  + Censor_NSTI + Pseudoaneurysm+  Admissions_Infection + rcs(Dur_Hosp,3) +  Dur_Crit_Censor +  Censor_Amp + rcs(Hb,3) + rcs(WCC,3) + rcs(CRP,3) +rcs(Na,3) + rcs(Albumin,3) + rcs(Urea,3) + rcs(Creatinine,3) +rcs(Lactate,3) + rcs(Glucose,3),data = vascular, x = TRUE, y = TRUE)
Frequencies of Missing Values Due to Each Variable
        Censor_Death                  Age                  Sex 
                   0                    0                    0 
         Censor_NSTI       Pseudoaneurysm Admissions_Infection 
                   0                    0                    0 
            Dur_Hosp      Dur_Crit_Censor           Censor_Amp 
                   0                    0                    0 
                  Hb                  WCC                  CRP 
                   6                   47                   46 
                  Na              Albumin                 Urea 
                  57                   51                   47 
          Creatinine              Lactate              Glucose 
                 124                  127                  229 

Logistic Regression Model

lrm(formula = Censor_Death ~ rcs(Age, 3) + Sex + Censor_NSTI + 
    Pseudoaneurysm + Admissions_Infection + rcs(Dur_Hosp, 3) + 
    Dur_Crit_Censor + Censor_Amp + rcs(Hb, 3) + rcs(WCC, 3) + 
    rcs(CRP, 3) + rcs(Na, 3) + rcs(Albumin, 3) + rcs(Urea, 3) + 
    rcs(Creatinine, 3) + rcs(Lactate, 3) + rcs(Glucose, 3), data = vascular, 
    x = TRUE, y = TRUE)

                      Model Likelihood      Discrimination    Rank Discrim.    
                            Ratio Test             Indexes          Indexes    
Obs           190    LR chi2     51.98      R2       0.364    C       0.827    
 0            147    d.f.           28     R2(28,190)0.119    Dxy     0.654    
 1             43    Pr(> chi2) 0.0039    R2(28,99.8)0.214    gamma   0.654    
max |deriv| 0.002                           Brier    0.127    tau-a   0.230    

                     Coef    S.E.    Wald Z Pr(>|Z|)
Intercept            23.6062 19.2137  1.23  0.2192  
Age                   0.0947  0.0842  1.12  0.2608  
Age'                 -0.0291  0.1087 -0.27  0.7887  
Sex                   1.2751  0.5051  2.52  0.0116  
Censor_NSTI           0.1097  0.5523  0.20  0.8426  
Pseudoaneurysm       -0.0351  0.6226 -0.06  0.9551  
Admissions_Infection  0.3491  0.1931  1.81  0.0707  
Dur_Hosp              0.0093  0.0448  0.21  0.8353  
Dur_Hosp'            -0.0053  0.0553 -0.10  0.9237  
Dur_Crit_Censor       0.9607  0.6112  1.57  0.1160  
Censor_Amp            3.1387  1.0093  3.11  0.0019  
Hb                   -0.0133  0.0213 -0.62  0.5346  
Hb'                   0.0393  0.0266  1.48  0.1391  
WCC                  -0.0164  0.0924 -0.18  0.8589  
WCC'                 -0.0588  0.1348 -0.44  0.6628  
CRP                   0.0051  0.0072  0.71  0.4789  
CRP'                 -0.0112  0.0077 -1.45  0.1466  
Na                   -0.2098  0.1320 -1.59  0.1120  
Na'                   0.1772  0.1342  1.32  0.1869  
Albumin               0.0394  0.1068  0.37  0.7123  
Albumin'             -0.0835  0.1340 -0.62  0.5331  
Urea                 -0.4147  0.3014 -1.38  0.1689  
Urea'                 0.3300  0.4409  0.75  0.4542  
Creatinine            0.0034  0.0353  0.10  0.9230  
Creatinine'           0.0136  0.0376  0.36  0.7166  
Lactate              -0.5456  0.7031 -0.78  0.4378  
Lactate'              0.9045  0.9194  0.98  0.3252  
Glucose               0.0520  0.2616  0.20  0.8423  
Glucose'             -0.0044  0.2219 -0.02  0.9841  

Logistic regression model Iteration_2

fit_Death_lrm2<-lrm(formula = Censor_Death ~ Age  + Sex + Admissions_Infection  +  Dur_Crit_Censor +Hb + WCC + rcs(CRP,3) +Na + Albumin + rcs(Urea,3) + Creatinine +Lactate, data = vascular, x = TRUE, y = TRUE)
fit_Death_lrm2
Frequencies of Missing Values Due to Each Variable
        Censor_Death                  Age                  Sex 
                   0                    0                    0 
Admissions_Infection      Dur_Crit_Censor                   Hb 
                   0                    0                    6 
                 WCC                  CRP                   Na 
                  47                   46                   57 
             Albumin                 Urea           Creatinine 
                  51                   47                  124 
             Lactate 
                 127 

Logistic Regression Model

lrm(formula = Censor_Death ~ Age + Sex + Admissions_Infection + 
    Dur_Crit_Censor + Hb + WCC + rcs(CRP, 3) + Na + Albumin + 
    rcs(Urea, 3) + Creatinine + Lactate, data = vascular, x = TRUE, 
    y = TRUE)

                       Model Likelihood       Discrimination    Rank Discrim.    
                             Ratio Test              Indexes          Indexes    
Obs            247    LR chi2     38.33       R2       0.219    C       0.753    
 0             191    d.f.           14      R2(14,247)0.094    Dxy     0.505    
 1              56    Pr(> chi2) 0.0005    R2(14,129.9)0.171    gamma   0.505    
max |deriv| 0.0002                            Brier    0.148    tau-a   0.178    

                     Coef    S.E.   Wald Z Pr(>|Z|)
Intercept            -1.5340 7.8444 -0.20  0.8450  
Age                   0.0523 0.0246  2.12  0.0337  
Sex                   0.8304 0.3653  2.27  0.0230  
Admissions_Infection  0.2638 0.1175  2.25  0.0247  
Dur_Crit_Censor       1.1417 0.4343  2.63  0.0086  
Hb                    0.0159 0.0109  1.46  0.1453  
WCC                  -0.0238 0.0233 -1.02  0.3070  
CRP                   0.0054 0.0054  1.01  0.3109  
CRP'                 -0.0056 0.0053 -1.06  0.2886  
Na                   -0.0137 0.0542 -0.25  0.8008  
Albumin              -0.0584 0.0400 -1.46  0.1439  
Urea                 -0.4586 0.2029 -2.26  0.0238  
Urea'                 0.6117 0.2803  2.18  0.0291  
Creatinine            0.0082 0.0048  1.71  0.0868  
Lactate               0.0130 0.0442  0.30  0.7678  
p<-Predict(fit_Death_lrm2, fun=function(x) 1/(1+exp(-x)), conf.int=0.9)
plot(p)

p<-Predict(fit_Death_lrm2, Sex, fun=function(x) 1/(1+exp(-x)), conf.int=0.9)
b<-ggplot(p)
b+labs(x="Sex",y="Odds")+theme_classic()+theme(text = element_text(size = 18))

p<-Predict(fit_Death_lrm2, Admissions_Infection, fun=function(x) 1/(1+exp(-x)), conf.int=0.9)
b<-ggplot(p)
b+labs(x="Admissions with infection (n)",y="Odds")+theme_classic()+theme(text = element_text(size = 18))

p<-Predict(fit_Death_lrm2, Dur_Crit_Censor, fun=function(x) 1/(1+exp(-x)), conf.int=0.9)
b<-ggplot(p)
b+labs(x="Critical care",y="Odds")+theme_classic()+theme(text = element_text(size = 18))

p<-Predict(fit_Death_lrm2, Hb, fun=function(x) 1/(1+exp(-x)), conf.int=0.9)
b<-ggplot(p)
b+labs(x="Hb (g/dL)",y="Odds")+theme_classic()+theme(text = element_text(size = 18))

p<-Predict(fit_Death_lrm2, WCC, fun=function(x) 1/(1+exp(-x)), conf.int=0.9)
b<-ggplot(p)
b+labs(x="WCC (10x9/L)",y="Odds")+theme_classic()+theme(text = element_text(size = 18))

p<-Predict(fit_Death_lrm2, CRP, fun=function(x) 1/(1+exp(-x)), conf.int=0.9)
b<-ggplot(p)
b+labs(x="CRP(Mg/L)",y="Odds")+theme_classic()+theme(text = element_text(size = 18))

p<-Predict(fit_Death_lrm2, Na, fun=function(x) 1/(1+exp(-x)), conf.int=0.9)
b<-ggplot(p)
b+labs(x="Sodium (mmol/L)",y="Odds")+theme_classic()+theme(text = element_text(size = 18))

p<-Predict(fit_Death_lrm2, Albumin, fun=function(x) 1/(1+exp(-x)), conf.int=0.9)
b<-ggplot(p)
b+labs(x="Albumin (g/L)",y="Odds")+theme_classic()+theme(text = element_text(size = 18))

p<-Predict(fit_Death_lrm2, Urea, fun=function(x) 1/(1+exp(-x)), conf.int=0.9)
b<-ggplot(p)
b+labs(x="Urea (mmol/L)",y="Odds")+theme_classic()+theme(text = element_text(size = 18))

p<-Predict(fit_Death_lrm2, Creatinine, fun=function(x) 1/(1+exp(-x)), conf.int=0.9)
b<-ggplot(p)
b+labs(x="Creatinine (µmol /L)",y="Odds")+theme_classic()+theme(text = element_text(size = 18))

p<-Predict(fit_Death_lrm2, Lactate, fun=function(x) 1/(1+exp(-x)), conf.int=0.9)
b<-ggplot(p)
b+labs(x="Lactate (mmol/L)",y="Odds")+theme_classic()+theme(text = element_text(size = 18))

```