Sample description

means=0
values=length(numericlist)
for(i in c(1:values)){
  means[i]=mean(numval[,i])
}

sds=0
for(i in c(1:values)){
  sds[i]=sd(numval[,i])
}

mins=0
for(i in c(1:values)){
  mins[i]=min(numval[,i])
}

maxs=0
for(i in c(1:values)){
  maxs[i]=max(numval[,i])
}


numericas=data.frame(variavel=numnames,mean=means,sd=sds,min=mins,max=maxs)

values=length(categoricallist)

tblFun <- function(x){
    tbl <- table(x)
    res <- cbind(tbl,round(prop.table(tbl)*100,2))
    colnames(res) <- c('Count','Percentage')
    res
}
##                   variavel        mean           sd    min     max
## 1                  mg.kg.h   2.6090909   0.39015149   1.96    3.64
## 2                      age  48.0000000  16.11269833  19.00   78.00
## 3                   weight  75.3636364  12.56808299  48.00  105.00
## 4                   height   1.6581818   0.08336017   1.52    1.80
## 5                      bmi  27.3531818   5.53231320  15.85   41.01
## 6           sistolic.basal 132.9090909  20.63725040 100.00  179.00
## 7          diastolic.basal  81.3181818  13.23914241  43.00  106.00
## 8                 hr.basal  78.1818182  10.02205360  61.00  104.00
## 9               spo2.basal  98.0454545   2.12641600  92.00  100.00
## 10           tube.diameter   7.3181818   0.47673129   7.00    8.00
## 11          laryngoscopies   1.0909091   0.29424494   1.00    2.00
## 12   cuff.pressure.initial  23.2272727   5.74814105  10.00   35.00
## 13      remifentanil.total 284.9363636 352.30523231   0.00 1192.00
## 14         lidocaine.total 350.7909091  99.87987980 124.00  518.00
## 15     cuff.pressure.final  20.3181818   6.66466420  10.00   30.00
## 16          sistolic.final 127.0909091  20.13267680  87.00  167.00
## 17         diastolic.final  81.5000000  12.24258765  50.00  103.00
## 18              spo2.final  98.4545455   1.50324325  95.00  100.00
## 19                hr.final  77.0909091  11.55075380  58.00  105.00
## 20      extubation.minutes   9.1818182   4.01943331   4.00   20.00
## 21      sistolic.variation  -5.8181818  22.06405472 -47.00   37.00
## 22     diastolic.variation   0.1818182  17.53536933 -40.00   47.00
## 23            hr.variation  -1.0909091  17.16837927 -46.00   28.00
## 24 cuff.pressure.variation  -2.9090909   3.84099554 -11.00    5.00
## 25          spo2.variation   0.4090909   1.96781462  -3.00    6.00
## $ASA
##   Count Percentage
## 1     8      36.36
## 2    12      54.55
## 3     2       9.09
## $procedure
##                              Count Percentage
## Abdominal wall hernia            1       4.55
## breast setorectomy               2       9.09
## Corneal transplantation          7      31.82
## Inguinal hernia repeair          2       9.09
## Laparoscopic cholecistectomy     8      36.36
## Laparoscopy                      1       4.55
## trepanation                      1       4.55
## $bucking
##       Count Percentage
## FALSE    13      59.09
## TRUE      9      40.91
## $dipyrone.2g
##      Count Percentage
## TRUE    22        100
## $ondansetron.8mg
##       Count Percentage
## FALSE     6      27.27
## TRUE     16      72.73
## $tenoxicam.40mg
##       Count Percentage
## FALSE     3      13.64
## TRUE     19      86.36
## $dexamethasone.10mg
##       Count Percentage
## FALSE    14      63.64
## TRUE      8      36.36

Main result and analysis

#Sucess:
g1=subset(data,data$bucking==FALSE)
#Failure:
g2=subset(data,data$bucking==TRUE)
test.df=data.frame(responseSequence=!data$bucking,doseSequence=data$mg.kg.h)

plot(mg.kg.h~id,data=data,xlab="Patient number",ylab="Lidocaine mcg/kg.h")
lines(data$mg.kg.h~data$id,data=data)
points(g1$mg.kg.h~g1$id,col="black",bg="white",pch=21)
 points(g2$mg.kg.h~g2$id,col="black",bg="black",pch=21)

 testPava.df <- preparePava(test.df)
print(testPava.df)
##   naiveProbability pavaProbability nEvents nTrials nDoses
## 1            0.000       0.0000000       0       1   1.96
## 2            0.400       0.3846154       2       5   2.24
## 3            0.375       0.3846154       3       8   2.52
## 4            1.000       1.0000000       5       5   2.80
## 5            1.000       1.0000000       1       1   3.08
## 6            1.000       1.0000000       1       1   3.36
## 7            1.000       1.0000000       1       1   3.64
test.boot <- boot(data = test.df, statistic = bootIsotonicRegression, R = 9999, sim = 'parametric', ran.gen = bootIsotonicResample, mle = list(baselinePava = testPava.df, firstDose = 3.64, PROBABILITY.GAMMA = 0.5), baselinePava = testPava.df, PROBABILITY.GAMMA = 0.5)
r2=bootBC.ci(test.boot$t0[3], test.boot$t[, 3])
ici=r2$`2.5% Bias Corrected Lower Bound`
ed50=r2$`Original Statistic` #ED50
print(ed50)
## [1] 2.5725
icm=r2$`97.5% Bias Corrected Upper Bound`
boot.ci(test.boot, type = c('norm', 'basic', 'perc'), conf = 0.95, index = 3)
## BOOTSTRAP CONFIDENCE INTERVAL CALCULATIONS
## Based on 9999 bootstrap replicates
## 
## CALL : 
## boot.ci(boot.out = test.boot, conf = 0.95, type = c("norm", "basic", 
##     "perc"), index = 3)
## 
## Intervals : 
## Level      Normal              Basic              Percentile     
## 95%   ( 2.372,  2.907 )   ( 2.502,  2.965 )   ( 2.180,  2.643 )  
## Calculations and Intervals on Original Scale

Potential confounding factors

Tube diameter

##        
##         7 8
##   FALSE 9 4
##   TRUE  6 3
## 
##  Fisher's Exact Test for Count Data
## 
## data:  table(data$bucking, data$tube.diameter)
## p-value = 1
## alternative hypothesis: true odds ratio is not equal to 1
## 95 percent confidence interval:
##  0.1186516 9.6220694
## sample estimates:
## odds ratio 
##   1.118965

Laryngoscopy count

##        
##          1  2
##   FALSE 11  2
##   TRUE   9  0
## 
##  Fisher's Exact Test for Count Data
## 
## data:  table(data$bucking, data$laryngoscopies)
## p-value = 0.4935
## alternative hypothesis: true odds ratio is not equal to 1
## 95 percent confidence interval:
##  0.000000 7.709768
## sample estimates:
## odds ratio 
##          0

Ondansetron 8mg

##        
##         FALSE TRUE
##   FALSE     3   10
##   TRUE      3    6
## 
##  Fisher's Exact Test for Count Data
## 
## data:  table(data$bucking, data$ondansetron.8mg)
## p-value = 0.655
## alternative hypothesis: true odds ratio is not equal to 1
## 95 percent confidence interval:
##  0.06023885 6.16448649
## sample estimates:
## odds ratio 
##  0.6144866

Tenoxicam 40mg

##        
##         FALSE TRUE
##   FALSE     3   10
##   TRUE      0    9
## 
##  Fisher's Exact Test for Count Data
## 
## data:  table(data$bucking, data$tenoxicam.40mg)
## p-value = 0.2403
## alternative hypothesis: true odds ratio is not equal to 1
## 95 percent confidence interval:
##  0.2934045       Inf
## sample estimates:
## odds ratio 
##        Inf

Dexamethasone 10mg

##        
##         FALSE TRUE
##   FALSE     9    4
##   TRUE      5    4
## 
##  Fisher's Exact Test for Count Data
## 
## data:  table(data$bucking, data$dexamethasone.10mg)
## p-value = 0.6619
## alternative hypothesis: true odds ratio is not equal to 1
## 95 percent confidence interval:
##   0.2185166 14.6338010
## sample estimates:
## odds ratio 
##    1.75137

Dipyrone 2g

##        
##         TRUE
##   FALSE   13
##   TRUE     9

Numerical

##                  variavel               bucking            nobucking pvalue
## 1      remifentanil.total    331.8 ( 0 - 1192 )  252.49 ( 0 , 1110 )   0.49
## 2         lidocaine.total 323.6 ( 238.4 - 413 ) 369.62 ( 124 , 518 )   0.23
## 3      extubation.minutes       8.22 ( 5 - 14 )      9.85 ( 4 , 20 )   0.52
## 4      sistolic.variation        1 ( -29 - 37 )  -10.54 ( -47 , 19 )   0.30
## 5     diastolic.variation     2.11 ( -24 - 17 )   -1.15 ( -40 , 47 )   0.44
## 6            hr.variation     0.22 ( -16 - 28 )      -2 ( -46 , 27 )   1.00
## 7 cuff.pressure.variation     -4.33 ( -11 - 0 )     -1.92 ( -8 , 5 )   0.18
## 8          spo2.variation       0.22 ( -3 - 2 )      0.54 ( -2 , 6 )   0.94