Confidence of population freedom for multiple time periods
Calculate the confidence of country or area freedom from disease/infection
- over multiple time periods
- when the sensitivity of the surveillance system in each time period is known (or can be estimated)
- when the likelihood of introduction of disease (or of disease exceeding the design prevalence) in each time period is known (or can be estimated)
- when the prior confidence of freedom can be estimated
Data Format
To submit data, enter it into three columns of a spreadsheet, copy it and paste it into the text box below. The format requirements are:
- three columns only
- include a header of column names (Note: this has changed from previously when a header row was not required)
- first column: Period (a number or text label to describe each period, eg 2001, 2003...)
- second column: System sensitivity (between 0 and 1 - i.e. not as a percentage)
- third column: Risk of introduction of disease during each time period (between 0 and 1)
Outputs
Outputs are a table and plot of the following values:
- System sensitivity for each time period (input);
- Posterior confidence of freedom at the end of each time period;
- Probability of introduction during each time period (input);
- Prior probability of freedom for each time period (after adjusting for possible introduction during the period); and
- Equilibrium confidence of freedom - the stable maximum (or minimum) value for confidence of freedom for given SSe
and PIntro for each time period (see Watkins, et al., 2009. An evaluation of the sensitivity of acute flaccid paralysis surveillance for poliovirus infection in Australia. BMC Infectious Diseases, 9, 162).
Sample data is available on the Example tab or by clicking here.
No results
No example available
No references available
############################################################################### # script to do quick calculations from submitted SSe values ############################################################################### # uses RSurveillance package # cat("test") test<- ifelse(length(commandArgs()) < 3, TRUE, FALSE) fpath<- ifelse(test, "webRootUrl", "") # load header scripts source(paste(fpath, "R/epi_head.R", sep = "")) source(paste(fpath, "R/HTMLStream.R", sep = "")) source(paste(fpath, "R/epitools_functions.r", sep = "")) prior<- type.convert(a0[8]) # cat(prior) tmp.path<- paste(fpath, "tmp/", sep = "") # default file path r.path<- paste(fpath, "R/", sep = "") # filename<- a0[6] # default file name root filename<- digest(Sys.time) graph<- paste(tmp.path, filename, "_PFree_and_Prior.PFree_quick_calc.png", sep="") img.url<- paste(tmp.path, filename, "_PFree_and_Prior.PFree_quick_calc.png", sep="") sinkfile<- paste(tmp.path, filename, "_sink.txt", sep="") dat.file<- ifelse(test, paste(fpath, "docs/Freedom_Demo.txt", sep = ""), a0[length(a0)]) quick.data<- read.delim(dat.file, header = TRUE, sep=",") quick.data[is.na(quick.data[,2]),2]<- 0 quick.data[is.na(quick.data[,3]),3]<- 0 # tmp.path<- paste(fpath, "tmp/", sep = "") # tmp.file<- paste(fpath, "tmp/", filename, sep = "") digits<- 4 # number of digits in output summary dark.cols<- c("red", "darkblue", "darkgreen", "brown", "purple", "darkorange", "aquamarine4", "maroon4", "black", "salmon", "cyan4", "darkviolet") colour.list<- dark.cols periods<- nrow(quick.data) PFree<- numeric(periods) PFree.equil<- numeric(periods) Prior.Pfree<- numeric(periods) SSe<- quick.data[,2] P.Intro<- quick.data[,3] results<- pfree.calc(SSe, P.Intro, prior)[,-1] results<- round(results[,c(1, 4, 2, 3, 5)], digits) colnames(results)<- c("System Sensitivity", "Posterior confidence of freedom", "Probability of Introduction", "Prior confidence of freedom", "Equilibrium confidence of freedom") rownames(results)<- quick.data[,1] # graph results temp1<- array(0, dim = c(2, 2* periods)) for (p in 1:periods) { temp1[2, (p-1)*2 + 1]<- results[p, 4] temp1[2, (p-1)*2 + 2]<- results[p, 2] temp1[1, (p-1)*2 + 1]<- p temp1[1, (p-1)*2 + 2]<- p } # end of p loop title.text<- "PFree, Prior PFree and CSe for multiple time periods" # cat("
", sinkfile) sink(file = sinkfile, append = FALSE, type = c("output", "message")) # suppress output temporarily OpenGraphOutput(graph, pointsize = 12, ht = 6, wd = 8) plot(y = results[, 4], x = 1:periods, xaxt = "n", main = title.text, cex.main = 0.8, col = colour.list[4], ylim = c(0, 1), xlim = c(0.5, periods+0.5), xlab = "Period", ylab = "Probability", type = "p", pch = 4) for (i in c(1:3, 5)) { lines(y = results[, i], x = 1:periods, col = colour.list[i], pch = i, type = c("p", "o", "p", "p", "p")[i]) } # end of tr loop lines(y = temp1[2, ], x = temp1[1, ], col = colour.list[4], type = "l", lty = "dashed") axis(side = 1, at = 1:periods, labels = rownames(results)) legend("bottomright", legend = colnames(results), pch = 1:5, lwd = 1, cex = 0.6, col = colour.list, lty = c(0, 1, 0, 2, 0)) CloseGraphOutput("R") sink() # results # output to html output<- "Results of freedom calculation
\n" d1<- paste(substr(date(), 1, 10), substr(date(), 20,24), " @", substr(date(), 11, 16)) output<- paste(output, "Analysis completed: ", d1, "
\n", sep="") output<- paste(output, HTMLStream(results,Border = 0,classfirstline = "mbg", classfirstcolumn = "mbg", classcellinside = "left_mar", digits = digits, append = TRUE, align = "center", caption = "", captionalign = "", classcaption = "", classtable = "", cellalign = "center", cellborder = 0)) # output<- paste(output, "Summary graph
\n") output<- paste(output, "\n\n", sep = "") cat(output)