# proportions of 40 and 30\%, 50 participants, how wide is the CI?
prec_riskdiff(p1 = .4, p2 = .3, n1 = 50)
# proportions of 40 and 30\%, 50 participants, how many participants for a CI 0.2 wide?
prec_riskdiff(p1 = .4, p2 = .3, conf.width = .2)
# Validate Newcombe (1998)
prec_riskdiff(p1 = 56/70, p2 = 48/80, n1 = 70, r = 70/80, met = "newcombe") # Table IIa
prec_riskdiff(p1 = 10/10, p2 = 0/10, n1 = 10, met = "newcombe") # Table IIh
# multiple scenarios
prec_riskdiff(p1 = c(56/70, 9/10, 6/7, 5/56),
p2 = c(48/80, 3/10, 2/7, 0/29),
n1 = c(70, 10, 7, 56),
r = c(70/80, 1, 1, 56/29),
method = "wald")
Run the code above in your browser using DataLab