JuliaStats / StatsBase.jl

Basic statistics for Julia
Other
584 stars 194 forks source link

inconsistency with Statistics in the presence of missing #588

Open tbeason opened 4 years ago

tbeason commented 4 years ago

Right now, mean and std from Statistics return missing if the input has an element that is missing. skewness and kurtosis from this package error because their method signatures do not allow AbstractArray{Union{Missing,T},N} where {T<:Real,N}. This is further a problem because an array of that type is not even guaranteed to have any missing elements.

I propose to change the behavior so that the functions accept these arrays and propagate missing if necessary (either naturally or short circuited).

I would think that maybe this just needs to be changed in src/common.jl but am uncertain. If that is all that needs to happen, I can make the PR.

tbeason commented 4 years ago

After also reading #581 I think this issue could be better summarized as saying that in general the type signatures of most of the functions in StatsBase should be relaxed.

nalimilan commented 4 years ago

Yes many functions should be rewritten to accept any iterator.