ci.two.indep.props: Confidence interval for the difference of two independent...

Description Usage Arguments Value Author(s) References Examples

View source: R/ci_two_indep_props.R

Description

This function returns the confidence interval for the difference of two independent proportions. It can be used for statistical inference, i.e. we assume that two proportions are significantly different from each other if the confidence interval does not cover 0. See Newcombe (Method 10, 1998).

Usage

1
2
ci.two.indep.props(ci = NULL, a = NULL, m = NULL, b = NULL, n = NULL,
  p1 = NULL, l1 = NULL, u1 = NULL, p2 = NULL, l2 = NULL, u2 = NULL)

Arguments

ci

What confidence interval - give as a natural number (e.g. 95 for the 95% confidence interval). Only pass this argument when passing absolute frequencies (a, m , b, n); do not combine with proportions and confidence interval boundaries (in this case the confidence interval is implied in the boundaries from the passed intervals).

a

Frequency of events in proportion A

m

Total frequency in proportion A

b

Frequency of events in proportion B

n

Total frequency in proportion B

p1

Proportion 1 - a value between 0 and 1. Pass only if absolute frequencies (a, m , b, n) are not given.

l1

The lower bound of the confidence interval of p1.

u1

The upper bound of the confidence interval of p1.

p2

Proportion 2 - a value between 0 and 1. Pass only if absolute frequencies (a, m , b, n) are not given.

l2

The lower bound of the confidence interval of p2.

u2

The upper bound of the confidence interval of p2.

Value

A list containing the confidence interval boundaries

d

The difference between the proportions (a/m) - (b/n)

l

The lower bound of the confidence interval

u

The upper bound of the confidence interval

Author(s)

Martin Papenberg martin.papenberg@hhu.de

References

Newcombe, R. G. (1998). Interval estimation for the difference between independent proportions: comparison of eleven methods. Statistics in medicine, 17(8), 873-890.

Examples

1
2
3
4
5
6
7
8
# Examples from Newcombe (1998):
ci.two.indep.props(ci=95, a=56, m=70, b=48, n=80)
ci.two.indep.props(ci=95, a=9,  m=10, b=3,  n=10)

# Alternative usage:
p1 <- ci.one.prop(95, 56, 70)
p2 <- ci.one.prop(95, 48, 80)
ci.two.indep.props(p1=p1$p, p2=p2$p, l1=p1$l, l2=p2$l, u1=p1$u, u2=p2$u)

m-Py/propint documentation built on July 26, 2019, 8:47 a.m.