[Diagnosismed-commits] r17 - in pkg/DiagnosisMed: . R
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Tue Aug 18 20:28:52 CEST 2009
Author: pedrobrasil
Date: 2009-08-18 20:28:51 +0200 (Tue, 18 Aug 2009)
New Revision: 17
Modified:
pkg/DiagnosisMed/DESCRIPTION
pkg/DiagnosisMed/R/ROC.r
Log:
Modified: pkg/DiagnosisMed/DESCRIPTION
===================================================================
--- pkg/DiagnosisMed/DESCRIPTION 2009-06-18 03:43:46 UTC (rev 16)
+++ pkg/DiagnosisMed/DESCRIPTION 2009-08-18 18:28:51 UTC (rev 17)
@@ -1,9 +1,9 @@
Package: DiagnosisMed
-Version: 0.2.2.1
-Date: 2009-06-17
+Version: 0.2.2.2
+Date: 2009-08-18
Author: Pedro Brasil <pedro.brasil at ipec.fiocruz.br>
Maintainer: Pedro Brasil <pedro.brasil at ipec.fiocruz.br>
Depends: R (>= 2.7.2),epitools, epicalc, TeachingDemos, tcltk, AMORE
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 - or soon will be - able to estimate sample size for common situations in diagnostic test accuracy, estimate sensitivity and specificity from categorical and continuous test results including some evaluations of indeterminate results, or compare different analysis strategies into measures commonly used by health 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.
License: GPL (>= 2)
Modified: pkg/DiagnosisMed/R/ROC.r
===================================================================
--- pkg/DiagnosisMed/R/ROC.r 2009-06-18 03:43:46 UTC (rev 16)
+++ pkg/DiagnosisMed/R/ROC.r 2009-08-18 18:28:51 UTC (rev 17)
@@ -31,38 +31,35 @@
}
if (is.numeric(gold)==TRUE){
- # Making test summary, overall, disease only, without disease only
- test.summary<-round(c(summary(test),sd(test)),digits=5)
- test.summary<-rbind(test.summary,round(c(summary(test[gold==0]),sd(test[gold==0])),digits=5))
- test.summary<-rbind(test.summary,round(c(summary(test[gold==1]),sd(test[gold==1])),digits=5))
- colnames(test.summary)<-c("Min.","1st Qu.","Median","Mean","3rd Qu.","Max.","SD")
- rownames(test.summary)<-c("Overall summary","Without disease", "With disease")
- # Estimating the AUC and confidence limits, inspired in auc{PresenceAbsence}
- # m length(test[gold == 0])
- # n length(test[gold == 1])
+ X<-sort(test[gold==0])
+ Y<-sort(test[gold==1])
+ #X<-test[gold==0]
+ #Y<-test[gold==1]
AUC <- ((as.double(length(test[gold == 0]))) * (as.double(length(test[gold ==1]))) + ((as.double(length(test[gold == 0]))) * ((as.double(length(test[gold == 0]))) + 1))/2 - sum(rank(test,ties.method = "average")[gold == 0]))/((as.double(length(test[gold == 0]))) * (as.double(length(test[gold == 1]))))
AUC[AUC < 0.5] <- 1 - AUC
- X<-test[gold==0] # pag 209
- Y<-test[gold==1] # pag 209
}
if (is.factor(gold)==TRUE){
- # The same tests summary but with different reference standard codes
+ #X<-test[gold=="negative"]
+ #Y<-test[gold=="positive"]
+ X<-sort(test[gold=="negative"])
+ Y<-sort(test[gold=="positive"])
+ AUC <- ((as.double(length(test[gold == "negative"]))) * (as.double(length(test[gold == "positive"]))) + ((as.double(length(test[gold == "negative"]))) * ((as.double(length(test[gold == "negative"]))) + 1))/2 - sum(rank(test,ties.method = "average")[gold == "negative"]))/((as.double(length(test[gold == "negative"]))) * (as.double(length(test[gold == "positive"]))))
+ AUC[AUC < 0.5] <- 1 - AUC
+ }
+ m<-as.double(length(X))
+ n<-as.double(length(Y))
+
test.summary<-round(c(summary(test),sd(test)),digits=5)
- test.summary<-rbind(test.summary,round(c(summary(test[gold=="negative"]),sd(test[gold=="negative"])),digits=5))
- test.summary<-rbind(test.summary,round(c(summary(test[gold=="positive"]),sd(test[gold=="positive"])),digits=5))
+ test.summary<-rbind(test.summary,round(c(summary(X),sd(X)),digits=5))
+ test.summary<-rbind(test.summary,round(c(summary(Y),sd(Y)),digits=5))
colnames(test.summary)<-c("Min.","1st Qu.","Median","Mean","3rd Qu.","Max.","SD")
rownames(test.summary)<-c("Overall summary","Without disease", "With disease")
- AUC <- ((as.double(length(test[gold =="negative"]))) * (as.double(length(test[gold =="positive"]))) + ((as.double(length(test[gold =="negative"]))) * ((as.double(length(test[gold =="negative"]))) + 1))/2 - sum(rank(test,ties.method = "average")[gold =="negative"]))/((as.double(length(test[gold =="negative"]))) * (as.double(length(test[gold == "positive"]))))
- AUC[AUC < 0.5] <- 1 - AUC
- X<-test[gold=="negative"]
- Y<-test[gold=="positive"]
- }
-
- m<-length(X)
- n<-length(Y)
- D10X<-function(Xi){(1/n)*sum(Y>=Xi)}
- D01Y<-function(Yi){(1/m)*sum(Yi>=X)}
+
+ #D10X<-function(Xi){(1/n)*sum(Y>=Xi)}
+ #D01Y<-function(Yi){(1/m)*sum(Yi>=X)}
+ D10X <- function(Xi) {(1/n) * sum(Y >= Xi[1])}
+ D01Y <- function(Yi) {(1/m) * sum(Yi[1] >= X)}
VAR.AUC<-sum((tapply(X,X,"D10X")-AUC)^2)/(m*(m-1))+sum((tapply(Y,Y,"D01Y")-AUC)^2)/(n*(n-1))
SD.AUC<-sqrt(VAR.AUC)
alpha<-1-CL
More information about the Diagnosismed-commits
mailing list