-
Notifications
You must be signed in to change notification settings - Fork 191
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
cov(x, w::AbstractWeights) dispatches on cov(X, Y) fallback #409
Comments
var
and cov
give inconsistent values for weighted variance in Julia >= 0.6
The apparent inconsistency between The inconsistency with the |
var
and cov
give inconsistent values for weighted variance in Julia >= 0.6
A bit tangential, but ideally I'd like to see weights specified as a keyword argument. That would require defining it in the Statistics stdlib package though. |
Actually I don't think there's a bug here: |
@nalimilan : Yes I can confirm (X.-mean(X,w,1))' * ((Y.-mean(Y,w,1)) .* w) / sum(w) |
It is at least a big issue that this fails silently now, I just ran into it as well. Since |
Will be fixed by JuliaLang/julia#31395. |
Is the above pull request a remedy for this issue too, or is is a different issue?
The |
That's semi-related AFAICT. The method for weighted covariance doesn't support views, so it dispatches to the method which interprets weights as a second vector. If this issue was fixed you'd get an error, which is better, but still not great. To fix the deeper issue, you'd have to change |
Let for example
Then the statement
is true, however the weighted variance of the two functions are (very) different, i.e.
is false.
Also the interface to
cov
(as well asvar
andmean
) seems incoherent: if weight is passed it won't take the keyword argumentdims
:The text was updated successfully, but these errors were encountered: