Study 1 is divided into two parts. First the evaluation of the accuracy and agreement of the NVet, using fresh whole blood and thawed serum samples. Second the assesment of the best slope calibration factor for the NVet meter to use in dairy cattle.
Evaluation of the accuracy and agreement of the NVet, using fresh whole blood and thawed serum samples
True prevalence of hypeketonemia
confusionMatrix(nv_lab_table)
## Confusion Matrix and Statistics
##
## lab >= 1.2
## nv >= 1.2 TRUE FALSE
## TRUE 21 3
## FALSE 0 175
##
## Accuracy : 0.9849
## 95% CI : (0.9566, 0.9969)
## No Information Rate : 0.8945
## P-Value [Acc > NIR] : 5.574e-07
##
## Kappa : 0.9249
##
## Mcnemar's Test P-Value : 0.2482
##
## Sensitivity : 1.0000
## Specificity : 0.9831
## Pos Pred Value : 0.8750
## Neg Pred Value : 1.0000
## Prevalence : 0.1055
## Detection Rate : 0.1055
## Detection Prevalence : 0.1206
## Balanced Accuracy : 0.9916
##
## 'Positive' Class : TRUE
##
Characteristics per device with confidence interval
rvaln <- epi.tests(nv_lab_table, conf.level = 0.95)
print(rvaln)
## Outcome + Outcome - Total
## Test + 21 3 24
## Test - 0 175 175
## Total 21 178 199
##
## Point estimates and 95 % CIs:
## ---------------------------------------------------------
## Apparent prevalence 0.12 (0.08, 0.17)
## True prevalence 0.11 (0.07, 0.16)
## Sensitivity 1.00 (0.84, 1.00)
## Specificity 0.98 (0.95, 1.00)
## Positive predictive value 0.88 (0.68, 0.97)
## Negative predictive value 1.00 (0.98, 1.00)
## Positive likelihood ratio 59.33 (19.32, 182.21)
## Negative likelihood ratio 0.00 (0.00, NaN)
## ---------------------------------------------------------
#summary(rvaln)
rvalpx <- epi.tests(pxtra_lab_table, conf.level = 0.95)
print(rvalpx)
## Outcome + Outcome - Total
## Test + 20 0 20
## Test - 1 7 8
## Total 21 7 28
##
## Point estimates and 95 % CIs:
## ---------------------------------------------------------
## Apparent prevalence 0.71 (0.51, 0.87)
## True prevalence 0.75 (0.55, 0.89)
## Sensitivity 0.95 (0.76, 1.00)
## Specificity 1.00 (0.59, 1.00)
## Positive predictive value 1.00 (0.83, 1.00)
## Negative predictive value 0.88 (0.47, 1.00)
## Positive likelihood ratio Inf (NaN, Inf)
## Negative likelihood ratio 0.05 (0.01, 0.32)
## ---------------------------------------------------------
#summary(rvalpx)
rvalserum <- epi.tests(serum1.0_lab_table, conf.level = 0.95)
print(rvalserum)
## Outcome + Outcome - Total
## Test + 21 4 25
## Test - 0 174 174
## Total 21 178 199
##
## Point estimates and 95 % CIs:
## ---------------------------------------------------------
## Apparent prevalence 0.13 (0.08, 0.18)
## True prevalence 0.11 (0.07, 0.16)
## Sensitivity 1.00 (0.84, 1.00)
## Specificity 0.98 (0.94, 0.99)
## Positive predictive value 0.84 (0.64, 0.95)
## Negative predictive value 1.00 (0.98, 1.00)
## Positive likelihood ratio 44.50 (16.89, 117.26)
## Negative likelihood ratio 0.00 (0.00, NaN)
## ---------------------------------------------------------
#summary(rvalserum)
Concordance correlation coeficient (CCC)
nv.ccc <- CCC(nv, lab, ci = "z-transform", conf.level = 0.95, na.rm = T)
serum1.0.ccc <- CCC(serum1.0, lab, ci = "z-transform", conf.level = 0.95, na.rm = T)
px.ccc <- CCC(px, lab, ci = "z-transform", conf.level = 0.95, na.rm = T)
paste("CCC: ", round(nv.ccc$rho.c[,2], digits = 2), " (95% CI ",round(nv.ccc$rho.c[,1], digits = 2), " - ",
round(nv.ccc$rho.c[,3], digits = 2), ")", sep = "")
## [1] "CCC: 0.95 (95% CI 0.96 - 0.97)"
paste("CCC: ", round(serum1.0.ccc$rho.c[,1], digits = 2), " (95% CI ",round(serum1.0.ccc$rho.c[,2], digits = 2), " - ",
round(serum1.0.ccc$rho.c[,3], digits = 2), ")", sep = "")
## [1] "CCC: 0.89 (95% CI 0.86 - 0.91)"
paste("CCC: ", round(px.ccc$rho.c[,1], digits = 2), " (95% CI ",round(px.ccc$rho.c[,2], digits = 2), " - ",
round(px.ccc$rho.c[,3], digits = 2), ")", sep = "")
## [1] "CCC: 0.94 (95% CI 0.93 - 0.95)"
Pearson's correlation test
cor.test(ketometers$nv, ketometers$lab, method=c("pearson"))
##
## Pearson's product-moment correlation
##
## data: x and y
## t = 49.403, df = 197, p-value < 2.2e-16
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
## 0.9499393 0.9710944
## sample estimates:
## cor
## 0.9619321
cor.test(ketometers$serum1.0, ketometers$lab, method=c("pearson"))
##
## Pearson's product-moment correlation
##
## data: x and y
## t = 32.126, df = 197, p-value < 2.2e-16
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
## 0.8908114 0.9361348
## sample estimates:
## cor
## 0.9163615
cor.test(ketometers$pxtra, ketometers$lab, method=c("pearson"))
##
## Pearson's product-moment correlation
##
## data: x and y
## t = 76.345, df = 196, p-value < 2.2e-16
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
## 0.9783412 0.9875882
## sample estimates:
## cor
## 0.9835988
Bland Altman plots
bland.altman.plot(lab ,nv,main="Bland Altman Plot - Gold standard vs. NVet blood", size=0.1, xlab="Mean BHB concentration",graph.sys = "ggplot2")+ theme_bw()+
scale_x_continuous(name="Mean BHB concentration (mmol/L)", limits=c(0,7), breaks=seq(0, 7, 1)) +
scale_y_continuous(name="Mean Difference in BHB concentration \n between test",limits=c(-2.5,1.2), breaks=seq(-2.5, 1.2, 0.4 ))+ geom_hline(yintercept=0, size=0.7)+ theme( axis.title.x = element_text( size=12), axis.title.y = element_text( size=12))+ annotate(geom="text", x=0, y=1.2, label="A)",size=5)+
annotate(geom="text", x=6.1, y=0.45, label="+1.96 SD = 0.31",size=3.5)+
annotate(geom="text", x=6.1, y=0.12, label=" mean = 0.0",size=3.5)+
annotate(geom="text", x=6.1, y=-0.18, label="+1.96 SD = -0.31",size=3.5)
Passing Bablok reggresions
library(mcr)
PB.reg1 <- mcreg(lab,nv,method.reg = "PaBa")
PB.reg2 <- mcreg(lab,serum1.0, method.reg = "PaBa")
PB.reg3 <- mcreg(lab,px, method.reg = "PaBa",na.rm=TRUE)
## Please note:
## 1 of 199 observations contain missing values and have been removed.
## Number of data points in analysis is 198.
# Model and CI
getCoefficients(PB.reg1)
## EST SE LCI UCI
## Intercept -0.100000 NA -0.2 0.000000
## Slope 1.166667 NA 1.0 1.333333
getCoefficients(PB.reg2)
## EST SE LCI UCI
## Intercept 0.1 NA 0.1 0.1
## Slope 1.0 NA 1.0 1.0
getCoefficients(PB.reg3)
## EST SE LCI UCI
## Intercept -0.07111111 NA -0.1154775 0.0342501
## Slope 1.24444444 NA 1.0984522 1.3103448
plot(PB.reg1, equal.axis = TRUE, x.lab = "BHB concentration - Gold Standard", y.lab = "BHB concentration - NVet blood", points.col = "gray20", points.pch = 1, ci.area = TRUE, ci.area.col = "whitesmoke", reg=T,identity.lwd=2,ylim=c(0,6), sub = "", add.grid =T,points.cex = 0.7, add.legend =F,add.cor = F, main= "",cex.lab=1)
plot(PB.reg2, equal.axis = TRUE, x.lab = "BHB concentration - Gold Standard", y.lab = "BHB concentration - NVet serum", points.col = "gray20", points.pch = 1, ci.area = TRUE, ci.area.col = "whitesmoke", reg=T,identity.lwd=2,ylim=c(0,6), sub = "", add.grid =T,points.cex = 0.7, add.legend =F,add.cor = F, main= "",cex.lab=1)
plot(PB.reg3, equal.axis = TRUE, x.lab = "BHB concentration - Gold Standard", y.lab = "BHB concentration - PXtra blood", points.col = "gray20", points.pch = 1, ci.area = TRUE, ci.area.col = "whitesmoke", reg=T,identity.lwd=2,ylim=c(0,6), sub = "", add.grid =T,points.cex = 0.7, add.legend =F,add.cor = F, main= "",cex.lab=1)
Assesment of the best slope calibration factor for the NVet meter
Characteristics of the slopes
tab.serum0.9<- tally(~serum0.9 >=1.2|lab>=1.2, data=ketometers, margins = FALSE,format = "default")
tab.serum1.0<- tally(~serum1.0 >=1.2|lab>=1.2, data=ketometers, margins = FALSE,format = "default")
tab.serum1.1<- tally(~serum1.1 >=1.2|lab>=1.2, data=ketometers, margins = FALSE,format = "default")
tab.serum1.25<- tally(~serum1.25 >=1.2|lab>=1.2, data=ketometers, margins = FALSE,format = "default")
tab.serum1.5<- tally(~serum1.5 >=1.2|lab>=1.2, data=ketometers, margins = FALSE,format = "default")
tab.serum.0.9 <- epi.tests(tab.serum0.9, conf.level = 0.95)
print(tab.serum.0.9)
## Outcome + Outcome - Total
## Test + 19 1 20
## Test - 2 177 179
## Total 21 178 199
##
## Point estimates and 95 % CIs:
## ---------------------------------------------------------
## Apparent prevalence 0.10 (0.06, 0.15)
## True prevalence 0.11 (0.07, 0.16)
## Sensitivity 0.90 (0.70, 0.99)
## Specificity 0.99 (0.97, 1.00)
## Positive predictive value 0.95 (0.75, 1.00)
## Negative predictive value 0.99 (0.96, 1.00)
## Positive likelihood ratio 161.05 (22.70, 1142.61)
## Negative likelihood ratio 0.10 (0.03, 0.36)
## ---------------------------------------------------------
tab.serum.1.0 <- epi.tests(tab.serum1.0, conf.level = 0.95)
print(tab.serum.1.0)
## Outcome + Outcome - Total
## Test + 21 4 25
## Test - 0 174 174
## Total 21 178 199
##
## Point estimates and 95 % CIs:
## ---------------------------------------------------------
## Apparent prevalence 0.13 (0.08, 0.18)
## True prevalence 0.11 (0.07, 0.16)
## Sensitivity 1.00 (0.84, 1.00)
## Specificity 0.98 (0.94, 0.99)
## Positive predictive value 0.84 (0.64, 0.95)
## Negative predictive value 1.00 (0.98, 1.00)
## Positive likelihood ratio 44.50 (16.89, 117.26)
## Negative likelihood ratio 0.00 (0.00, NaN)
## ---------------------------------------------------------
tab.serum.1.1 <- epi.tests(tab.serum1.1, conf.level = 0.95)
print(tab.serum.1.1)
## Outcome + Outcome - Total
## Test + 21 12 33
## Test - 0 166 166
## Total 21 178 199
##
## Point estimates and 95 % CIs:
## ---------------------------------------------------------
## Apparent prevalence 0.17 (0.12, 0.22)
## True prevalence 0.11 (0.07, 0.16)
## Sensitivity 1.00 (0.84, 1.00)
## Specificity 0.93 (0.89, 0.96)
## Positive predictive value 0.64 (0.45, 0.80)
## Negative predictive value 1.00 (0.98, 1.00)
## Positive likelihood ratio 14.83 (8.59, 25.62)
## Negative likelihood ratio 0.00 (0.00, NaN)
## ---------------------------------------------------------
tab.serum.1.25 <- epi.tests(tab.serum1.25, conf.level = 0.95)
print(tab.serum.1.25)
## Outcome + Outcome - Total
## Test + 21 35 56
## Test - 0 143 143
## Total 21 178 199
##
## Point estimates and 95 % CIs:
## ---------------------------------------------------------
## Apparent prevalence 0.28 (0.22, 0.35)
## True prevalence 0.11 (0.07, 0.16)
## Sensitivity 1.00 (0.84, 1.00)
## Specificity 0.80 (0.74, 0.86)
## Positive predictive value 0.38 (0.25, 0.51)
## Negative predictive value 1.00 (0.97, 1.00)
## Positive likelihood ratio 5.09 (3.78, 6.84)
## Negative likelihood ratio 0.00 (0.00, NaN)
## ---------------------------------------------------------
ROC - Best threshold
## Setting levels: control = neg, case = pos
## Setting direction: controls < cases
## Setting levels: control = neg, case = pos
## Setting direction: controls < cases
## Setting levels: control = neg, case = pos
## Setting direction: controls < cases
## Setting levels: control = neg, case = pos
## Setting direction: controls < cases
## Setting levels: control = neg, case = pos
## Setting direction: controls < cases
## 95% CI (2000 stratified bootstrap replicates):
## thresholds sp.low sp.median sp.high se.low se.median se.high
## 0.95 0.9213 0.9551 0.9831 1 1 1
## 95% CI (2000 stratified bootstrap replicates):
## thresholds sp.low sp.median sp.high se.low se.median se.high
## 1.15 0.9551 0.9775 0.9944 1 1 1
## 95% CI (2000 stratified bootstrap replicates):
## thresholds sp.low sp.median sp.high se.low se.median se.high
## 1.25 0.9438 0.9719 0.9944 1 1 1
## 95% CI (2000 stratified bootstrap replicates):
## thresholds sp.low sp.median sp.high se.low se.median se.high
## 1.45 0.9551 0.9775 0.9944 0.8571 0.9524 1
## 95% CI (2000 stratified bootstrap replicates):
## thresholds sp.low sp.median sp.high se.low se.median se.high
## 1.75 0.9551 0.9775 0.9944 0.8571 0.9524 1