'Returns -2 x log-likelihood ratio and  p-value for the
correlation coefficient between 2 variables
Parameters
corr0 : float
Hypothesized value to be tested
return_weights : bool
If true, returns the weights that maximize
the log-likelihood at the hypothesized value'

def test_corr(self, corr0, return_weights=0):

    nobs = self.nobs
    endog = self.endog
    if (endog.shape[1] != 2):
        raise Exception('Correlation    matrix    not    yet    implemented')
    nuis0 = np.array([endog[:, 0].mean(), endog[:, 0].var(), endog[:, 1].mean(), endog[:, 1].var()])
    x0 = np.zeros(5)
    weights0 = np.array(([(1.0 / nobs)] * int(nobs)))
    args = (corr0, endog, nobs, x0, weights0)
    llr = optimize.fmin(self._opt_correl, nuis0, args=args, full_output=1, disp=0)[1]
    p_val = chi2.sf(llr, 1)
    if return_weights:
        return (llr, p_val, self.new_weights.T)
    return (llr, p_val)
