What wrong i cov() in Julia 5.0?

I am calling (Version 0.5.0 (2016-09-19 18:14 UTC) Official http://julialang.org/ releasex86_64-w64-mingw32)
cov according to the documentation: What wrong ? Set D is clear …

julia> cov(D,vardim=1, corrected=false )
WARNING: cov(X::AbstractMatrix; vardim=1,corrected=true,mean=Base.mean(X,vardim)) is deprecated, use Base.covm(X,mean,va
rdim,corrected) instead.
in depwarn(::String, ::Symbol) at .\deprecated.jl:64
in #cov#978(::Int64, ::Bool, ::Array{Float64,2}, ::Function, ::Array{Float64,2}) at .\deprecated.jl:50
in (::Base.#kw##cov)(::Array{Any,1}, ::Base.#cov, ::Array{Float64,2}) at .<missing>:0
in eval(::Module, ::Any) at .\boot.jl:234
in eval_user_input(::Any, ::Base.REPL.REPLBackend) at .\REPL.jl:64
in macro expansion at .\REPL.jl:95 [inlined]
in (::Base.REPL.##3#4{Base.REPL.REPLBackend})() at .\event.jl:68
while loading no file, in expression starting on line 0
4×4 Array{Float64,2}:
417.622 28.4 -0.346275 8.51173
28.4 268.643 -3.79816 -1.80744
-0.346275 -3.79816 80.4539 53.7528
8.51173 -1.80744 53.7528 643.906

julia> cor(D)
4×4 Array{Float64,2}:
1.0 0.0847888 -0.00188911 0.016414
0.0847888 1.0 -0.0258352 -0.00434574
-0.00188911 -0.0258352 1.0 0.236165
0.016414 -0.00434574 0.236165 1.0

julia> eltype(D)
Float64

julia> typeof(D)
Array{Float64,2}
julia> std(D,1)
1×4 Array{Float64,2}:
20.4393 16.3932 8.97116 25.3797

julia> sum(D[:,:].==0,1)
1×4 Array{Int64,2}:
2605 2647 2840 2370
Paul

What is the question? The warning tells you that you cov is deprecated and you should use covm instead. Have you tried that?

Please always do the following when posting questions to this forum:

  • Quote your code (highlight the code and press the </> button)

  • Provide a minimum working example, including example data, so that the code you write can be directly run by people who are trying to answer your question.

1 Like

Hi Michael
…realy, I was traying, below :

_       _ _(_)_     |  A fresh approach to technical computing

() | () () | Documentation: http://docs.julialang.org
_ _ | | __ _ | Type “?help” for help.
| | | | | | |/ ` | |
| | |
| | | | (
| | | Version 0.5.0 (2016-09-19 18:14 UTC)
/ |_|||_’_| | Official http://julialang.org/ release
|__/ | x86_64-w64-mingw32

julia> D=readcsv(“v4dane.txt”)
2888×4 Array{Float64,2}:
0.0 0.0 0.0 0.0
0.0 0.0 0.0 0.0
?
0.0 0.0 0.0 0.0

julia> cov(D,vardim=1, corrected=false )
WARNING: cov(X::AbstractMatrix;
vardim=1,corrected=true,mean=Base.mean(X,vardim)) is deprecated, use
Base.covm(X,mean,va
rdim,corrected) instead.
in depwarn(::String, ::Symbol) at .\deprecated.jl:64
in #cov#978(::Int64, ::Bool, ::Array{Float64,2}, ::Function,
::Array{Float64,2}) at .\deprecated.jl:50
in (::Base.#kw##cov)(::Array{Any,1}, ::Base.#cov, ::Array{Float64,2})
at .<missing>:0
in eval(::Module, ::Any) at .\boot.jl:234
in eval_user_input(::Any, ::Base.REPL.REPLBackend) at .\REPL.jl:64
in macro expansion at .\REPL.jl:95 [inlined]
in (::Base.REPL.##3#4{Base.REPL.REPLBackend})() at .\event.jl:68
while loading no file, in expression starting on line 0
4×4 Array{Float64,2}:
417.622 28.4 -0.346275 8.51173
28.4 268.643 -3.79816 -1.80744
-0.346275 -3.79816 80.4539 53.7528
8.51173 -1.80744 53.7528 643.906

julia> covm(D,vardim=1, corrected=false )
ERROR: UndefVarError: covm not defined

julia> covm (D,vardim=1, corrected=false )
ERROR: syntax: space before “(” not allowed in “covm (”

julia> covm(D,vardim=1, corrected=false )
ERROR: UndefVarError: covm not defined

julia>
Paul
W dniu 2017-03-07 o 14:09, Michael Krabbe Borregaard pisze:

You need to specify the covm function is from Base, and it takes positional arguments rather than keyword ones.

Base.covm(D, mean(D,1), 1, false)

No idea why the recommendation is to use an unexported function, though.

1 year I am working on thi instalation , freqentyly using cov(D) and
somthig cheges …:confused:
Do reinstalation Julia 5.0 ?
Paul

W dniu 2017-03-08 o 09:05, Michael Krabbe Borregaard pisze:

No, just use the Base.covm function. Julia is in development and sometimes that will break your code.

Shure, no problem , bu it is closed Version 0.5.0 (2016-09-19 18:14 UTC) :wink:
Paul
W dniu 2017-03-08 o 09:19, Michael Krabbe Borregaard pisze:

In the Manula to 6.0 is :
cov(X[, vardim=1, corrected=true ])
Compute the covariance matrix of the matrix X along the dimension
vardim. If corrected is true (the
default) then the sum is scaled with n-1, whereas the sum is scaled with
n if corrected is false where n
= size(X, vardim).

Why

cov(D,corrected=true)
WARNING: cov(X::AbstractMatrix;
vardim=1,corrected=true,mean=Base.mean(X,vardim)
) is deprecated, use Base.covm(X,mean,vardim,corrected) instead.
in depwarn(::String, ::Symbol) at .\deprecated.jl:64
in #cov#998(::Int64, ::Bool, ::Array{Float64,2}, ::Function,
::Array{Float64,2}
) at .\deprecated.jl:50
in (::Base.#kw##cov)(::Array{Any,1}, ::Base.#cov, ::Array{Float64,2})
at .<mis
:0
in eval(::Module, ::Any) at .\boot.jl:234
in eval_user_input(::Any, ::Base.REPL.REPLBackend) at .\REPL.jl:64
in macro expansion at .\REPL.jl:95 [inlined]
in (::Base.REPL.##3#4{Base.REPL.REPLBackend})() at .\event.jl:68
while loading no file, in expression starting on line 0
10×10 Array{Float64,2}:
0.123759 -0.0680205 -0.0293552 -0.0052548 0.105579
-0.0680205 0.138386 0.0212064 -0.0304422 -0.07015
-0.0293552 0.0212064 0.0622987 0.0529633 -0.03157
0.00382906 -0.0195504 -0.00955722 -0.00101196 0.0230252
0.0439962 0.00127207 0.00534568 0.0217044 0.0458677
-0.0389666 0.0778515 0.0241258 0.0042428 -0.0556463
0.0685963 -0.0630225 -0.0636463 -0.0138854 0.069267
-0.0284455 0.0407073 -0.000548658 -0.0211063 -0.0481892
-0.0052548 -0.0304422 0.0529633 0.101551 -0.00128557
0.105579 -0.07015 -0.03157 -0.00128557 0.106575
?
Paweł

W dniu 2017-03-08 o 09:05, Michael Krabbe Borregaard pisze: