FAQ/cafun - CBU statistics Wiki
location: FAQ / cafun

# R code from Chris Evans for computing confidence intervals for Cronbach's alpha

You need a value of alpha (obs.a), sample size (n), the number of items (k), length of confidence interval (ci) and the value under the null hypothesis (usually 0).

```feldt1.return <- function(obs.a, n, k, ci = 0.95, null.a = 0) {

if(obs.a > null.a)
f <- (1 - obs.a)/(1 - null.a)
else f <- (1 - null.a)/(1 - obs.a)
# allows for testing against a higher null
n.den <- (n - 1) * (k - 1)
n.num <- n - 1
null.p <- pf(f, n.num, n.den)
# set the upper and lower p values for the desired C.I.
p1 <- (1 - ci)/2
p2 <- ci + p1   # corresponding F values
f1 <- qf(p1, n.num, n.den)
f2 <- qf(p2, n.num, n.den)      # confidence interval
lwr <- 1 - (1 - obs.a) * f2
upr <- 1 - (1 - obs.a) * f1
cat(round(lwr,2), "to",round(upr,2),"\n")
interval <- list(lwr,upr)
return(interval)

} ```

`feldt1.return(0.913, 873, 20, 0.95, 0)`

gives

```0.9 to 0.92
[[1]]
[1] 0.9044024

[[2]]
[1] 0.9211588```

None: FAQ/cafun (last edited 2013-03-08 10:17:18 by localhost)