ng the integrand at different scrambled QMC points, effectively drawing i.i.d. random samples from the population of integral estimates. The sample mean :math:`m` of these integral estimates is an unbiased estimator of the true value of the integral, and the standard error of the mean :math:`s` of these estimates may be used to generate confidence intervals using the t distribution with ``n_estimates - 1`` degrees of freedom. Perhaps counter-intuitively, increasing `n_points` while keeping the total number of function evaluation points ``n_points * n_estimates`` fixed tends to reduce the actual error, whereas increasing `n_estimates` tends to decrease the error estimate. Examples -------- QMC quadrature is particularly useful for computing integrals in higher dimensions. An example integrand is the probability density function of a multivariate normal distribution. >>> import numpy as np >>> from scipy import stats >>> dim = 8 >>> mean = np.zeros(dim) >>> cov = np.eye(dim) >>> def func(x): ... # `multivariate_normal` expects the _last_ axis to correspond with ... # the dimensionality of the space, so `x` must be transposed ... return stats.multivariate_normal.pdf(x.T, mean, cov) To compute the integral over the unit hypercube: >>> from scipy.integrate import qmc_quad >>> a = np.zeros(dim) >>> b = np.ones(dim) >>> rng = np.random.default_rng() >>> qrng = stats.qmc.Halton(d=dim, seed=rng) >>> n_estimates = 8 >>> res = qmc_quad(func, a, b, n_estimates=n_estimates, qrng=qrng) >>> res.integral, res.standard_error (0.00018429555666024108, 1.0389431116001344e-07) A two-sided, 99% confidence interval for the integral may be estimated as: >>> t = stats.t(df=n_estimates-1, loc=res.integral, ... scale=res.standard_error) >>> t.interval(0.99) (0.0001839319802536469, 0.00018465913306683527) Indeed, the value reported by `scipy.stats.multivariate_normal` is within this range. >>> stats.multivariate_normal.cdf(b, mean, cov, lower_limit=a) 0.00018430867675187443 c