Allow computing the correlation matrix from the covariance matrix only
Following issue #652 in StatsBase.jl
Can you add tests?
Did you remove the tests on purpose?
Well, which tests? I didn’t add any tests to Statistics.jl yet. There where two tests that I added to StatsBase.jl in my PR, that failed for what are now obvious reasons.
On 23 Feb 2021, at 08:50, Milan Bouchet-Valat [email protected] wrote:
Did you remove the tests on purpose?
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/JuliaStats/StatsBase.jl/pull/661#issuecomment-784012184, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALJ5RCGRNYNRAPBFCV36FM3TANT3XANCNFSM4XWXW22A.
Hi there,
Looks like the method hasn't been implemented. I can't edit this PR. Can someone add the following code? (and is it sufficient?) Alternatively should I submit a separate PR?
In src/cov.jl
cov2cor!(C) = cov2cor!(C, [sqrt(C[i,i]) for i = 1:size(C, 1)])
cov2cor(C) = cov2cor!(copy(C))
In test/cov.jl
# Around line 126
@test cov2cor(cov1) ≈ cor1
@test cov2cor(cov2) ≈ cor2
# Around line 202
@test cov2cor(cov1) ≈ cor1
@test cov2cor(cov2) ≈ cor2
# Around line 209
StatsBase.cov2cor!(tmp_cov1)
@test tmp_cov1 ≈ cor1
# Around line 214
StatsBase.cov2cor!(tmp_cov2)
@test tmp_cov2 ≈ cor2
Please make a new PR, that's simpler.
Superseded by https://github.com/JuliaStats/StatsBase.jl/pull/816