Skip to content

cov(x, w::AbstractWeights) dispatches on cov(X, Y) fallback #409

@yanncalec

Description

@yanncalec

Let for example

x=1:100
w=StatsBase.weights(rand(100))

Then the statement

StatsBase.var(x)==StatsBase.cov(x)

is true, however the weighted variance of the two functions are (very) different, i.e.

StatsBase.var(x, w)==StatsBase.cov(x, w)

is false.

Also the interface to cov (as well as var and mean) seems incoherent: if weight is passed it won't take the keyword argument dims:

X=rand(100,10)
StatBase.cov(X, dims=1) # this works
StatBase.cov(X, w, 1) # this works also
StatBase.cov(X, w, dims=1) # this fails

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions