confIntIndependentProportion: Compute confidence interval for the risk difference of two...

Description Usage Arguments Value Author(s) References Examples

Description

Compute confidence interval for the risk difference of two independent samples based on individual Wilson intervals using Newcombe's method.

Usage

1
confIntIndependentProportion(x, n, conf.level = 0.95)

Arguments

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.

Value

A list with the entries:

p1

Estimated proportion in first sample.

p2

Estimated proportion in second sample.

d

Estimated difference p_1 - p_2 of proportions.

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.

Author(s)

Leonhard Held

References

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.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
# Example from Significance (2010), 7(4), p. 146, "Untimely ripped ?"
n <- c(1515, 108000)
x <- c(0, 100)
confIntIndependentProportion(x, n)

# Fisher p-values
t <- matrix(c(x, n - x), nrow = 2, ncol = 2)
f.t <- fisher.test(t)
f.t$p.value

## Not run: 
# exact test
library("exact2x2")
exact2x2(t, tsmethod = "minlike")$p.value
exact2x2(t, tsmethod = "central")$p.value
exact2x2(t, tsmethod = "blaker")$p.value

## End(Not run)

biostatUZH documentation built on May 2, 2019, 6:06 p.m.