File tree Expand file tree Collapse file tree 2 files changed +3
-1
lines changed Expand file tree Collapse file tree 2 files changed +3
-1
lines changed Original file line number Diff line number Diff line change @@ -411,7 +411,7 @@ a precomputed mean `m`. The coefficient of variation is the ratio of the
411
411
standard deviation to the mean.
412
412
"""
413
413
variation (x, m) = stdm (x, m) / m
414
- variation (x) = ((m, s) = mean_and_std (x); s/ m)
414
+ variation (x; corrected :: Bool = true ) = ((m, s) = mean_and_std (x; corrected = corrected ); s/ m)
415
415
416
416
# Standard error of the mean: std / sqrt(len)
417
417
# Code taken from var in the Statistics stdlib module
Original file line number Diff line number Diff line change @@ -164,6 +164,8 @@ z2 = [8. 2. 3. 1.; 24. 10. -1. -1.; 20. 12. 1. -2.]
164
164
165
165
@test variation ([1 : 5 ;]) ≈ 0.527046276694730
166
166
@test variation (skipmissing ([missing ; 1 : 5 ; missing ])) ≈ 0.527046276694730
167
+ @test isnan (variation (a))
168
+ @test variation (1 ; corrected = false ) == 0
167
169
168
170
@test @inferred (sem ([1 : 5 ;])) ≈ 0.707106781186548
169
171
@test @inferred (sem (skipmissing ([missing ; 1 : 5 ; missing ]))) ≈ 0.707106781186548
You can’t perform that action at this time.
0 commit comments