# Sensitivity and specificity of tests in series and parallel
series.parallel<- function(se, sp) {
# se is a vector of 2 or more sensitivity values to be combined in series and parallel
# sp is a vector of 2 or more specificity values to be combined in series and parallel
# returns a matrix of 4 values, sensitivity interpreted in series and parallel and
# specificity interpreted in series and parallel
se.series<- prod(se)
se.parallel<- 1 - prod(1-se)
sp.series<- 1 - prod(1 - sp)
sp.parallel<- prod(sp)
res<- matrix(c(se.series, se.parallel, sp.series, sp.parallel), nrow = 2, byrow = T)
colnames(res)<- c("Series", "Parallel")
rownames(res)<- c("Sensitivity", "Specificity")
return(res)
}