ci_prop_diff_wald {cicalc} | R Documentation |
Wald Confidence Interval for Difference in Proportions
Description
Calculates the Wald interval by following the usual textbook definition for a difference in proportions confidence interval using the normal approximation.
Usage
ci_prop_diff_wald(x, by, conf.level = 0.95, correct = FALSE, data = NULL)
Arguments
x |
( |
by |
( |
conf.level |
( |
correct |
( |
data |
( |
Details
(\hat{p}_1 - \hat{p}_2) \pm z_{\alpha/2}
\sqrt{\frac{\hat{p}_1(1 - \hat{p}_1)}{n_1}+\frac{\hat{p}_2(1 - \hat{p}_2)}{n_2}}
Value
An object containing the following components:
n |
Number of responses in each by group |
N |
Total number in each by group |
estimate |
The point estimate of the difference in proportions (p_1 - p_2) |
conf.low |
Lower bound of the confidence interval |
conf.high |
Upper bound of the confidence interval |
conf.level |
The confidence level used |
method |
Type of method used |
Examples
responses <- expand(c(9, 3), c(10, 10))
arm <- rep(c("treat", "control"), times = c(10, 10))
# Calculate 95% confidence interval for difference in proportions
ci_prop_diff_wald(x = responses, by = arm)