def monte_carlo_standard_error(chain, batch_size_generator=None, compute_method=None):
    """Compute Monte Carlo standard errors for the expectations

    This is a convenience function that calls the compute method for each batch size and returns the lowest ESS
    over the used batch sizes.

    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
    """
    batch_size_generator = batch_size_generator or SquareRootSingleBatch()
    compute_method = compute_method or BatchMeansMCSE()

    batch_sizes = batch_size_generator.get_univariate_ess_batch_sizes(len(chain))

    return np.min(list(compute_method.compute_standard_error(chain, b) for b in batch_sizes))
Compute Monte Carlo standard errors for the expectations

    This is a convenience function that calls the compute method for each batch size and returns the lowest ESS
    over the used batch sizes.

    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