Statistics.jl icon indicating copy to clipboard operation
Statistics.jl copied to clipboard

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

Open AzamatB opened this issue 7 years ago • 6 comments

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 avatar Nov 24 '18 20:11 AzamatB

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.

AzamatB avatar Nov 25 '18 01:11 AzamatB

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.

ararslan avatar Nov 25 '18 19:11 ararslan

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.

StefanKarpinski avatar Nov 26 '18 22:11 StefanKarpinski

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

jw3126 avatar Dec 08 '18 19:12 jw3126

cov would need a vector of means.

AzamatB avatar Dec 08 '18 20:12 AzamatB

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

jw3126 avatar Dec 08 '18 20:12 jw3126