[Diagnosismed-commits] r20 - in pkg/DiagnosisMed: . R
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Tue Mar 9 05:03:05 CET 2010
Author: pedrobrasil
Date: 2010-03-09 05:03:04 +0100 (Tue, 09 Mar 2010)
New Revision: 20
Modified:
pkg/DiagnosisMed/DESCRIPTION
pkg/DiagnosisMed/R/diagnosis.r
pkg/DiagnosisMed/R/print.diag.r
Log:
Modified: pkg/DiagnosisMed/DESCRIPTION
===================================================================
--- pkg/DiagnosisMed/DESCRIPTION 2010-03-05 01:04:17 UTC (rev 19)
+++ pkg/DiagnosisMed/DESCRIPTION 2010-03-09 04:03:04 UTC (rev 20)
@@ -1,9 +1,9 @@
Package: DiagnosisMed
Version: 0.2.3
-Date: 2010-03-04
+Date: 2010-03-08
Author: Pedro Brasil <pedro.brasil at ipec.fiocruz.br>
Maintainer: Pedro Brasil <pedro.brasil at ipec.fiocruz.br>
-Depends: R (>= 2.7.2),epitools, TeachingDemos, tcltk, AMORE,utils
+Depends: R (>= 2.7.2),epitools, TeachingDemos, tcltk, AMORE,utils,stats
Title: Diagnostic test accuracy evaluation for medical professionals.
Description: DiagnosisMed is a package to analyze data from diagnostic test accuracy evaluating health conditions. It is being built to be used by health professionals. This package is able to estimate sensitivity and specificity from categorical and continuous test results including some evaluations of indeterminate results, or compare different categorical tests, and estimate reasonble cut-offs of tests and display it in a way commonly used by health professionals. No graphical interface is avalible yet. Partners are most welcome.
License: GPL (>= 2)
Modified: pkg/DiagnosisMed/R/diagnosis.r
===================================================================
--- pkg/DiagnosisMed/R/diagnosis.r 2010-03-05 01:04:17 UTC (rev 19)
+++ pkg/DiagnosisMed/R/diagnosis.r 2010-03-09 04:03:04 UTC (rev 20)
@@ -33,12 +33,19 @@
stop('It seems the inputed table is not 2x2. Check your table output.')
}
else{tab<-a
- reference.name <- names(dimnames(tab)[2])
- index.name <- names(dimnames(tab)[1])
- TN<-tab[1,1]
- FN<-tab[1,2]
- FP<-tab[2,1]
- TP<-tab[2,2]
+ if(is.null(dimnames(tab))){
+ reference.name <- 'Not informed'
+ index.name <- 'Not informed'
+ dimnames(tab) <- list(index.test = c('negative','positive'),reference.standard = c('negative','positive'))
+ }
+ else{
+ reference.name <- names(dimnames(tab)[2])
+ index.name <- names(dimnames(tab)[1])
+ }
+ TN<-tab[1,1]
+ FN<-tab[1,2]
+ FP<-tab[2,1]
+ TP<-tab[2,2]
}
}
}
@@ -96,12 +103,11 @@
NPV<-TN/(TN+FN)
NPV.cl<-as.numeric(binom.wilson(TN, TN+FN, conf.level = CL)[4:5])
# diagnostic odds ratio and confidence limits
- OR<-oddsratio(tab,conf.level = CL)
- DOR<-OR$measure[2,1]
+ OR<-fisher.test(tab,conf.level=CL)
+ DOR<-unname(OR$estimate)
#DOR<-(TP*TN)/(FP*FN)
- DOR.inf.cl<-OR$measure[2,2]
- DOR.sup.cl<-OR$measure[2,3]
- rm(OR)
+ DOR.inf.cl<-OR$conf.int[1]
+ DOR.sup.cl<-OR$conf.int[2]
# error rate and error trade
#ER<-((FN/(FN+TN))*p)+(((FP/(FP+TP))*(TN+FP))
ER<-(FN+FP)/n
Modified: pkg/DiagnosisMed/R/print.diag.r
===================================================================
--- pkg/DiagnosisMed/R/print.diag.r 2010-03-05 01:04:17 UTC (rev 19)
+++ pkg/DiagnosisMed/R/print.diag.r 2010-03-09 04:03:04 UTC (rev 20)
@@ -3,6 +3,7 @@
cat("Index test :",x$index.name,"\n")
cat("---------------------------------------------------------------\n")
print(x$tabmarg)
+ cat("\n")
cat("The test has the following parameters [",x$Conf.limit*100,"% confidence interval]\n",sep="")
cat("---------------------------------------------------------------\n")
cat("Sample size: ",x$n,"\n")
@@ -14,7 +15,7 @@
cat("Positive likelihood ratio: ",formatC(x$PLR,digits=2,format="f")," [",formatC(x$PLR.inf.cl,digits=2,format="f")," - ",formatC(x$PLR.sup.cl,digits=2,format="f"),"]\n")
cat("Negative likelihood ratio: ",formatC(x$NLR,digits=2,format="f")," [",formatC(x$NLR.inf.cl,digits=2,format="f")," - ",formatC(x$NLR.sup.cl,digits=2,format="f"),"]\n")
cat("Diagnostic odds ratio: ",formatC(x$DOR,digits=2,format="f")," [",formatC(x$DOR.inf.cl,digits=2,format="f")," - ",formatC(x$DOR.sup.cl,digits=2,format="f"),"]\n")
- cat("Error trade off (FN : FP) ",round(x$ET,digits=2)," : 1 \n",sep='')
+ cat("Error trade off (FN : FP) ",round(x$ET,digits=2)," : 1 \n",sep='')
cat("Error rate(%): ",formatC(x$ER*100,digits=2,format="f")," [",formatC(x$ER.cl[1]*100,digits=2,format="f")," - ",formatC(x$ER.cl[2]*100,digits=2,format="f"),"]\n")
cat("Accuracy(%): ",formatC(x$accu*100,digits=2,format="f")," [",formatC(x$accu.cl[1]*100,digits=2,format="f")," - ",formatC(x$accu.cl[2]*100,digits=2,format="f"),"]\n")
cat("Youden index: ",formatC(x$Youden,digits=4,format="f")," [",formatC(x$Youden.inf.cl,digits=4,format="f")," - ",formatC(x$Youden.sup.cl,digits=4,format="f"),"]\n")
More information about the Diagnosismed-commits
mailing list