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

fix handling of Missing in cor #74

Merged
merged 8 commits into from
Feb 19, 2021
Merged

Conversation

bkamins
Copy link
Contributor

@bkamins bkamins commented Feb 13, 2021

No description provided.

@codecov
Copy link

codecov bot commented Feb 13, 2021

Codecov Report

Merging #74 (fad50b7) into master (862798b) will increase coverage by 97.67%.
The diff coverage is 100.00%.

Impacted file tree graph

@@             Coverage Diff             @@
##           master      #74       +/-   ##
===========================================
+ Coverage    0.00%   97.67%   +97.67%     
===========================================
  Files           1        1               
  Lines         387      387               
===========================================
+ Hits            0      378      +378     
+ Misses        387        9      -378     
Impacted Files Coverage Δ
src/Statistics.jl 97.67% <100.00%> (+97.67%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 862798b...fad50b7. Read the comment docs.

src/Statistics.jl Outdated Show resolved Hide resolved
src/Statistics.jl Outdated Show resolved Hide resolved
src/Statistics.jl Outdated Show resolved Hide resolved
src/Statistics.jl Outdated Show resolved Hide resolved
src/Statistics.jl Outdated Show resolved Hide resolved
src/Statistics.jl Outdated Show resolved Hide resolved
src/Statistics.jl Outdated Show resolved Hide resolved
@bkamins
Copy link
Contributor Author

bkamins commented Feb 14, 2021

So a tension in this PR that we have:

julia> using Statistics

julia> z = [1.0, im]
2-element Vector{ComplexF64}:
 1.0 + 0.0im
 0.0 + 1.0im

julia> var(z)
1.0

julia> cov(z, z)
1.0 + 0.0im

and we have a tension that the identity var(z) === cov(z, z) does not hold. But probably we should accept it.

@nalimilan
Copy link
Member

Yeah, but AFAICT that's an expected result since the variance is guaranteed to be a real number, contrary to the covariance:
https://en.wikipedia.org/wiki/Complex_random_variable#Variance_and_pseudo-variance
https://selipot.github.io/talks/lecture2.pdf

Anyway var(z) == cov(z, z) holds so that's already quite consistent.

src/Statistics.jl Outdated Show resolved Hide resolved
@bkamins
Copy link
Contributor Author

bkamins commented Feb 14, 2021

an expected result since the variance is guaranteed to be a real number

Yes - that is why I said we should accept it.

Was this actually needed for CI to pass?

Ah - I added it to make the tests pass on 1.0. I will remove it

src/Statistics.jl Outdated Show resolved Hide resolved
@nalimilan nalimilan merged commit fadeeee into JuliaStats:master Feb 19, 2021
@bkamins bkamins deleted the patch-2 branch February 19, 2021 10:41
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 this pull request may close these issues.

2 participants