## Type 'citation("pROC")' for a citation.
## 
## Attaching package: 'pROC'
## The following objects are masked from 'package:stats':
## 
##     cov, smooth, var
x=c("a: Still Smokes","b: 1 month ago","c: 1-6 \nmonths ago","d: more than\n 6 months ago","e: Never smoked")

p1=sum(ponv$when.stopped.smoking=="a.smokes",na.rm=TRUE)/(sum(ponv$when.stopped.smoking=="a.smokes",na.rm=TRUE)+sum(nponv$when.stopped.smoking=="a.smokes",na.rm=TRUE))
p2=sum(ponv$when.stopped.smoking=="b.1.month.ago",na.rm=TRUE)/(sum(ponv$when.stopped.smoking=="b.1.month.ago",na.rm=TRUE)+sum(nponv$when.stopped.smoking=="b.1.month.ago",na.rm=TRUE))
p3=sum(ponv$when.stopped.smoking=="c.1-6.months.ago",na.rm=TRUE)/(sum(ponv$when.stopped.smoking=="c.1-6.months.ago",na.rm=TRUE)+sum(nponv$when.stopped.smoking=="c.1-6.months.ago",na.rm=TRUE))
p4=sum(ponv$when.stopped.smoking=="d.>6months.ago",na.rm=TRUE)/(sum(ponv$when.stopped.smoking=="d.>6months.ago",na.rm=TRUE)+sum(nponv$when.stopped.smoking=="d.>6months.ago",na.rm=TRUE))
p5=sum(ponv$when.stopped.smoking=="e.never.smoked",na.rm=TRUE)/(sum(ponv$when.stopped.smoking=="e.never.smoked",na.rm=TRUE)+sum(nponv$when.stopped.smoking=="e.never.smoked",na.rm=TRUE))

y=c(p1,p2,p3,p4,p5)

dados=data.frame(Stopped.Smoking=x,probability=y)
ggplot(dados,aes(Stopped.Smoking,probability)) + geom_bar(stat="identity",aes(fill=Stopped.Smoking))+theme_bw()+scale_fill_grey(start = 0, end = .9)+guides(fill=FALSE)+labs(x = "Stopped smoking", y = "Probability of PONV")

Demographic data

#number of tests
nt=0
p_values=1
tests=""

# SEX
table(leiac$sex,leiac$ponv)
##         
##          FALSE TRUE
##   Female   707  404
##   Male     559  159
chisq.test(leiac$sex,leiac$ponv)
## 
##  Pearson's Chi-squared test with Yates' continuity correction
## 
## data:  leiac$sex and leiac$ponv
## X-squared = 40.72, df = 1, p-value = 1.757e-10
nt=nt+1
p_values[nt]=unname(chisq.test(leiac$sex,leiac$ponv)[3])
tests[nt]="SEX"

# APFEL
table(leiac$Apfel,leiac$ponv)
##    
##     FALSE TRUE
##   0    52    8
##   1   219   57
##   2   534  168
##   3   379  217
##   4    82  113
wilcox.test(leiac$Apfel~leiac$ponv)
## 
##  Wilcoxon rank sum test with continuity correction
## 
## data:  leiac$Apfel by leiac$ponv
## W = 258730, p-value < 2.2e-16
## alternative hypothesis: true location shift is not equal to 0
nt=nt+1
p_values[nt]=unname(wilcox.test(leiac$Apfel~leiac$ponv)[3])
tests[nt]="APFEL"

# AGE
comparenp(leiac$age,leiac$ponv,"Age in years")
## [1] "Mean Age in years in no PONV group: "
## [1] 58.56793
## [1] "Standard deviation in no PONV group"
## [1] 13.31018
## [1] "Mean Age in years in PONV group: "
## [1] 55.56128
## [1] "Standard deviation in PONV group"
## [1] 14.86706
## [1] "hypothesis test p-value"
## [[1]]
## [1] 0.0001595741
## 
## [1] "-------------------"

## [1] "-------------------"
t=wilcox.test(leiac$age ~leiac$ponv)
t
## 
##  Wilcoxon rank sum test with continuity correction
## 
## data:  leiac$age by leiac$ponv
## W = 395730, p-value = 0.0001596
## alternative hypothesis: true location shift is not equal to 0
nt=nt+1
p_values[nt]=unname(t[3])
tests[nt]="AGE"

# PREVIOUS PONV
table(leiac$previous.ponv,leiac$ponv)
##        
##         FALSE TRUE
##   FALSE  1053  367
##   TRUE    213  196
chisq.test(leiac$previous.ponv,leiac$ponv)
## 
##  Pearson's Chi-squared test with Yates' continuity correction
## 
## data:  leiac$previous.ponv and leiac$ponv
## X-squared = 71.603, df = 1, p-value < 2.2e-16
nt=nt+1
p_values[nt]=unname(chisq.test(leiac$previous.ponv,leiac$ponv)[3])
tests[nt]="PREVIOUS PONV"

# PO OPIOIDS
table(leiac$postoperative.opioids,leiac$ponv)
##        
##         FALSE TRUE
##   FALSE   367  135
##   TRUE    899  428
chisq.test(leiac$postoperative.opioids,leiac$ponv)
## 
##  Pearson's Chi-squared test with Yates' continuity correction
## 
## data:  leiac$postoperative.opioids and leiac$ponv
## X-squared = 4.6641, df = 1, p-value = 0.0308
nt=nt+1
p_values[nt]=unname(chisq.test(leiac$postoperative.opioids,leiac$ponv)[3])
tests[nt]="PO OPIOIDS"


#NON-SMOKER
table(leiac$non.smoker,leiac$ponv)
##        
##         FALSE TRUE
##   FALSE   344  104
##   TRUE    922  459
chisq.test(leiac$non.smoker,leiac$ponv)
## 
##  Pearson's Chi-squared test with Yates' continuity correction
## 
## data:  leiac$non.smoker and leiac$ponv
## X-squared = 15.481, df = 1, p-value = 8.335e-05
nt=nt+1
p_values[nt]=unname(chisq.test(leiac$non.smoker,leiac$ponv)[3])
tests[nt]="NON SMOKER"

# SURGERY
table(leiac$surgical.procedure,leiac$ponv)
##                               
##                                FALSE TRUE
##   Amputação de Membro              5    2
##   Anexectomia/Ooforectomia        24   17
##   Artoplastia Quadril             14    5
##   Artrodese Espinhal              60   16
##   Cirurgia biliodigestiva          5    1
##   Cirurgia de Cabeça e Pescoço    26    5
##   Cirurgia Gastrointestinal      308  130
##   Cirurgia Plástica               33   18
##   Cirurgias Ortopédicas           31    5
##   Cirurgia Torácica               85   37
##   Cistectomia                     39   24
##   Citorredução                    33   18
##   Esofagectomia                   14    1
##   Hepatectomia                    39   14
##   Histerectomia                    1    1
##   Histerectomia                   70   32
##   Histerectomia VLP               17   12
##   Laparotomia Exploradora         71   25
##   Linfadenectomia Extenso         18   10
##   Mastectomia                    172   84
##   Nefrectomia                     75   37
##   Outros                          47   29
##   Pancreatectomia                  9   15
##   Prostatectomia                  41   13
##   Ressecção TU partes moles       10    6
##   Setorectomia Mamária            19    6
t=chisq.test(leiac$surgical.procedure,leiac$ponv)
## Warning in chisq.test(leiac$surgical.procedure, leiac$ponv): Chi-squared
## approximation may be incorrect
t
## 
##  Pearson's Chi-squared test
## 
## data:  leiac$surgical.procedure and leiac$ponv
## X-squared = 40.937, df = 25, p-value = 0.02331
nt=nt+1
p_values[nt]=unname(t[3])
tests[nt]="SURGERY"

# CHRONIC OPIOID USER
table(leiac$chronic.opioid.user,leiac$ponv)
##        
##         FALSE TRUE
##   FALSE  1077  485
##   TRUE    164   70
t=chisq.test(leiac$chronic.opioid.user,leiac$ponv)
t
## 
##  Pearson's Chi-squared test with Yates' continuity correction
## 
## data:  leiac$chronic.opioid.user and leiac$ponv
## X-squared = 0.075448, df = 1, p-value = 0.7836
nt=nt+1
p_values[nt]=unname(t[3])
tests[nt]="CHRONIC OPIOID USER"


# PREVIOUS CHEMOTHERAPY
table(leiac$previous.chemotherapy,leiac$ponv)
##        
##         FALSE TRUE
##   FALSE   825  347
##   TRUE    441  216
t=chisq.test(leiac$previous.chemotherapy,leiac$ponv)
t;nt=nt+1
## 
##  Pearson's Chi-squared test with Yates' continuity correction
## 
## data:  leiac$previous.chemotherapy and leiac$ponv
## X-squared = 1.9611, df = 1, p-value = 0.1614
p_values[nt]=unname(t[3])
tests[nt]="PREVIOUS CHEMOTHERAPY"

# HOW MANY MONTHS AGO RECEIVED CHEMOTHERAPY
comparenp(leiac$how.many.months.ago.chemotherapy,leiac$ponv,"how many months ago received chemotherapy")
## [1] "Mean how many months ago received chemotherapy in no PONV group: "
## [1] 13.49276
## [1] "Standard deviation in no PONV group"
## [1] 37.17242
## [1] "Mean how many months ago received chemotherapy in PONV group: "
## [1] 11.54681
## [1] "Standard deviation in PONV group"
## [1] 22.68942
## [1] "hypothesis test p-value"
## [[1]]
## [1] 0.1242484
## 
## [1] "-------------------"

## [1] "-------------------"
t;nt=nt+1
## 
##  Pearson's Chi-squared test with Yates' continuity correction
## 
## data:  leiac$previous.chemotherapy and leiac$ponv
## X-squared = 1.9611, df = 1, p-value = 0.1614
p_values[nt]=unname(t[3])
tests[nt]="HOW MANY MONTHS AGO RECEIVED CHEMOTHERAPY"

# CHEMOTHERAPY EMETOGENICITY
table(leiac$chemotherapy.emetogenicity,leiac$ponv)
##                     
##                      FALSE TRUE
##   a.minimal(<10%)       22   12
##   b.low(10-30%)        167   82
##   c.moderate(30-90%)   154   86
##   d.high(>90%)          38   21
t=wilcox.test(rank(leiac$chemotherapy.emetogenicity)~leiac$ponv)
t;nt=nt+1
## 
##  Wilcoxon rank sum test with continuity correction
## 
## data:  rank(leiac$chemotherapy.emetogenicity) by leiac$ponv
## W = 375070, p-value = 0.07231
## alternative hypothesis: true location shift is not equal to 0
p_values[nt]=unname(t[3])
tests[nt]="CHEMOTHERAPY EMETOGENICITY"

# CHEMOTHERAPY INDUCED NAUSEA
table(leiac$post.chemotherapy.nausea,leiac$ponv)
##                           
##                            FALSE TRUE
##   FALSE                      249   73
##   No.Previous.Chemotherapy   804  336
##   TRUE                       213  154
t=chisq.test(leiac$post.chemotherapy.nausea,leiac$ponv)
t;nt=nt+1
## 
##  Pearson's Chi-squared test
## 
## data:  leiac$post.chemotherapy.nausea and leiac$ponv
## X-squared = 32.388, df = 2, p-value = 9.271e-08
p_values[nt]=unname(t[3])
tests[nt]="CHEMOTHERAPY INDUCED NAUSEA"

# CHEMOTHERAPY INDUCED VOMITING
table(leiac$post.chemotherapy.vomiting,leiac$ponv)
##        
##         FALSE TRUE
##   0         3    1
##   3         1    0
##   FALSE   300  127
##   TRUE    169  101
t=chisq.test(leiac$post.chemotherapy.vomiting,leiac$ponv)
## Warning in chisq.test(leiac$post.chemotherapy.vomiting, leiac$ponv): Chi-
## squared approximation may be incorrect
t;nt=nt+1
## 
##  Pearson's Chi-squared test
## 
## data:  leiac$post.chemotherapy.vomiting and leiac$ponv
## X-squared = 5.0139, df = 3, p-value = 0.1708
p_values[nt]=unname(t[3])
tests[nt]="CHEMOTHERAPY INDUCED VOMITING"

# WHEN STOPED SMOKING
table(leiac$when.stopped.smoking,leiac$ponv)
##                   
##                    FALSE TRUE
##   a.smokes            73   12
##   b.1.month.ago       27    6
##   c.1-6.months.ago    76   25
##   d.>6months.ago     412  172
##   e.never.smoked     678  348
t=wilcox.test(rank(leiac$when.stopped.smoking)~leiac$ponv)
t;nt=nt+1
## 
##  Wilcoxon rank sum test with continuity correction
## 
## data:  rank(leiac$when.stopped.smoking) by leiac$ponv
## W = 320050, p-value = 8.904e-05
## alternative hypothesis: true location shift is not equal to 0
p_values[nt]=unname(t[3])
tests[nt]="WHEN STOPED SMOKING"


# CIGAR PACKETS x YEARS
comparenp(leiac$packets.years,leiac$ponv,"Cigar Packets.Years")
## [1] "Mean Cigar Packets.Years in no PONV group: "
## [1] 8.19331
## [1] "Standard deviation in no PONV group"
## [1] 16.75298
## [1] "Mean Cigar Packets.Years in PONV group: "
## [1] 5.788298
## [1] "Standard deviation in PONV group"
## [1] 13.62073
## [1] "hypothesis test p-value"
## [[1]]
## [1] 0.005472456
## 
## [1] "-------------------"

## [1] "-------------------"
t=wilcox.test(leiac$packets.years ~leiac$ponv)
t;nt=nt+1
## 
##  Wilcoxon rank sum test with continuity correction
## 
## data:  leiac$packets.years by leiac$ponv
## W = 310610, p-value = 0.005472
## alternative hypothesis: true location shift is not equal to 0
p_values[nt]=unname(t[3])
tests[nt]="CIGAR PACKETS x YEARS"

# SURGERY CLASSIFICATION 2
table(leiac$surgery.classification.2,leiac$ponv)
##                               
##                                FALSE TRUE
##   Amputação de Membro              5    2
##   Anexectomia/Ooforectomia        24   17
##   Artoplastia Quadril             14    5
##   Artrodese Espinhal              60   16
##   Cirurgia biliodigestiva          5    1
##   Cirurgia de Cabeça e Pescoço    26    5
##   Cirurgia Gastrointestinal      308  130
##   Cirurgia Plástica               33   18
##   Cirurgias Ortopédicas           31    5
##   Cirurgia Torácica               85   37
##   Cistectomia                     39   24
##   Citorredução                    33   18
##   Esofagectomia                   14    1
##   Hepatectomia                    39   14
##   Histerectomia                    1    1
##   Histerectomia                   70   32
##   Histerectomia VLP               17   12
##   Laparotomia Exploradora         71   25
##   Linfadenectomia Extenso         18   10
##   Mastectomia                    172   84
##   Nefrectomia                     75   37
##   Outros                          47   29
##   Pancreatectomia                  9   15
##   Prostatectomia                  41   13
##   Ressecção TU partes moles       10    6
##   Setorectomia Mamária            19    6
t=chisq.test(leiac$surgery.classification.2,leiac$ponv)
## Warning in chisq.test(leiac$surgery.classification.2, leiac$ponv): Chi-
## squared approximation may be incorrect
t;nt=nt+1
## 
##  Pearson's Chi-squared test
## 
## data:  leiac$surgery.classification.2 and leiac$ponv
## X-squared = 40.937, df = 25, p-value = 0.02331
p_values[nt]=unname(t[3])
tests[nt]="SURGERY CLASSIFICATION 2"

Anestesia

table(leiac$anesthesia.technique,leiac$ponv)
##    
##     FALSE TRUE
##   1   405  153
##   2    11    3
##   3     9    2
##   4   730  365
##   5   107   40
##   6     4    0
t=chisq.test(leiac$anesthesia.technique,leiac$ponv)
## Warning in chisq.test(leiac$anesthesia.technique, leiac$ponv): Chi-squared
## approximation may be incorrect
t;nt=nt+1
## 
##  Pearson's Chi-squared test
## 
## data:  leiac$anesthesia.technique and leiac$ponv
## X-squared = 10.36, df = 5, p-value = 0.06566
p_values[nt]=unname(t[3])
tests[nt]="Anesthesia technique"

table(leiac$neuraxial.opioid,leiac$ponv)
##        
##         FALSE TRUE
##   FALSE   522  200
##   TRUE    744  363
t=chisq.test(leiac$neuraxial.opioid,leiac$ponv)
t;nt=nt+1
## 
##  Pearson's Chi-squared test with Yates' continuity correction
## 
## data:  leiac$neuraxial.opioid and leiac$ponv
## X-squared = 5.0784, df = 1, p-value = 0.02423
p_values[nt]=unname(t[3])
tests[nt]="NEURAXIAL OPIOIDS"

table(leiac$intraoperative.opioid,leiac$ponv)
##        
##         FALSE TRUE
##   FALSE    95   32
##   TRUE   1170  531
t=chisq.test(leiac$intraoperative.opioid,leiac$ponv)
t;nt=nt+1
## 
##  Pearson's Chi-squared test with Yates' continuity correction
## 
## data:  leiac$intraoperative.opioid and leiac$ponv
## X-squared = 1.737, df = 1, p-value = 0.1875
p_values[nt]=unname(t[3])
tests[nt]="INTRAOPERATIVE OPIOD"

table(leiac$remifentanil,leiac$ponv)
##        
##         FALSE TRUE
##   FALSE  1028  468
##   TRUE    238   95
t=chisq.test(leiac$remifentanil,leiac$ponv)
t;nt=nt+1
## 
##  Pearson's Chi-squared test with Yates' continuity correction
## 
## data:  leiac$remifentanil and leiac$ponv
## X-squared = 0.8452, df = 1, p-value = 0.3579
p_values[nt]=unname(t[3])
tests[nt]="REMIFENTANIL"

table(leiac$continuous.sufentanil,leiac$ponv)
##        
##         FALSE TRUE
##   FALSE  1257  554
##   TRUE      9    9
t=chisq.test(leiac$continuous.sufentanil,leiac$ponv)
t;nt=nt+1
## 
##  Pearson's Chi-squared test with Yates' continuity correction
## 
## data:  leiac$continuous.sufentanil and leiac$ponv
## X-squared = 2.3061, df = 1, p-value = 0.1289
p_values[nt]=unname(t[3])
tests[nt]="CONTINUOUS SUFENTANIL"

#table(leiac,leiac$ponv)

comparenp(leiac$fentanil.mcg,leiac$ponv,"Fentanil in mcg")
## [1] "Mean Fentanil in mcg in no PONV group: "
## [1] 179.0009
## [1] "Standard deviation in no PONV group"
## [1] 252.4321
## [1] "Mean Fentanil in mcg in PONV group: "
## [1] 219.8313
## [1] "Standard deviation in PONV group"
## [1] 294.2206
## [1] "hypothesis test p-value"
## [[1]]
## [1] 0.005806661
## 
## [1] "-------------------"

## [1] "-------------------"
t=wilcox.test(leiac$fentanil.mcg ~leiac$ponv)
t;nt=nt+1
## 
##  Wilcoxon rank sum test with continuity correction
## 
## data:  leiac$fentanil.mcg by leiac$ponv
## W = 329810, p-value = 0.005807
## alternative hypothesis: true location shift is not equal to 0
p_values[nt]=unname(t[3])
tests[nt]="FENTANIL DOSE"

comparenp(leiac$sufentanil.mcg,leiac$ponv,"Sufentanil in mcg")
## [1] "Mean Sufentanil in mcg in no PONV group: "
## [1] 23.88499
## [1] "Standard deviation in no PONV group"
## [1] 52.39576
## [1] "Mean Sufentanil in mcg in PONV group: "
## [1] 18.04121
## [1] "Standard deviation in PONV group"
## [1] 29.56713
## [1] "hypothesis test p-value"
## [[1]]
## [1] 0.1256867
## 
## [1] "-------------------"

## [1] "-------------------"
t=wilcox.test(leiac$sufentanil.mcg ~leiac$ponv)
t;nt=nt+1
## 
##  Wilcoxon rank sum test with continuity correction
## 
## data:  leiac$sufentanil.mcg by leiac$ponv
## W = 370560, p-value = 0.1257
## alternative hypothesis: true location shift is not equal to 0
p_values[nt]=unname(t[3])
tests[nt]="SUFENTANIL DOSE"

# PACU TRAMADOL
table(leiac$tramadol.pacu,leiac$ponv)
##        
##         FALSE TRUE
##   FALSE  1217  527
##   TRUE     49   36
t=fisher.test(leiac$tramadol.pacu, leiac$ponv)
t;nt=nt+1
## 
##  Fisher's Exact Test for Count Data
## 
## data:  leiac$tramadol.pacu and leiac$ponv
## p-value = 0.02191
## alternative hypothesis: true odds ratio is not equal to 1
## 95 percent confidence interval:
##  1.057938 2.697320
## sample estimates:
## odds ratio 
##   1.696101
p_values[nt]=unname(t[1])
tests[nt]="TRAMADOL PACU"

comparenp(leiac$tramadol.dose.pacu,leiac$ponv,"Tramadol (mg) in PACU")
## [1] "Mean Tramadol (mg) in PACU in no PONV group: "
## [1] 3.120063
## [1] "Standard deviation in no PONV group"
## [1] 16.27762
## [1] "Mean Tramadol (mg) in PACU in PONV group: "
## [1] 5.417407
## [1] "Standard deviation in PONV group"
## [1] 21.54929
## [1] "hypothesis test p-value"
## [[1]]
## [1] 0.01710378
## 
## [1] "-------------------"

## [1] "-------------------"
t=wilcox.test(leiac$tramadol.dose.pacu ~leiac$ponv)
t;nt=nt+1
## 
##  Wilcoxon rank sum test with continuity correction
## 
## data:  leiac$tramadol.dose.pacu by leiac$ponv
## W = 347310, p-value = 0.0171
## alternative hypothesis: true location shift is not equal to 0
p_values[nt]=unname(t[3])
tests[nt]="TRAMADOL PACU DOSE"

# Intraoperative Ketamine

table(leiac$intraoperative.ketamine,leiac$ponv)
##        
##         FALSE TRUE
##   FALSE  1164  532
##   TRUE    102   31
t=fisher.test(leiac$intraoperative.ketamine, leiac$ponv)
t;nt=nt+1
## 
##  Fisher's Exact Test for Count Data
## 
## data:  leiac$intraoperative.ketamine and leiac$ponv
## p-value = 0.06334
## alternative hypothesis: true odds ratio is not equal to 1
## 95 percent confidence interval:
##  0.424258 1.017695
## sample estimates:
## odds ratio 
##  0.6651092
p_values[nt]=unname(t[1])
tests[nt]="KETAMINE"

comparenp(leiac$ketamine.dose,leiac$ponv,"Ketamine dose")
## [1] "Mean Ketamine dose in no PONV group: "
## [1] 2.624901
## [1] "Standard deviation in no PONV group"
## [1] 11.79795
## [1] "Mean Ketamine dose in PONV group: "
## [1] 1.46714
## [1] "Standard deviation in PONV group"
## [1] 7.668179
## [1] "hypothesis test p-value"
## [[1]]
## [1] 0.05335759
## 
## [1] "-------------------"

## [1] "-------------------"
t=wilcox.test(leiac$ketamine.dose ~leiac$ponv)
t;nt=nt+1
## 
##  Wilcoxon rank sum test with continuity correction
## 
## data:  leiac$ketamine.dose by leiac$ponv
## W = 365130, p-value = 0.05336
## alternative hypothesis: true location shift is not equal to 0
p_values[nt]=unname(t[3])
tests[nt]="KETAMINE DOSE"

# Intraoperative morphine

table(leiac$intraoperative.morphine,leiac$ponv)
##        
##         FALSE TRUE
##   FALSE  1060  479
##   TRUE    205   83
t=fisher.test(leiac$intraoperative.morphine,leiac$ponv)
t;nt=nt+1
## 
##  Fisher's Exact Test for Count Data
## 
## data:  leiac$intraoperative.morphine and leiac$ponv
## p-value = 0.4867
## alternative hypothesis: true odds ratio is not equal to 1
## 95 percent confidence interval:
##  0.6704286 1.1898227
## sample estimates:
## odds ratio 
##  0.8960095
p_values[nt]=unname(t[1])
tests[nt]="INTRAOPERATIVE MORPHINE"

comparenp(leiac$intraoperative.morphine.dose,leiac$ponv,"Intraoperative morphine dose")
## [1] "Mean Intraoperative morphine dose in no PONV group: "
## [1] 0.7133758
## [1] "Standard deviation in no PONV group"
## [1] 1.942257
## [1] "Mean Intraoperative morphine dose in PONV group: "
## [1] 0.6167558
## [1] "Standard deviation in PONV group"
## [1] 1.749797
## [1] "hypothesis test p-value"
## [[1]]
## [1] 0.5220393
## 
## [1] "-------------------"

## [1] "-------------------"
t=wilcox.test(leiac$intraoperative.morphine.dose ~leiac$ponv)
t;nt=nt+1
## 
##  Wilcoxon rank sum test with continuity correction
## 
## data:  leiac$intraoperative.morphine.dose by leiac$ponv
## W = 356450, p-value = 0.522
## alternative hypothesis: true location shift is not equal to 0
p_values[nt]=unname(t[3])
tests[nt]="INTRAOPERATIVE MORPHINE DOSE"

Prophylactic antiemetics (INTRAOPERATIVE)

comparenp(leiac$antiemeticos.intraop.numero,leiac$ponv,"Number of intraoperative antiemetic drugs")
## [1] "Mean Number of intraoperative antiemetic drugs in no PONV group: "
## [1] 1.396524
## [1] "Standard deviation in no PONV group"
## [1] 0.7017453
## [1] "Mean Number of intraoperative antiemetic drugs in PONV group: "
## [1] 1.383659
## [1] "Standard deviation in PONV group"
## [1] 0.7319958
## [1] "hypothesis test p-value"
## [[1]]
## [1] 0.4026941
## 
## [1] "-------------------"

## [1] "-------------------"
t=wilcox.test(leiac$antiemeticos.intraop.numero ~leiac$ponv)
t;nt=nt+1
## 
##  Wilcoxon rank sum test with continuity correction
## 
## data:  leiac$antiemeticos.intraop.numero by leiac$ponv
## W = 364330, p-value = 0.4027
## alternative hypothesis: true location shift is not equal to 0
p_values[nt]=unname(t[3])
tests[nt]="NUMBER OF INTRAOPERATIVE ANTIEMETIC DRUGS"

# INTRAOPERATIVE ONDANSETRON

table(leiac$ondansetron.intraoperative,leiac$ponv)
##        
##         FALSE TRUE
##   FALSE   262  102
##   TRUE   1004  461
t=fisher.test(leiac$ondansetron.intraoperative,leiac$ponv)
t;nt=nt+1
## 
##  Fisher's Exact Test for Count Data
## 
## data:  leiac$ondansetron.intraoperative and leiac$ponv
## p-value = 0.228
## alternative hypothesis: true odds ratio is not equal to 1
## 95 percent confidence interval:
##  0.9095345 1.5367987
## sample estimates:
## odds ratio 
##   1.179285
p_values[nt]=unname(t[1])
tests[nt]="INTRAOPERATIVE ONDANSETRON"

comparenp(leiac$intraoperative.ondansetron.dose,leiac$ponv,"Intraoperative ondansetron dose")
## [1] "Mean Intraoperative ondansetron dose in no PONV group: "
## [1] 6.088678
## [1] "Standard deviation in no PONV group"
## [1] 3.259275
## [1] "Mean Intraoperative ondansetron dose in PONV group: "
## [1] 6.327402
## [1] "Standard deviation in PONV group"
## [1] 3.112781
## [1] "hypothesis test p-value"
## [[1]]
## [1] 0.1388728
## 
## [1] "-------------------"

## [1] "-------------------"
t=wilcox.test(leiac$intraoperative.ondansetron.dose ~leiac$ponv)
t;nt=nt+1
## 
##  Wilcoxon rank sum test with continuity correction
## 
## data:  leiac$intraoperative.ondansetron.dose by leiac$ponv
## W = 343070, p-value = 0.1389
## alternative hypothesis: true location shift is not equal to 0
p_values[nt]=unname(t[3])
tests[nt]="INTRAOPERATIVE ONDANSETRON DOSE"

# INTRAOPERATIVE DEXAMETHASONE

table(leiac$intraoperative.dexamethasone,leiac$ponv)
##        
##         FALSE TRUE
##   FALSE   527  278
##   TRUE    739  285
t=fisher.test(leiac$intraoperative.dexamethasone,leiac$ponv)
t;nt=nt+1
## 
##  Fisher's Exact Test for Count Data
## 
## data:  leiac$intraoperative.dexamethasone and leiac$ponv
## p-value = 0.002202
## alternative hypothesis: true odds ratio is not equal to 1
## 95 percent confidence interval:
##  0.5958982 0.8971092
## sample estimates:
## odds ratio 
##  0.7312221
p_values[nt]=unname(t[1])
tests[nt]="INTRAOPERATIVE DEXAMETHASONE"

comparenp(leiac$dexamethasone.dose,leiac$ponv,"Intraoperative dexamethasone dose")
## [1] "Mean Intraoperative dexamethasone dose in no PONV group: "
## [1] 3.970705
## [1] "Standard deviation in no PONV group"
## [1] 3.810894
## [1] "Mean Intraoperative dexamethasone dose in PONV group: "
## [1] 3.385305
## [1] "Standard deviation in PONV group"
## [1] 3.785582
## [1] "hypothesis test p-value"
## [[1]]
## [1] 0.002385579
## 
## [1] "-------------------"

## [1] "-------------------"
t=wilcox.test(leiac$dexamethasone.dose ~leiac$ponv)
t;nt=nt+1
## 
##  Wilcoxon rank sum test with continuity correction
## 
## data:  leiac$dexamethasone.dose by leiac$ponv
## W = 382100, p-value = 0.002386
## alternative hypothesis: true location shift is not equal to 0
p_values[nt]=unname(t[3])
tests[nt]="INTRAOPERATIVE DEXAMETHASONE DOSE"

# INTRAOPERATIVE DIMENIDRATE

table(leiac$intraoperative.dimenidrate,leiac$ponv)
##        
##         FALSE TRUE
##   FALSE  1261  554
##   TRUE      5    9
t=fisher.test(leiac$intraoperative.dimenidrate,leiac$ponv)
t;nt=nt+1
## 
##  Fisher's Exact Test for Count Data
## 
## data:  leiac$intraoperative.dimenidrate and leiac$ponv
## p-value = 0.01538
## alternative hypothesis: true odds ratio is not equal to 1
## 95 percent confidence interval:
##   1.225402 15.624013
## sample estimates:
## odds ratio 
##   4.093916
p_values[nt]=unname(t[1])
tests[nt]="INTRAOPERATIVE DIMENIDRATE"

comparenp(leiac$intraoperative.dimenidrate.dose,leiac$ponv,"Intraoperative dimenidrate dose")
## [1] "Mean Intraoperative dimenidrate dose in no PONV group: "
## [1] 0.1342812
## [1] "Standard deviation in no PONV group"
## [1] 2.33163
## [1] "Mean Intraoperative dimenidrate dose in PONV group: "
## [1] 0.5506217
## [1] "Standard deviation in PONV group"
## [1] 4.45006
## [1] "hypothesis test p-value"
## [[1]]
## [1] 0.006432522
## 
## [1] "-------------------"

## [1] "-------------------"
t=wilcox.test(leiac$intraoperative.dimenidrate.dose ~leiac$ponv)
t;nt=nt+1
## 
##  Wilcoxon rank sum test with continuity correction
## 
## data:  leiac$intraoperative.dimenidrate.dose by leiac$ponv
## W = 352090, p-value = 0.006433
## alternative hypothesis: true location shift is not equal to 0
p_values[nt]=unname(t[3])
tests[nt]="INTRAOPERATIVE DIMENIDRATE DOSE"

# INTRAOPERATIVE METOCLOPRAMIDE

table(leiac$Intraoperative.metoclopramide,leiac$ponv)
##        
##         FALSE TRUE
##   FALSE  1246  539
##   TRUE     20   24
t=fisher.test(leiac$Intraoperative.metoclopramide,leiac$ponv)
t;nt=nt+1
## 
##  Fisher's Exact Test for Count Data
## 
## data:  leiac$Intraoperative.metoclopramide and leiac$ponv
## p-value = 0.001329
## alternative hypothesis: true odds ratio is not equal to 1
## 95 percent confidence interval:
##  1.453750 5.341568
## sample estimates:
## odds ratio 
##   2.772284
p_values[nt]=unname(t[1])
tests[nt]="INTRAOPERATIVE METOCLOPRAMIDE"

comparenp(leiac$metoclopramide.dose,leiac$ponv,"Intraoperative metoclopramide dose")
## [1] "Mean Intraoperative metoclopramide dose in no PONV group: "
## [1] 0.1579779
## [1] "Standard deviation in no PONV group"
## [1] 1.247418
## [1] "Mean Intraoperative metoclopramide dose in PONV group: "
## [1] 0.4262877
## [1] "Standard deviation in PONV group"
## [1] 2.021984
## [1] "hypothesis test p-value"
## [[1]]
## [1] 0.0005490021
## 
## [1] "-------------------"

## [1] "-------------------"
t=wilcox.test(leiac$metoclopramide.dose ~leiac$ponv)
t;nt=nt+1
## 
##  Wilcoxon rank sum test with continuity correction
## 
## data:  leiac$metoclopramide.dose by leiac$ponv
## W = 346820, p-value = 0.000549
## alternative hypothesis: true location shift is not equal to 0
p_values[nt]=unname(t[3])
tests[nt]="INTRAOPERATIVE METOCLOPRAMIDE DOSE"

# INTRAOPERATIVE DROPERIDOL

table(leiac$intraoperative.droperidol,leiac$ponv)
##        
##         FALSE TRUE
##   FALSE  1260  555
##   TRUE      6    8
t=fisher.test(leiac$intraoperative.droperidol,leiac$ponv)
t;nt=nt+1
## 
##  Fisher's Exact Test for Count Data
## 
## data:  leiac$intraoperative.droperidol and leiac$ponv
## p-value = 0.04169
## alternative hypothesis: true odds ratio is not equal to 1
## 95 percent confidence interval:
##   0.915511 10.630256
## sample estimates:
## odds ratio 
##    3.02496
p_values[nt]=unname(t[1])
tests[nt]="INTRAOPERATIVE DROPERIDOL"

comparenp(leiac$droperidol.dose,leiac$ponv,"Intraoperative droperidol dose")
## [1] "Mean Intraoperative droperidol dose in no PONV group: "
## [1] 0.02409163
## [1] "Standard deviation in no PONV group"
## [1] 0.3674129
## [1] "Mean Intraoperative droperidol dose in PONV group: "
## [1] 0.06660746
## [1] "Standard deviation in PONV group"
## [1] 0.5928132
## [1] "hypothesis test p-value"
## [[1]]
## [1] 0.03225235
## 
## [1] "-------------------"

## [1] "-------------------"
t=wilcox.test(leiac$droperidol.dose ~leiac$ponv)
t;nt=nt+1
## 
##  Wilcoxon rank sum test with continuity correction
## 
## data:  leiac$droperidol.dose by leiac$ponv
## W = 353010, p-value = 0.03225
## alternative hypothesis: true location shift is not equal to 0
p_values[nt]=unname(t[3])
tests[nt]="INTRAOPERATIVE DROPERIDOL DOSE"

Prophylactic antiemetics (POSTOPERATIVE)

# ONDANSETRON

table(leiac$regular.ondansetron,leiac$ponv)
##        
##         FALSE TRUE
##   FALSE   841  359
##   TRUE    423  203
t=fisher.test(leiac$regular.ondansetron,leiac$ponv)
t;nt=nt+1
## 
##  Fisher's Exact Test for Count Data
## 
## data:  leiac$regular.ondansetron and leiac$ponv
## p-value = 0.2855
## alternative hypothesis: true odds ratio is not equal to 1
## 95 percent confidence interval:
##  0.9074592 1.3910059
## sample estimates:
## odds ratio 
##   1.124159
p_values[nt]=unname(t[1])
tests[nt]="ONDANSETRON"

# DEXAMETHASONE

table(leiac$regular.dexamethasone,leiac$ponv)
##        
##         FALSE TRUE
##   FALSE  1171  537
##   TRUE     91   26
t=fisher.test(leiac$regular.dexamethasone,leiac$ponv)
t;nt=nt+1
## 
##  Fisher's Exact Test for Count Data
## 
## data:  leiac$regular.dexamethasone and leiac$ponv
## p-value = 0.03845
## alternative hypothesis: true odds ratio is not equal to 1
## 95 percent confidence interval:
##  0.3819941 0.9860945
## sample estimates:
## odds ratio 
##  0.6231861
p_values[nt]=unname(t[1])
tests[nt]="DEXAMETHASONE"

# DIMENIDRATE

table(leiac$regular.dimenidrate,leiac$ponv)
##        
##         FALSE TRUE
##   FALSE  1254  562
##   TRUE      8    1
t=fisher.test(leiac$regular.dimenidrate,leiac$ponv)
t;nt=nt+1
## 
##  Fisher's Exact Test for Count Data
## 
## data:  leiac$regular.dimenidrate and leiac$ponv
## p-value = 0.2896
## alternative hypothesis: true odds ratio is not equal to 1
## 95 percent confidence interval:
##  0.006278657 2.089628765
## sample estimates:
## odds ratio 
##  0.2790846
p_values[nt]=unname(t[1])
tests[nt]="DIMENIDRATE"

# DROPERIDOL

table(leiac$regular.droperidol,leiac$ponv)
##        
##         FALSE TRUE
##   FALSE  1168  514
##   TRUE      2    4
t=fisher.test(leiac$regular.droperidol,leiac$ponv)
t;nt=nt+1
## 
##  Fisher's Exact Test for Count Data
## 
## data:  leiac$regular.droperidol and leiac$ponv
## p-value = 0.0757
## alternative hypothesis: true odds ratio is not equal to 1
## 95 percent confidence interval:
##   0.6483642 50.3284491
## sample estimates:
## odds ratio 
##   4.540194
p_values[nt]=unname(t[1])
tests[nt]="DROPERIDOL"

# METOCLOPRAMIDE

table(leiac$regular.metoclopramide,leiac$ponv)
##        
##         FALSE TRUE
##   FALSE  1109  503
##   TRUE    153   60
t=fisher.test(leiac$regular.metoclopramide,leiac$ponv)
t;nt=nt+1
## 
##  Fisher's Exact Test for Count Data
## 
## data:  leiac$regular.metoclopramide and leiac$ponv
## p-value = 0.3862
## alternative hypothesis: true odds ratio is not equal to 1
## 95 percent confidence interval:
##  0.6187898 1.1964026
## sample estimates:
## odds ratio 
##  0.8646648
p_values[nt]=unname(t[1])
tests[nt]="METOCLOPRAMIDE"

Multivariable model

New model selection

# Full model

col1=c("Previous full model","Sex","Age","Previous PONV","Previous CINV", "Number of intraoperative antiemectics","surgical procedure","Neuraxial opioid usage","Fentanyl dose")

m1=(glm(data=leiac,ponv~when.stopped.smoking+sex+age+previous.ponv+post.chemotherapy.nausea+antiemeticos.intraop.numero+surgical.procedure+neuraxial.opioid+fentanil.mcg, family="binomial"))

# Remove 1st

previousAIC=m1[11]$aic
col2=rep(0,9)
col3=rep(0,9)

col2[1]=(glm(data=leiac,ponv~when.stopped.smoking+sex+age+previous.ponv+post.chemotherapy.nausea+antiemeticos.intraop.numero+surgical.procedure+neuraxial.opioid+fentanil.mcg, family="binomial"))[11]$aic

col2[2]=(glm(data=leiac,ponv~when.stopped.smoking+age+previous.ponv+post.chemotherapy.nausea+antiemeticos.intraop.numero+surgical.procedure+neuraxial.opioid+fentanil.mcg, family="binomial"))[11]$aic

col2[3]=(glm(data=leiac,ponv~when.stopped.smoking+sex+previous.ponv+post.chemotherapy.nausea+antiemeticos.intraop.numero+surgical.procedure+neuraxial.opioid+fentanil.mcg, family="binomial"))[11]$aic

col2[4]=(glm(data=leiac,ponv~when.stopped.smoking+sex+age+post.chemotherapy.nausea+antiemeticos.intraop.numero+surgical.procedure+neuraxial.opioid+fentanil.mcg, family="binomial"))[11]$aic

col2[5]=(glm(data=leiac,ponv~when.stopped.smoking+sex+age+previous.ponv+antiemeticos.intraop.numero+surgical.procedure+neuraxial.opioid+fentanil.mcg, family="binomial"))[11]$aic

col2[6]=(glm(data=leiac,ponv~when.stopped.smoking+sex+age+previous.ponv+post.chemotherapy.nausea++surgical.procedure+neuraxial.opioid+fentanil.mcg, family="binomial"))[11]$aic

col2[7]=(glm(data=leiac,ponv~when.stopped.smoking+sex+age+previous.ponv+post.chemotherapy.nausea+antiemeticos.intraop.numero+neuraxial.opioid+fentanil.mcg, family="binomial"))[11]$aic

col2[8]=(glm(data=leiac,ponv~when.stopped.smoking+sex+age+previous.ponv+post.chemotherapy.nausea+antiemeticos.intraop.numero+surgical.procedure+fentanil.mcg, family="binomial"))[11]$aic

col2[9]=(glm(data=leiac,ponv~when.stopped.smoking+sex+age+previous.ponv+post.chemotherapy.nausea+antiemeticos.intraop.numero+surgical.procedure+neuraxial.opioid, family="binomial"))[11]$aic

col3=col2-previousAIC

data.frame(Removed.Predictor=col1,newAIC=col2,Difference=col3)
##                       Removed.Predictor   newAIC  Difference
## 1                   Previous full model 2143.397   0.0000000
## 2                                   Sex 2166.209  22.8113269
## 3                                   Age 2149.060   5.6624009
## 4                         Previous PONV 2179.692  36.2940420
## 5                         Previous CINV 2152.424   9.0268432
## 6 Number of intraoperative antiemectics 2142.552  -0.8451555
## 7                    surgical procedure 2128.157 -15.2403189
## 8                Neuraxial opioid usage 2144.083   0.6850309
## 9                         Fentanyl dose 2150.355   6.9572457
## Surgical procedure out
## Next
m1=(glm(data=leiac,ponv~when.stopped.smoking+sex+age+previous.ponv+post.chemotherapy.nausea+antiemeticos.intraop.numero+neuraxial.opioid+fentanil.mcg, family="binomial"))

col1=c("Previous full model","Sex","Age","Previous PONV","Previous CINV", "Number of intraoperative antiemectics","Neuraxial opioid usage","Fentanyl dose")
previousAIC=m1[11]$aic
col2=rep(0,8)
col3=rep(0,8)

col2[1]=glm(data=leiac,ponv~when.stopped.smoking+ sex+age+previous.ponv+post.chemotherapy.nausea+antiemeticos.intraop.numero+neuraxial.opioid+fentanil.mcg, family="binomial")[11]$aic

col2[2]=glm(data=leiac,ponv~when.stopped.smoking+age+previous.ponv+post.chemotherapy.nausea+antiemeticos.intraop.numero+neuraxial.opioid+fentanil.mcg, family="binomial")[11]$aic

col2[3]=glm(data=leiac,ponv~when.stopped.smoking+sex+previous.ponv+post.chemotherapy.nausea+antiemeticos.intraop.numero+neuraxial.opioid+fentanil.mcg, family="binomial")[11]$aic

col2[4]=glm(data=leiac,ponv~when.stopped.smoking+sex+age+post.chemotherapy.nausea+antiemeticos.intraop.numero+neuraxial.opioid+fentanil.mcg, family="binomial")[11]$aic

col2[5]=glm(data=leiac,ponv~when.stopped.smoking+sex+age+previous.ponv+antiemeticos.intraop.numero+neuraxial.opioid+fentanil.mcg, family="binomial")[11]$aic

col2[6]=glm(data=leiac,ponv~when.stopped.smoking+sex+age+previous.ponv+post.chemotherapy.nausea+neuraxial.opioid+fentanil.mcg, family="binomial")[11]$aic

col2[7]=glm(data=leiac,ponv~when.stopped.smoking+sex+age+previous.ponv+post.chemotherapy.nausea+antiemeticos.intraop.numero+fentanil.mcg, family="binomial")[11]$aic

col2[8]=glm(data=leiac,ponv~when.stopped.smoking+sex+age+previous.ponv+post.chemotherapy.nausea+antiemeticos.intraop.numero+neuraxial.opioid, family="binomial")[11]$aic

col3=col2-previousAIC

data.frame(Removed.Predictor=col1,newAIC=col2,Difference=col3)
##                       Removed.Predictor   newAIC Difference
## 1                   Previous full model 2128.157  0.0000000
## 2                                   Sex 2151.779 23.6215562
## 3                                   Age 2135.821  7.6641806
## 4                         Previous PONV 2165.041 36.8840768
## 5                         Previous CINV 2135.023  6.8654041
## 6 Number of intraoperative antiemectics 2127.303 -0.8546409
## 7                Neuraxial opioid usage 2134.472  6.3150227
## 8                         Fentanyl dose 2134.960  6.8024417
## Number of intraoperative antiemetics out
## Next
m1=(glm(data=leiac,ponv~when.stopped.smoking+sex+age+previous.ponv+post.chemotherapy.nausea+neuraxial.opioid+fentanil.mcg, family="binomial"))

col1=c("Previous full model","Sex","Age","Previous PONV","Previous CINV", "Neuraxial opioid usage","Fentanyl dose")

previousAIC=m1[11]$aic
col2=rep(0,7)
col3=rep(0,7)

col2[1]=(glm(data=leiac,ponv~when.stopped.smoking+sex+age+previous.ponv+post.chemotherapy.nausea+neuraxial.opioid+fentanil.mcg, family="binomial"))[11]$aic

col2[2]=(glm(data=leiac,ponv~when.stopped.smoking+age+previous.ponv+post.chemotherapy.nausea+neuraxial.opioid+fentanil.mcg, family="binomial"))[11]$aic

col2[3]=(glm(data=leiac,ponv~when.stopped.smoking+sex+previous.ponv+post.chemotherapy.nausea+neuraxial.opioid+fentanil.mcg, family="binomial"))[11]$aic

col2[4]=(glm(data=leiac,ponv~when.stopped.smoking+sex+age+post.chemotherapy.nausea+neuraxial.opioid+fentanil.mcg, family="binomial"))[11]$aic

col2[5]=(glm(data=leiac,ponv~when.stopped.smoking+sex+age+previous.ponv+neuraxial.opioid+fentanil.mcg, family="binomial"))[11]$aic

col2[6]=(glm(data=leiac,ponv~when.stopped.smoking+sex+age+previous.ponv+post.chemotherapy.nausea+fentanil.mcg, family="binomial"))[11]$aic

col2[7]=(glm(data=leiac,ponv~when.stopped.smoking+sex+age+previous.ponv+post.chemotherapy.nausea+neuraxial.opioid, family="binomial"))[11]$aic

col3=col2-previousAIC

data.frame(Removed.Predictor=col1,newAIC=col2,Difference=col3)
##        Removed.Predictor   newAIC Difference
## 1    Previous full model 2127.303   0.000000
## 2                    Sex 2150.560  23.257707
## 3                    Age 2134.275   6.972043
## 4          Previous PONV 2164.696  37.393559
## 5          Previous CINV 2133.998   6.695129
## 6 Neuraxial opioid usage 2133.100   5.797207
## 7          Fentanyl dose 2134.351   7.048242

Model comparison

library("generalhoslem")
## Loading required package: reshape
## Loading required package: MASS
m1=(glm(data=leiac,ponv~when.stopped.smoking+sex+age+previous.ponv+post.chemotherapy.nausea+neuraxial.opioid+fentanil.mcg, family="binomial"))

summary(m1)
## 
## Call:
## glm(formula = ponv ~ when.stopped.smoking + sex + age + previous.ponv + 
##     post.chemotherapy.nausea + neuraxial.opioid + fentanil.mcg, 
##     family = "binomial", data = leiac)
## 
## Deviance Residuals: 
##     Min       1Q   Median       3Q      Max  
## -1.6374  -0.8476  -0.6704   1.1628   2.3454  
## 
## Coefficients:
##                                                    Estimate Std. Error
## (Intercept)                                      -1.7970694  0.4148615
## when.stopped.smokingb.1.month.ago                 0.4812235  0.5678402
## when.stopped.smokingc.1-6.months.ago              0.8099373  0.4031277
## when.stopped.smokingd.>6months.ago                1.0881318  0.3391959
## when.stopped.smokinge.never.smoked                1.1479601  0.3332188
## sexMale                                          -0.5756266  0.1160733
## age                                              -0.0115456  0.0038560
## previous.ponvTRUE                                 0.7779238  0.1231098
## post.chemotherapy.nauseaNo.Previous.Chemotherapy  0.2718817  0.1532979
## post.chemotherapy.nauseaTRUE                      0.5752773  0.1793924
## neuraxial.opioidTRUE                              0.3066194  0.1104424
## fentanil.mcg                                      0.0005837  0.0001933
##                                                  z value Pr(>|z|)    
## (Intercept)                                       -4.332 1.48e-05 ***
## when.stopped.smokingb.1.month.ago                  0.847 0.396737    
## when.stopped.smokingc.1-6.months.ago               2.009 0.044523 *  
## when.stopped.smokingd.>6months.ago                 3.208 0.001337 ** 
## when.stopped.smokinge.never.smoked                 3.445 0.000571 ***
## sexMale                                           -4.959 7.08e-07 ***
## age                                               -2.994 0.002751 ** 
## previous.ponvTRUE                                  6.319 2.63e-10 ***
## post.chemotherapy.nauseaNo.Previous.Chemotherapy   1.774 0.076137 .  
## post.chemotherapy.nauseaTRUE                       3.207 0.001342 ** 
## neuraxial.opioidTRUE                               2.776 0.005498 ** 
## fentanil.mcg                                       3.019 0.002532 ** 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## (Dispersion parameter for binomial family taken to be 1)
## 
##     Null deviance: 2258.2  on 1828  degrees of freedom
## Residual deviance: 2103.3  on 1817  degrees of freedom
## AIC: 2127.3
## 
## Number of Fisher Scoring iterations: 4
logitgof(leiac$ponv,fitted(m1),g=2)
## 
##  Hosmer and Lemeshow test (binary model)
## 
## data:  leiac$ponv, fitted(m1)
## X-squared = 0.24088, df = 0, p-value < 2.2e-16
m2=(glm(data=leiac,ponv~Apfel, family="binomial"))

summary(m2)
## 
## Call:
## glm(formula = ponv ~ Apfel, family = "binomial", data = leiac)
## 
## Deviance Residuals: 
##     Min       1Q   Median       3Q      Max  
## -1.2075  -0.9788  -0.7765   1.1476   2.1300  
## 
## Coefficients:
##             Estimate Std. Error z value Pr(>|z|)    
## (Intercept) -2.15931    0.15407 -14.016   <2e-16 ***
## Apfel        0.55744    0.05775   9.654   <2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## (Dispersion parameter for binomial family taken to be 1)
## 
##     Null deviance: 2258.2  on 1828  degrees of freedom
## Residual deviance: 2156.6  on 1827  degrees of freedom
## AIC: 2160.6
## 
## Number of Fisher Scoring iterations: 4
logitgof(leiac$ponv,fitted(m2),g=2)
## 
##  Hosmer and Lemeshow test (binary model)
## 
## data:  leiac$ponv, fitted(m2)
## X-squared = 0.05309, df = 0, p-value < 2.2e-16
 rocobj1=plot.roc(leiac$ponv,fitted(m1),percent=TRUE,col="red",print.auc=TRUE,print.auc.y=40,xlim=c(101,-1),ylim=c(0,100))
 rocobj2=plot.roc(leiac$ponv,fitted(m2),percent=TRUE,col="blue",add=TRUE,print.auc=TRUE,print.auc.y=30,xlim=c(101,-1),ylim=c(0,100))
 testobj=roc.test(rocobj1,rocobj2)
 text(50, 50, labels=paste("p-value =", format.pval(testobj$p.value)), adj=c(0, .5))
 legend("bottomright", legend=c("Apfel", "New Model"), col=c("blue", "red"), lwd=2)

##Hosmer and Lemeshow test (binary model)

Multiple comparisons controlling procedures

p_values=unlist(p_values)


# NUMBER OF HYPOTHESIS TESTS
print(nt)
## [1] 45
# BONFERRONI's alpha (CONSERVATIVE)
new_alpha=0.05 / nt
print(new_alpha)
## [1] 0.001111111
data.frame(tests,p=p.adjust(p_values,method="bonferroni"))
##                                        tests            p
## 1                                        SEX 7.907112e-09
## 2                                      APFEL 3.083087e-21
## 3                                        AGE 7.180836e-03
## 4                              PREVIOUS PONV 1.183946e-15
## 5                                 PO OPIOIDS 1.000000e+00
## 6                                 NON SMOKER 3.750887e-03
## 7                                    SURGERY 1.000000e+00
## 8                        CHRONIC OPIOID USER 1.000000e+00
## 9                      PREVIOUS CHEMOTHERAPY 1.000000e+00
## 10 HOW MANY MONTHS AGO RECEIVED CHEMOTHERAPY 1.000000e+00
## 11                CHEMOTHERAPY EMETOGENICITY 1.000000e+00
## 12               CHEMOTHERAPY INDUCED NAUSEA 4.171783e-06
## 13             CHEMOTHERAPY INDUCED VOMITING 1.000000e+00
## 14                       WHEN STOPED SMOKING 4.006914e-03
## 15                     CIGAR PACKETS x YEARS 2.462605e-01
## 16                  SURGERY CLASSIFICATION 2 1.000000e+00
## 17                      Anesthesia technique 1.000000e+00
## 18                         NEURAXIAL OPIOIDS 1.000000e+00
## 19                      INTRAOPERATIVE OPIOD 1.000000e+00
## 20                              REMIFENTANIL 1.000000e+00
## 21                     CONTINUOUS SUFENTANIL 1.000000e+00
## 22                             FENTANIL DOSE 2.612997e-01
## 23                           SUFENTANIL DOSE 1.000000e+00
## 24                             TRAMADOL PACU 9.861144e-01
## 25                        TRAMADOL PACU DOSE 7.696702e-01
## 26                                  KETAMINE 1.000000e+00
## 27                             KETAMINE DOSE 1.000000e+00
## 28                   INTRAOPERATIVE MORPHINE 1.000000e+00
## 29              INTRAOPERATIVE MORPHINE DOSE 1.000000e+00
## 30 NUMBER OF INTRAOPERATIVE ANTIEMETIC DRUGS 1.000000e+00
## 31                INTRAOPERATIVE ONDANSETRON 1.000000e+00
## 32           INTRAOPERATIVE ONDANSETRON DOSE 1.000000e+00
## 33              INTRAOPERATIVE DEXAMETHASONE 9.906817e-02
## 34         INTRAOPERATIVE DEXAMETHASONE DOSE 1.073511e-01
## 35                INTRAOPERATIVE DIMENIDRATE 6.921735e-01
## 36           INTRAOPERATIVE DIMENIDRATE DOSE 2.894635e-01
## 37             INTRAOPERATIVE METOCLOPRAMIDE 5.978573e-02
## 38        INTRAOPERATIVE METOCLOPRAMIDE DOSE 2.470510e-02
## 39                 INTRAOPERATIVE DROPERIDOL 1.000000e+00
## 40            INTRAOPERATIVE DROPERIDOL DOSE 1.000000e+00
## 41                               ONDANSETRON 1.000000e+00
## 42                             DEXAMETHASONE 1.000000e+00
## 43                               DIMENIDRATE 1.000000e+00
## 44                                DROPERIDOL 1.000000e+00
## 45                            METOCLOPRAMIDE 1.000000e+00
# USING FALSE DISCOVERY RATE

## Benjamini, Y., and Yekutieli, D. (2001). The control of the false discovery rate in 
##multiple testing under dependency. Annals of Statistics 29, 1165–1188. 

data.frame(tests,p=p.adjust(p_values,method="BH"))
##                                        tests            p
## 1                                        SEX 2.635704e-09
## 2                                      APFEL 3.083087e-21
## 3                                        AGE 1.025834e-03
## 4                              PREVIOUS PONV 5.919730e-16
## 5                                 PO OPIOIDS 6.597071e-02
## 6                                 NON SMOKER 6.678190e-04
## 7                                    SURGERY 5.450646e-02
## 8                        CHRONIC OPIOID USER 7.835641e-01
## 9                      PREVIOUS CHEMOTHERAPY 2.136077e-01
## 10 HOW MANY MONTHS AGO RECEIVED CHEMOTHERAPY 2.136077e-01
## 11                CHEMOTHERAPY EMETOGENICITY 1.162116e-01
## 12               CHEMOTHERAPY INDUCED NAUSEA 1.042946e-06
## 13             CHEMOTHERAPY INDUCED VOMITING 2.195795e-01
## 14                       WHEN STOPED SMOKING 6.678190e-04
## 15                     CIGAR PACKETS x YEARS 2.009998e-02
## 16                  SURGERY CLASSIFICATION 2 5.450646e-02
## 17                      Anesthesia technique 1.094323e-01
## 18                         NEURAXIAL OPIOIDS 5.450646e-02
## 19                      INTRAOPERATIVE OPIOD 2.344031e-01
## 20                              REMIFENTANIL 4.026526e-01
## 21                     CONTINUOUS SUFENTANIL 1.870661e-01
## 22                             FENTANIL DOSE 2.009998e-02
## 23                           SUFENTANIL DOSE 1.870661e-01
## 24                             TRAMADOL PACU 5.450646e-02
## 25                        TRAMADOL PACU DOSE 4.810439e-02
## 26                                  KETAMINE 1.094323e-01
## 27                             KETAMINE DOSE 9.604366e-02
## 28                   INTRAOPERATIVE MORPHINE 5.093304e-01
## 29              INTRAOPERATIVE MORPHINE DOSE 5.339038e-01
## 30 NUMBER OF INTRAOPERATIVE ANTIEMETIC DRUGS 4.314579e-01
## 31                INTRAOPERATIVE ONDANSETRON 2.772973e-01
## 32           INTRAOPERATIVE ONDANSETRON DOSE 1.952899e-01
## 33              INTRAOPERATIVE DEXAMETHASONE 9.759188e-03
## 34         INTRAOPERATIVE DEXAMETHASONE DOSE 9.759188e-03
## 35                INTRAOPERATIVE DIMENIDRATE 4.614490e-02
## 36           INTRAOPERATIVE DIMENIDRATE DOSE 2.067596e-02
## 37             INTRAOPERATIVE METOCLOPRAMIDE 6.642858e-03
## 38        INTRAOPERATIVE METOCLOPRAMIDE DOSE 3.088137e-03
## 39                 INTRAOPERATIVE DROPERIDOL 7.816324e-02
## 40            INTRAOPERATIVE DROPERIDOL DOSE 6.597071e-02
## 41                               ONDANSETRON 3.342065e-01
## 42                             DEXAMETHASONE 7.523514e-02
## 43                               DIMENIDRATE 3.342065e-01
## 44                                DROPERIDOL 1.174614e-01
## 45                            METOCLOPRAMIDE 4.238811e-01