# # Confidence intervals for the sere; multiply the sere value by these # sereci <- function(sere, n, m, p=.95) { q <- (1-p)/2 df <- n*(m-1) x <- sere^2 *df excess <- x- df if (excess > 0) { tfun <- function(non, x, q) pchisq(x, df, ncp=non) -q lfit <- uniroot(tfun, c(0, excess), q=1-q, x=x) ufit <- uniroot(tfun, c(1,2)*excess, q=q, x=x) sqrt(1 + c(lfit$root, ufit$root) / df) } else c(0,0) }