-
Notifications
You must be signed in to change notification settings - Fork 195
Open
Description
Thanks to #316, quantile now ignores elements with a 0 weight. I wonder if the same would make sense for other functions, particularly mean and std. Currently
julia> using StatsBase
julia> w = Weights([0, 1, 1]);
julia> x = [Inf, 1, 1];
julia> mean(x, w)
NaN
julia> std(x, w, corrected = false)
NaN
julia> quantile(x, w, [0.5])
1-element Array{Float64,1}:
1.0My motivation for this is working with data where I am calculating statistics of some x ./ y, weighted by y. When y == 0, the ratio is nonsensical, but at the same time weighting should make it irrelevant. Instead, now the NaN propagates.
This is nothing I cannot work around, it would just make my workflow more convenient.
Metadata
Metadata
Assignees
Labels
No labels