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
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
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
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