Displaying 1 result from an estimated 1 matches for "cidiff".
Did you mean:
cdiff
2024 Jan 18
0
Is there any design based two proportions z test?
...he
elementary result that the variance of the difference of two independent
random variables is the sum of their variances, plus the observation
that the width of the confidence interval is 2*z*SE, where z is the
normal quantile corresponding to the confidence level (e.g., 1.96 for a
95% CI).
ciDiff <- function(ci1, ci2, level=0.95){
p1 <- mean(ci1)
p2 <- mean(ci2)
z <- qnorm((1 - level)/2, lower.tail=FALSE)
se1 <- (ci1[2] - ci1[1])/(2*z)
se2 <- (ci2[2] - ci2[1])/(2*z)
seDiff <- sqrt(se1^2 + se2^2)
(p1 - p2) + c(-z, z)*seDiff
}
>
> Example: Pr...