[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: weighted pearson correlation coefficient
From: |
Jordi Gutiérrez Hermoso |
Subject: |
Re: weighted pearson correlation coefficient |
Date: |
Thu, 10 Nov 2011 10:04:56 -0500 |
On 10 November 2011 07:56, Christoph Peters <address@hidden> wrote:
> Hej,
Hola
> I have 15 vectors each containing 20 values and I would like to
> calculate the pearson correlation coefficient for them, but not each
> of the 20 values has the same importance so I would like to give a
> weight for each of them. Is there an easy way to do that using build
> in functions?
Is it just a simple matter of multiplying each row of the matrix by
some weight before you execute corrcoef on the result? If so, this can
be done by broadcasting, best explained in this Numpy document (just
skim down to the diagrams):
http://www.scipy.org/EricsBroadcastingDoc
In Octave, broadcasting is currently accomplished with bsxfun:
bsxfun (@times, some_matrix, some_column_vector)
This will multiply each *row* of the matrix by the values in
some_column_vector.
HTH,
- Jordi G. H.