'Returns - 2 x log-likelihood ratio, p-value and weights
for a hypothesis test of the mean.
Parameters
mu0 : float
Mean value to be tested
return_weights : bool
If return_weights is True the funtion returns
the weights of the observations under the null hypothesis.
Default is False
Returns
test_results : tuple
The log-likelihood ratio and p-value of mu0'

def test_mean(self, mu0, return_weights=False):

    self.mu0 = mu0
    endog = self.endog
    nobs = self.nobs
    eta_min = ((1.0 - (1.0 / nobs)) / (self.mu0 - max(endog)))
    eta_max = ((1.0 - (1.0 / nobs)) / (self.mu0 - min(endog)))
    eta_star = optimize.brentq(self._find_eta, eta_min, eta_max)
    new_weights = (((1.0 / nobs) * 1.0) / (1.0 + (eta_star * (endog - self.mu0))))
    llr = ((-2) * np.sum(np.log((nobs * new_weights))))
    if return_weights:
        return (llr, chi2.sf(llr, 1), new_weights)
    else:
        return (llr, chi2.sf(llr, 1))
