rm(list=ls()) # Probability of obtaining a mean proportion value within +/- 10% of the known mean diseased proportion in the scenario (16.2%) ff= read.table("R & rt Prev & CI.txt", header=T); str(ff) tran= c("10x1", "10x2", "25x2", "50x2") for(i in 1:4) { t1= ff[ff$size %in% tran[i],]; t1= droplevels(t1) a= length(which(t1$mean >= 0.146 & t1$mean<= 0.178))/100 cat("size=", tran[i], "prob", round(a,2),"\n") } # Probability of obtaining a mean proportion value within +/- 5% of the known diseased proportion in the scenario (16.2%) # for(i in 1:4) { t1= ff[ff$size %in% tran[i],]; t1= droplevels(t1) a= length(which(t1$mean >= 0.154 & t1$mean<= 0.17))/100 cat("size=", tran[i], "prob", round(a,2),"\n") }