Adding fweights and aweights to numpy.corrcoef
![](https://secure.gravatar.com/avatar/46fdbc5786ab92700b3aa4452b458d69.jpg?s=120&d=mm&r=g)
Hello, Would it be possible to add the fweights and aweights keyword arguments from np.cov to np.corrcoef? They would retain their meaning from np.cov as frequency- or importance-based weightings respectively. Yours, Corin Hoad
![](https://secure.gravatar.com/avatar/ad13088a623822caf74e635a68a55eae.jpg?s=120&d=mm&r=g)
On Thu, Apr 26, 2018 at 11:59 AM, Sebastian Berg <sebastian@sipsolutions.net
wrote:
I seem to recall that there was a discussion on this and it was a lot trickier then expected.
But given that numpy has the weights already for cov, then I don't see any additional issues whith adding it also to corrcoef. corrcoef is just rescaling the cov, so there is nothing special to add except that corrcoef hands off the options to cov.
I think statsmodels might have options in this direction.
statsmodels still has only fweights (case weights) for covariance and correlation Josef
![](https://secure.gravatar.com/avatar/46fdbc5786ab92700b3aa4452b458d69.jpg?s=120&d=mm&r=g)
corrcoef is just rescaling the cov, so there is nothing special to add
except that corrcoef hands off the options to cov.
This was my understanding. I am currently just using my own copy of corrcoef which forwards the aweights and fweights arguments directly to np.cov. Is this the correct approach? Corin Hoad
![](https://secure.gravatar.com/avatar/ad13088a623822caf74e635a68a55eae.jpg?s=120&d=mm&r=g)
On Fri, May 11, 2018 at 7:43 AM, Corin Hoad <corinhoad@gmail.com> wrote:
No further thoughts from my side. I don't see a problem. Aside: And the degrees of freedom correction, which was one of the ambiguous issues in the cov case, will not matter in the corrcoef case because it cancels in the latter. Josef
![](https://secure.gravatar.com/avatar/ad13088a623822caf74e635a68a55eae.jpg?s=120&d=mm&r=g)
On Thu, Apr 26, 2018 at 11:59 AM, Sebastian Berg <sebastian@sipsolutions.net
wrote:
I seem to recall that there was a discussion on this and it was a lot trickier then expected.
But given that numpy has the weights already for cov, then I don't see any additional issues whith adding it also to corrcoef. corrcoef is just rescaling the cov, so there is nothing special to add except that corrcoef hands off the options to cov.
I think statsmodels might have options in this direction.
statsmodels still has only fweights (case weights) for covariance and correlation Josef
![](https://secure.gravatar.com/avatar/46fdbc5786ab92700b3aa4452b458d69.jpg?s=120&d=mm&r=g)
corrcoef is just rescaling the cov, so there is nothing special to add
except that corrcoef hands off the options to cov.
This was my understanding. I am currently just using my own copy of corrcoef which forwards the aweights and fweights arguments directly to np.cov. Is this the correct approach? Corin Hoad
![](https://secure.gravatar.com/avatar/ad13088a623822caf74e635a68a55eae.jpg?s=120&d=mm&r=g)
On Fri, May 11, 2018 at 7:43 AM, Corin Hoad <corinhoad@gmail.com> wrote:
No further thoughts from my side. I don't see a problem. Aside: And the degrees of freedom correction, which was one of the ambiguous issues in the cov case, will not matter in the corrcoef case because it cancels in the latter. Josef
participants (3)
-
Corin Hoad
-
josef.pktd@gmail.com
-
Sebastian Berg