ppv <- function(x, sen, spec){
sen*x/(sen*x+(1-spec)*(1-x))
}
xxx <- seq(0,1,by = 0.01)
yyy <- ppv(xxx, .8, .8)
plot(xxx,yyy, type = "l", lwd = 5, col = "navy", xlab = "Prevalence", ylab = "Positive Predictive Value")
curve(ppv(x, .8, .7), 0, 1, lwd = 5, col = "red")
curve(ppv(x, .9, .9), add = TRUE, lwd = 5, col = "blue")
curve(ppv(x, .95, .95), add = TRUE, lwd = 5, col = "green")
curve(ppv(x, .99, .99), add = TRUE, lwd = 5, col = "purple")
legend("bottomright", legend = c("A","B","C","D"), col = c("red","blue","green","purple"), lwd = 5)