Seppe
☆

Belgium,
2018-03-19 12:58
(2020 d 14:14 ago)

Posting: # 18574
Views: 2,853

## 95% CI of CV [General Sta­tis­tics]

Hi

I have a problem with calculating the 95%CI of the CV
I have an example but i don't now how they get the result of the 95%CI.

Example:

1. 3,8
2. 3,9
3. 3,9
4. 3,8
5. 4,1
6. 4,0
7. 3,4
8. 3,6
9. 3,8
10.3,7

Mean= 3,8
SD= 0,2
CV= 5,3
95%CI (3,6;9,7)

How do you get the interval of 3,6;9,7 from the CV?
The only thing I know that it's not a normal distribution

Greetz
mittyri
★★

Russia,
2018-03-21 12:35
(2018 d 14:38 ago)

@ Seppe
Posting: # 18576
Views: 2,242

## 95% CI of CV

Hi Seppe,

cannot get exactly the same (assuming normal distribution)
 confint.cv <- function(x,alpha=.05, method="modmckay"){   # Calculate the confidence interval of the cv of the vector x   # Author: Kevin Wright   # See: Vangel, Mark.  Confidence Intervals for a Normal Coefficient   # of Variation. American Statistician, Vol 15, No1, p. 21--26.   # x <- c(326,302,307,299,329)   # confint.cv(x,.05,"modmckay")     x <- na.omit(x)   v <- length(x)-1   mu <- mean(x)   sigma <- sqrt(var(x))   k <- sigma/mu   # CV > .33 may give poor results, so warn the user   if(k>.33) warning("Confidence interval may be very approximate.")     method <- casefold(method) # In case we see "McKay"     if(method=="mckay"){     # McKay method.  See equation 15.     t1 <- qchisq(1-alpha/2,v)/v     t2 <- qchisq(alpha/2,v)/v     u1 <- v*t1     u2 <- v*t2     lower <- k/sqrt(( u1/(v+1) -1)*k*k + u1/v)     upper <- k/sqrt(( u2/(v+1) -1)*k*k + u2/v)   } else if (method=="naive"){     # Naive method.  See equation 17.     t1 <- qchisq(1-alpha/2,v)/v     t2 <- qchisq(alpha/2,v)/v     lower <- k/sqrt(t1)     upper <- k/sqrt(t2)   } else {     # Modified McKay method. See equation 16.     method="modmckay"     u1 <- qchisq(1-alpha/2,v)     u2 <- qchisq(alpha/2,v)     lower <- k/sqrt(( (u1+2)/(v+1) -1)*k*k + u1/v)     upper <- k/sqrt(( (u2+2)/(v+1) -1)*k*k + u2/v)   }   ci <- cbind.data.frame(method = method, lower=lower,upper=upper, CV= k, alpha=alpha)   return(ci) } x=c(3.8,3.9,3.9,3.8,4.1,4.0,3.4,3.6,3.8,3.7) results <- rbind(confint.cv(x), confint.cv(x, method = "mckay"), confint.cv(x, method = "naive")) print(results)

gives
    method      lower      upper         CV alpha 1 modmckay 0.03617573 0.09632067 0.05263158  0.05 2    mckay 0.03618047 0.09641016 0.05263158  0.05 3    naive 0.03620185 0.09608475 0.05263158  0.05

Kind regards,
Mittyri