File tree Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -404,13 +404,16 @@ span(x) = ((a, b) = extrema(x); a:b)
404
404
405
405
# Variation coefficient: std / mean
406
406
"""
407
- variation(x, m=mean(x))
407
+ variation(x, m=mean(x); corrected=true )
408
408
409
409
Return the coefficient of variation of collection `x`, optionally specifying
410
- a precomputed mean `m`. The coefficient of variation is the ratio of the
411
- standard deviation to the mean.
410
+ a precomputed mean `m`, and the optional correction parameter `corrected`.
411
+ The coefficient of variation is the ratio of the
412
+ standard deviation to the mean. If `corrected` is `false`,
413
+ then `std` is calculated with denominator `n`. Else, the `std` is
414
+ calculated with denominator `n-1`.
412
415
"""
413
- variation (x, m) = stdm (x, m) / m
416
+ variation (x, m; corrected :: Bool = true ) = stdm (x, m; corrected = corrected ) / m
414
417
variation (x; corrected:: Bool = true ) = ((m, s) = mean_and_std (x; corrected= corrected); s/ m)
415
418
416
419
# Standard error of the mean: std / sqrt(len)
You can’t perform that action at this time.
0 commit comments