JuliaStats / Statistics.jl

The Statistics stdlib that ships with Julia.
https://juliastats.org/Statistics.jl/dev/
Other
72 stars 40 forks source link

Deprecate varm(v, m), stdm(v, m), covm(v, m) to var(v; μ = m), std(v; μ = m), cov(v; μ = m) #5

Open AzamatB opened 5 years ago

AzamatB commented 5 years ago

We currently export varm and stdm from Statistics stdlib. Since calculation of cov benefits from supplying mean as much as the calculation of var and std, I believe covm should be exported as well.

AzamatB commented 5 years ago

An even better suggestion was made on the slack channel. The proposal is to deprecate varm(v, m), stdm(v, m) and covm(v, m) to var(v; μ = m), std(v; μ = m) and cov(v; μ = m) respectively.

ararslan commented 5 years ago

Unicode should not be a required part of the API, so the keyword argument should be mean instead of µ, but otherwise I support that idea.

StefanKarpinski commented 5 years ago

For now, let's not deprecate, just add the mean keyword to var, std and cov. Leave a comment about deprecating varm, stdm and covm in Statistics 2.0.

jw3126 commented 5 years ago

It seems that there is already a mean keyword (for var, std at least. cov would need a pair of means.)

   _       _ _(_)_     |  Documentation: https://docs.julialang.org
  (_)     | (_) (_)    |
   _ _   _| |_  __ _   |  Type "?" for help, "]?" for Pkg help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 1.0.1 (2018-09-29)
 _/ |\__'_|_|_|\__'_|  |  Official https://julialang.org/ release
|__/                   |

julia> using Statistics; var(1:10,mean=5.5)
9.166666666666666
AzamatB commented 5 years ago

cov would need a vector of means.

jw3126 commented 5 years ago

Right, cov has many variants and each requires a different mean argument:

julia> cov(randn(10))  # mean number

julia> cov(randn(10),randn(10))  # mean pair

julia> cov(randn(10,10)) # mean vector