MaaniBeigy / cvcqv

Coefficient of Variation (CV) and Coefficient of Quartile Variation (CQV) with Confidence Intervals (CI)
GNU General Public License v3.0
10 stars 3 forks source link

[Bug] McKay interval slightly incorrect? (Either in vignette or code) #3

Open bca2 opened 2 years ago

bca2 commented 2 years ago

The code for the McKay interval is:

else if ("mckay" %in% method && correction == FALSE) { v <- length(x) - 1 t1 <- stats::qchisq(1 - alpha/2, v)/v t2 <- stats::qchisq(alpha/2, v)/v u1 <- v t1 u2 <- v t2 est.mckay <- cv lower.tile.mckay <- cv/sqrt((u1/(v + 1) - 1) (cv^2) + u1/v) upper.tile.mckay <- cv/sqrt((u2/(v + 1) - 1) (cv^2) + u2/v) } else if ("mckay" %in% method && correction == TRUE) { v <- length(x) - 1 t1 <- stats::qchisq(1 - alpha/2, v)/v t2 <- stats::qchisq(alpha/2, v)/v u1 <- v t1 u2 <- v t2 est.mckay <- cv_corr lower.tile.mckay <- cv_corr/sqrt((u1/(v + 1) - 1) (cv_corr^2) + u1/v) upper.tile.mckay <- cv_corr/sqrt((u2/(v + 1) - 1) (cv_corr^2) + u2/v) } Note that we have (v + 1) instead of (v) as it is in the vignette. Which is correct?

Thanks!

Edit: Your package has been very helpful, thank you very much.