def estimate_univariate_ess_standard_error(chain, batch_size_generator=None, compute_method=None):
    r"""Compute the univariate ESS using the standard error method.

    This computes the ESS using:

    .. math::

        ESS(X) = n * \frac{\lambda^{2}}{\sigma^{2}}

    Where :math:`\lambda` is the standard deviation of the chain and :math:`\sigma` is estimated using the monte carlo
    standard error (which in turn is, by default, estimated using a batch means estimator).

    Args:
        chain (ndarray): the Markov chain
        batch_size_generator (UniVariateESSBatchSizeGenerator): the method that generates that batch sizes
            we will use. Per default it uses the :class:`SquareRootSingleBatch` method.
        compute_method (ComputeMonteCarloStandardError): the method used to compute the standard error.
            By default we will use the :class:`BatchMeansMCSE` method

    Returns:
        float: the estimated ESS
    """
    sigma = (monte_carlo_standard_error(chain, batch_size_generator=batch_size_generator,
                                        compute_method=compute_method) ** 2 * len(chain))
    lambda_ = np.var(chain, dtype=np.float64)
    return len(chain) * (lambda_ / sigma)