Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inconsistencies in cov with missing values #69

Open
yurivish opened this issue Jan 23, 2021 · 1 comment · May be fixed by #171
Open

Inconsistencies in cov with missing values #69

yurivish opened this issue Jan 23, 2021 · 1 comment · May be fixed by #171

Comments

@yurivish
Copy link

I noticed that cov sometimes handles missing values and sometimes does not.

julia> cov(rand([1.0, missing], 3))
missing

julia> cov(rand([1.0, missing], 3, 3))
ERROR: MethodError: no method matching copy(::Missing)
Closest candidates are:
  copy(::Pkg.Resolve.Graph) at /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.5/Pkg/src/Resolve/graphtype.jl:367
  copy(::LinearAlgebra.Transpose{Bool,BitArray{2}}) at /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.5/LinearAlgebra/src/bitarray.jl:226
  copy(::Expr) at expr.jl:35
  ...
Stacktrace:
 [1] matmul3x3!(::Array{Missing,2}, ::Char, ::Char, ::Array{Missing,2}, ::Array{Missing,2}, ::LinearAlgebra.MulAddMul{true,true,Bool,Bool}) at /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.5/LinearAlgebra/src/matmul.jl:971
 [2] generic_matmatmul!(::Array{Missing,2}, ::Char, ::Char, ::Array{Missing,2}, ::Array{Missing,2}, ::LinearAlgebra.MulAddMul{true,true,Bool,Bool}) at /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.5/LinearAlgebra/src/matmul.jl:726
 [3] mul! at /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.5/LinearAlgebra/src/matmul.jl:391 [inlined]
 [4] mul! at /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.5/LinearAlgebra/src/matmul.jl:208 [inlined]
 [5] * at /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.5/LinearAlgebra/src/matmul.jl:153 [inlined]
 [6] unscaled_covzm(::Array{Missing,2}, ::Int64) at /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.5/Statistics/src/Statistics.jl:508
 [7] covzm(::Array{Missing,2}, ::Int64; corrected::Bool) at /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.5/Statistics/src/Statistics.jl:522
 [8] covm(::Array{Union{Missing, Float64},2}, ::Array{Union{Missing, Float64},2}, ::Int64; corrected::Bool) at /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.5/Statistics/src/Statistics.jl:545
 [9] cov(::Array{Union{Missing, Float64},2}; dims::Int64, corrected::Bool) at /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.5/Statistics/src/Statistics.jl:568
 [10] cov(::Array{Union{Missing, Float64},2}) at /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.5/Statistics/src/Statistics.jl:568
 [11] top-level scope at REPL[7]:1

julia> cov(rand(3, 3))
3×3 Array{Float64,2}:
  0.0915287   -0.00275245  0.0168019
 -0.00275245   0.00455733  0.00010187
  0.0168019    0.00010187  0.00316671

This is with Julia v1.5.3:

julia> versioninfo()
Julia Version 1.5.3
Commit 788b2c77c1 (2020-11-09 13:37 UTC)
Platform Info:
  OS: macOS (x86_64-apple-darwin18.7.0)
  CPU: Intel(R) Core(TM) i9-9980HK CPU @ 2.40GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-9.0.1 (ORCJIT, skylake)
@nalimilan
Copy link
Member

@mbauman mbauman linked a pull request Aug 27, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants