# What wrong i cov() in Julia 5.0?

**URL:** <https://discourse.julialang.org/t/what-wrong-i-cov-in-julia-5-0/2512>\
**Category:** General Usage\
**Created:** [March 7, 2017, 7:06am UTC](https://discourse.julialang.org/t/what-wrong-i-cov-in-julia-5-0/2512 "2017-03-07T07:06:21Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![programista](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/programista/32/5372_2.png) [@programista](https://discourse.julialang.org/u/programista)\
**Post date:** [March 7, 2017, 7:06am UTC](https://discourse.julialang.org/t/what-wrong-i-cov-in-julia-5-0/2512/1 "2017-03-07T07:06:21Z")

</div>

I am calling (Version 0.5.0 (2016-09-19 18:14 UTC) Official [http://julialang.org/](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

---

<div class="post-metadata">

**Author:** ![mkborregaard](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mkborregaard/32/556_2.png) [@mkborregaard](https://discourse.julialang.org/u/mkborregaard)\
**Post date:** [March 7, 2017, 1:05pm UTC](https://discourse.julialang.org/t/what-wrong-i-cov-in-julia-5-0/2512/2 "2017-03-07T13:05:54Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![dpsanders](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dpsanders/32/3573_2.png) [@dpsanders](https://discourse.julialang.org/u/dpsanders)\
**Post date:** [March 7, 2017, 1:50pm UTC](https://discourse.julialang.org/t/what-wrong-i-cov-in-julia-5-0/2512/3 "2017-03-07T13:50:18Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![programista](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/programista/32/5372_2.png) [@programista](https://discourse.julialang.org/u/programista)\
**Post date:** [March 8, 2017, 7:21am UTC](https://discourse.julialang.org/t/what-wrong-i-cov-in-julia-5-0/2512/4 "2017-03-08T07:21:57Z")

</div>

Hi Michael  
…realy, I was traying, below :

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

```

(_) | (_) (_) | Documentation: [http://docs.julialang.org](http://docs.julialang.org)  
\_ \_ | | \_\_ \_ | Type “?help” for help.  
| | | | | | |/ ` | |  
| | || | | | (_| | | Version 0.5.0 (2016-09-19 18:14 UTC)  
_/ |\ __‘_|_|_|\__ ’\_| | Official [http://julialang.org/](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:

---

<div class="post-metadata">

**Author:** ![mkborregaard](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mkborregaard/32/556_2.png) [@mkborregaard](https://discourse.julialang.org/u/mkborregaard)\
**Post date:** [March 8, 2017, 8:02am UTC](https://discourse.julialang.org/t/what-wrong-i-cov-in-julia-5-0/2512/5 "2017-03-08T08:02:06Z")

</div>

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

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

```

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

---

<div class="post-metadata">

**Author:** ![programista](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/programista/32/5372_2.png) [@programista](https://discourse.julialang.org/u/programista)\
**Post date:** [March 8, 2017, 8:13am UTC](https://discourse.julialang.org/t/what-wrong-i-cov-in-julia-5-0/2512/6 "2017-03-08T08:13:44Z")

</div>

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

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

---

<div class="post-metadata">

**Author:** ![mkborregaard](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mkborregaard/32/556_2.png) [@mkborregaard](https://discourse.julialang.org/u/mkborregaard)\
**Post date:** [March 8, 2017, 8:16am UTC](https://discourse.julialang.org/t/what-wrong-i-cov-in-julia-5-0/2512/7 "2017-03-08T08:16:08Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![programista](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/programista/32/5372_2.png) [@programista](https://discourse.julialang.org/u/programista)\
**Post date:** [March 8, 2017, 1:10pm UTC](https://discourse.julialang.org/t/what-wrong-i-cov-in-julia-5-0/2512/8 "2017-03-08T13:10:30Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![programista](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/programista/32/5372_2.png) [@programista](https://discourse.julialang.org/u/programista)\
**Post date:** [September 2, 2017, 9:21am UTC](https://discourse.julialang.org/t/what-wrong-i-cov-in-julia-5-0/2512/9 "2017-09-02T09:21:30Z")

</div>

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:
