agrestiCoullPhat: Agresti-Coull adjustment to binomial proportion

Description Usage Arguments Details Value Author(s) References See Also Examples

View source: R/agrestiCoullPhat.r

Description

Applies the Agresti and Coull (1998) adjustment to an observed number of 'successes' out of a number of 'trials'.

Usage

1
agrestiCoullPhat(x, n, conf = 0.9)

Arguments

x

The number of 'successes' (an integer vector)

n

The number of 'trials' (an integer vector)

conf

Confidence interval level (a scalar between 0.5 and 1)

Details

The Agresti-Coull adjusted point estimate of a binomial proportion is,

phat = (x+(z^2)/2) / (n+z^2)

where z is the (1-(1-conf)/2) quantile of a standard normal distribution. This point estimator was actually proposed by Brown et al. (2001) but named for Agresti and Coull because the latter discussed performance of the confidence interval under the special case of conf = 0.95 (i.e., z = 1.96).

The estimated standard error of the Agresti-Coull adjusted proportion is,

se = sqrt( phat*(1-phat) / (n+z^2)).

The Agresti-Coull confidence interval is,

phat +- z*se.

The Agresti-Coull confidence interval has excellent coverage for ratios between approximately 2 interval coverage is too high (i.e., coverage exceeds conf substantially). The Agresti-Coull point estimator is biased high except when true p = 0.5. Simulations by the author of this routine suggest bias in the point estimate is <10 0.15 and 0.85. For ratios between 0 and 0.02 (and 0.98 and 1), bias in the point estimate can exceed 100 ratios so percent bias is sensitive to small changes. The author of this routine is not aware of any studies of the variance estimator.

Value

A data frame containing the Agresti-Coull adjusted proportion, standard error, and confidence limits. The data frame has the following columns:

  1. phat : the Agresti-Coull adjusted point estimates.

  2. se.phat : the Agresti-Coull estimated standard error of the point estimates phat.

  3. ll.phat : the lower limit of a 100*(1-(1-conf)/2) confidence interval for phat.

  4. ul.phat : the upper limit of a 100*(1-(1-conf)/2) confidence interval for phat.

Author(s)

Trent McDonald

References

Agresti, A. and B. A. Coull. 1998. Approximate is Better than "Exact" for Interval Estimation of Binomial Proportions. The American Statistician 52: 119:126.

Brown, L. D., T. T. Cai, and A. DasGupta. 2001. Interval Estimation for a Binomial Proportion. Statistical Science 16:101-133.

See Also

bayesPhat

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
agrestiCoullPhat(0:5, 100)

# Simulation: point est bias and ci coverage
trueP <- 0.01
n <- 1000
x <- rbinom( 1000, n, trueP)
agPhat <- agrestiCoullPhat( x, n )
muAG <- mean(agPhat$phat)
covAG <- mean(agPhat$ll.phat <= trueP & trueP <= agPhat$ul.phat)
agStats <- c(mean=muAG,
             relBias = abs(muAG-trueP)/trueP),
             coverage = covAG)

tmcd82070/evoab documentation built on May 13, 2020, 11:25 p.m.