Skip to content

cov(Vector,Vector,dims=1) fails #41680

@PaulSoderlind

Description

@PaulSoderlind

cov(rand(5),rand(5),dims=1) fails, while both cov(rand(5),rand(5)) and cov(rand(5),rand(5,1),dims=1) work.

Why bother? Well, to be consistent with the other functions in Statistics. For instance, std(rand(5),dims=1) gives a 1x1 vector. It is surely a convenience for users to be able to interchange Nx1 matrices and N-vectors in such basic calculations.

The quick fix is to add a dummy dims argument to the current method (in Statistics.jl) as cov(x::AbstractVector, y::AbstractVector; dims::Int=1, corrected::Bool=true) =. This would produce a Number. A better fix might be produce a 1x1 vector to be consistent with std and other functions.

Metadata

Metadata

Assignees

No one assigned

    Labels

    statisticsThe Statistics stdlib module

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions