Dear,

We are trying to determine the (one-sided) CI for the coefficient of
variation in a small sample (say n = 10), with mean 100 and standard
deviation 21.
It appears though that the R-function ci.cv() and our simulation do not
agree.

The R-code:

library(MBESS)

n = 10
ci.cv(mean = 100, sd = 21, n = 10, conf.level = 0.9)
U10.95 <- 0.3551754
ci.cv(mean = 100, sd = 21, n = 10, conf.level = 0.6)
U10.80 <- 0.2742255

cv.x <- c()
m10.95 <- c()
m10.80 <- c()

for(j in 1:10){
 for(i in 1:10000){
  X <- rnorm(n, 100, 21)
  cv.x[i] <- sd(X)/mean(X)
 }
 m10.95[j] <- mean(ifelse(cv.x > U10.95, 1, 0))
 m10.80[j] <- mean(ifelse(cv.x > U10.80, 1, 0))
}
m10.95
m10.80
> m10.95
 [1] 0.0034 0.0054 0.0049 0.0045 0.0045 0.0050 0.0039 0.0043 0.0057 0.0042
> m10.80
 [1] 0.0935 0.0966 0.0976 0.0961 0.0943 0.0915 0.0911 0.0938 0.0968 0.0868

These probabilities are much lower than the expected 5% and 20%.
Does anyone know where our mistake is?

Thanks a lot.

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to