'Function to allow using a numerical root-finder to reverse the
logistic transform.'

def _untransform_logistic(self, unconstrained, constrained):

    resid = np.zeros(unconstrained.shape, dtype=unconstrained.dtype)
    exp = np.exp(unconstrained)
    sum_exp = np.sum(exp)
    for i in range(len(unconstrained)):
        resid[i] = ((unconstrained[i] - np.log(((1 + sum_exp) - exp[i]))) + np.log(((1 / constrained[i]) - 1)))
    return resid
