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

Statistics.cor() should return a Vector, not a Transpose

Open kescobo opened this issue 4 years ago • 1 comments

Per discussion with @nalimilan on Slack, we think Statistics.cor(::Vector, ::Matrix) should return a Vector rather than a LinearAlgebra.Transpose. Current behavior on julia 1.2:

julia> using Statistics

julia> cor(rand(100), rand(100, 5))
1×5 LinearAlgebra.Transpose{Float64,Array{Float64,1}}:
 0.123675  -0.0318827  0.172277  -0.103357  0.0864288

julia> cor(rand(5), rand(100, 5), dims=2)
1×100 LinearAlgebra.Transpose{Float64,Array{Float64,1}}:
 -0.425112  -0.454156  0.391815  0.0705255  -0.0559532  …  -0.991978  0.834792  -0.493071  0.0664092

Here's the code for cor(), but it seems to call corm() which in turn calls corzm() which in turn calls cov2cor() or clamp_cor(), and that's where I stopped 😓.

kescobo avatar Sep 24 '19 20:09 kescobo