2012年4月10日 (火)

Risk difference and 95% CI to calculate NNH

NNH: number needed to harm > riskdiff.confint <- function(r1,n1,r2,n2,sig.level=.05,side=2){ + p1 <- r1/n1 + p2 <- r2/n2 + diff <- p1 - p2 + se <- sqrt(p1*(1-p1)/n1 + p2*(1-p2)/n2) + LL <- diff - qnorm(sig.level/side, lower.tail=FALSE)*se + UL <- diff...

» 続きを読む

2012年3月 8日 (木)

Pooled ORs of diagnostic tests using "metafor" package

> a <- c(26,11,68,74,84,40,16,96,1...

» 続きを読む

2012年3月 5日 (月)

An example of summary ROC curve

# Summary ROC curve > a <- c(26,11,68,74,84,40,16,96,11,91,46,15,58,26) > b <- c(4,1,3,12,20,3,1,20,2,5,9,1,10,4) > c <- c(2,2,8,0+0.5,13,7,9,15,2,5,3,2,16,1) > d <- c(83,5,34,111,99,41,109,206,57,57,42,93,121,74) > (Se <- a/(a+c)) [1] 0.9285714 0.8461538 0.8947368 0.9932886 0.8659794 [6] 0.8510638 0.6400000 0.8648649 0.8461538 0.9479167 [11] 0.9387755 0.8823529 0.7837838...

» 続きを読む

2012年3月 4日 (日)

Positive odds ratio and Se/Sp odds ratio checked by weighted linear regression model

# Checking association b/w positive odds ratio and # Se/Sp odds ratio by weighted linear regression model a <- c(26,11,68,74,84,40,16,96,11,91,46,15,58,26) b <- c(4,1,3,12,20,3,1,20,2,5,9,1,10,4) c <- c(2,2,8,0+0.5,13,7,9,15,2,5,3,2,16,1) d <- c(83,5,34,111,99,41,109,206,57,57,42,93,121,74) cbind (a,c,b,d) (Se <- a/(a+c)) (Sp <- d/(b+d)) (x <- 1-Sp)...

» 続きを読む

2012年3月 3日 (土)

A plot of sensitivity and specificity

# 丹後俊郎著 メタ・アナリシス入門 朝倉書店 # 7.4 統合ROC曲線の推定...

» 続きを読む

2012年2月25日 (土)

A sample of ROC curve analysis

library(Epi) dat0 <- read.table("http://homepage3.nifty.com/ ttyotani/ichirdat/120225-ROC-sample-dat.txt") Click here to get a sample data str(dat0) 'data.frame': 484 obs. of 2 variables: $ KTSND: int 15 13 16 4 18 29 15 15 11 6 ... $ SMK : int 1 1 1...

» 続きを読む

2012年2月12日 (日)

Multiple comparison among 4 groups using Fisher exact test

#Pairwise Fisher exact test with Holm's and Hochberg's adjustment among 4 groups (6 pairs) p.fisher.6comp <- function(tab){ p.x<-c( "p.fisher.12"=fisher.test(tab[,c(1,2)])$p.value, "p.fisher.13"=fisher.test(tab[,c(1,3)])$p.value, "p.fisher.14"=fisher.test(tab[,c(1,4)])$p.value, "p.fisher.23"=fisher.test(tab[,c(2,3)])$p.value, "p.fisher.24"=fisher.test(tab[,c(2,4)])$p.value, "p.fisher.34"=fisher.test(tab[,c(3,4)])$p.value ) hochberg <- cbind("Crude"=rev(sort(p.x)),"Hoch-Adj."=rev(sort(p.x))*c(1:6)) holm <- cbind("Crude"=sort(p.x),"Holm-Adj."=sort(p.x)*c(6:1)) print(round(hochberg,4)) print(round(holm,4)) } tab1 <- matrix(c(0,6,2,1,3,19,3,2,27,2,0,13),nr=3) tab1 [,1] [,2]...

» 続きを読む

2012年2月10日 (金)

Multiple comparison among 3 groups using Fisher exact test

#Pairwise Fisher exact test with Holm's and Hochberg's adjustment p.fisher.3comp <- function(tab){ p.x<-c( "p.fisher.12"=fisher.test(tab[,c(1,2)])$p.value, "p.fisher.13"=fisher.test(tab[,c(1,3)])$p.value, "p.fisher.23"=fisher.test(tab[,c(2,3)])$p.value ) hochberg <- cbind("Crude"=rev(sort(p.x)),"Hoch-Adj."=rev(sort(p.x))*c(1:3)) holm <- cbind("Crude"=sort(p.x),"Holm-Adj."=sort(p.x)*c(3:1)) print(round(hochberg,4)) print(round(holm,4)) } tab <- matrix(c(49,0,97,4,63,10),nr=2) p.fisher.3comp(tab) Crude Hoch-Adj. p.fisher.12 0.3038 0.3038 p.fisher.23 0.0248 0.0496 p.fisher.13 0.0057...

» 続きを読む

2012年2月 7日 (火)

Multiple comparisons of proportions (Hochberg's method)

tab <- matrix(c(49,0,97,4,63,10),nr=2...

» 続きを読む

2012年2月 6日 (月)

Multiple comparisons of proportions (Holm's method)

tab <- matrix(c(49,0,97,4,63,10),nr=2...

» 続きを読む

«Multiple comparison with the adjustment of Hochberg's method