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

mean_and_cov docstring inconsistent with signature

Open tpapp opened this issue 7 years ago • 2 comments

In cov.jl,

"""
    mean_and_cov(x, [wv::AbstractWeights]; vardim=1, corrected=false) -> (mean, cov)
Return the mean and covariance matrix as a tuple. A weighting
vector `wv` can be specified. `vardim` that designates whether
the variables are columns in the matrix (`1`) or rows (`2`).
Finally, bias correction is applied to the covariance calculation if
`corrected=true`. See [`cov`](@ref) documentation for more details.
"""

cf (note vardim):

function mean_and_cov(x::DenseMatrix, vardim::Int=1; corrected::Bool=true)
    m = mean(x, dims = vardim)
    return m, covm(x, m, vardim, corrected=corrected)
end
function mean_and_cov(x::DenseMatrix, wv::AbstractWeights, vardim::Int=1;
                      corrected::DepBool=nothing)
    m = mean(x, wv, vardim)
    return m, cov(x, wv, vardim; corrected=depcheck(:mean_and_cov, corrected))
end

tpapp avatar Aug 24 '18 13:08 tpapp

Also, replacing vardim with dim would be more consistent with Statistics.

tpapp avatar Aug 24 '18 13:08 tpapp

https://github.com/JuliaStats/StatsBase.jl/pull/407 fixes the docs, but I agree we should rename the argument and make it a keyword.

nalimilan avatar Sep 02 '18 14:09 nalimilan