Exemplo n.º 1
0
def r2(x, y):
    '''Calculate the Pearson correlation coefficient between the vectors x and y.'''
#    print x, y
#    print corrcoef(x, y)
    return corrcoef(x, y)[0][1] ** 2
Exemplo n.º 2
0
def r2(x, y):
    '''Calculate the Pearson correlation coefficient between the vectors x and y.'''
    has_data = (x >= 0) & (y >= 0)
    return corrcoef(x[has_data], y[has_data])[0][1] ** 2
Exemplo n.º 3
0
def r2(x, y):
    """Calculate the Pearson correlation coefficient between the vectors x and y using numpy."""
    has_data = (x >= 0) & (y >= 0)
    return corrcoef(x[has_data], y[has_data])[0][1] ** 2
Exemplo n.º 4
0
def r2(x, y):
    '''Calculate the Pearson correlation coefficient between the vectors x and y using numpy.'''
    has_data = (x >= 0) & (y >= 0)
    return corrcoef(x[has_data], y[has_data])[0][1]**2