View source: R/confIntProportion.R
confIntIndependentProportion | R Documentation |
Compute confidence interval for the risk difference of two independent samples based on individual Wilson intervals using Newcombe's method.
confIntIndependentProportion(x, n, conf.level = 0.95)
x |
Vector with two entries, the successes in the two groups. |
n |
Vector with two entries, the number of trials. |
conf.level |
Confidence level for confidence interval. |
A list with the entries:
p1 |
Estimated proportion in first sample. |
p2 |
Estimated proportion in second sample. |
d |
Estimated difference |
newcombeCI |
Confidence interval for the difference of independent proportions, computed according to Newcombe's method. |
waldCI |
Wald confidence interval for the difference of independent proportions. |
Leonhard Held
The Newcombe interval is introduced in
Newcombe, R.G. (1998). Interval estimation for the difference between independent proportions: Comparison of eleven methods. Stat. Med., 17, 873–890.
A worked out example can be found in
Altman, D.G., Machin, D., Bryant, T.N., Gardner, M.J. (2000). Statistics with confidence (p. 49). University Press Belfast.
confIntPairedProportion
, confIntProportion
,
fisher.test
, exact2x2
# Example from Significance (2010), 7(4), p. 146, "Untimely ripped ?"
n <- c(1515, 108000)
x <- c(0, 100)
confIntIndependentProportion(x = x, n = n)
# Fisher p-value
tab <- matrix(data = c(x, n - x), nrow = 2, ncol = 2)
fisher <- fisher.test(x = tab)
fisher$p.value
# exact tests
if(require("exact2x2")){
exact2x2(x = tab, tsmethod = "minlike")$p.value
exact2x2(x = tab, tsmethod = "central")$p.value
exact2x2(x = tab, tsmethod = "blaker")$p.value
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.