# How to use derivatives of a function to better estimate its variance over the domain?

How to use derivatives of a function to better estimate its variance over the domain?

I have a scalar smooth function $$f(x)$$ and a multivariate random variable $$x$$ with known distribution (e.g. multivariate standard normal with large diagonal sigma). I know that the function f is very peaky in a sense that for majority of x'es its value rarely deviate from the mean, but on a small subset of x'es it attains extreme values. I need a finite sample estimate of the variance of this function over the domain of X. I can sample x, compute f(x) and use a standard formula, but it seems to be not very efficient since the domain of X is large and high dimensional (hundreds of dimensions) and I know that it is mostly constant.

Intuitively, if I encounter a region with low curvature and "close to the mean" value of f(x), I can "mark" it as "not interesting" and explore the rest of X.

Is there a formal way of doing this? Assume for simplicity that f is antisimmetric so f(x) = -f(-x) so we only need to look for maximas of x. One could probably do something like a variational approximation q such that x' ~ q(x'|x) maximizes expectation of f(x') while being not too far from the standard normal, but this way we have a significant chance of greatly underestimating the variance.

• I don't think I understand the question but it sounds like a direct application of the $\delta$-method. – AdamO Feb 14 at 19:25
• @AdamO it is indeed related and the Taylor expansions for the moments of functions of random variables seems even more related, but uses an estimate of gradients only at the mean of $X$. I wonder if there's a generalization that 1) uses gradients and values of a function at multiple points $\{x_1, \dots, x_n\}$ 2) says how to choose the next point $x_{n+1}$ to evaluate the gradient and the value of $f(x)$. – MInner Feb 14 at 20:33
• For example, if the function $f(x)$ is fairly flat near $x=0$ but has peaks around $x = \pm \frac{1}{2}$ then delta method would give a bad estimate of $var[f(X)]$ (or it's better to say that the remainder term would be non-negligible because $|| f^{(n)} ||_{\infty}$ are large for large $n$s). The question then is whether we can combine estimates of gradients and values from multiple points to get a better estimate of $var[f(X)]$ and how to choose these points. – MInner Feb 14 at 20:42

Apparently I was looking for a variant of a SGLD or some other MCMC algorithm that takes gradients into consideration to approximate expectation of a function $$f(x)$$ when $$x \sim P(x)$$. I am still not sure how to perform integration when $$f(x)$$ is complicated, but $$P(x)$$ is not, I will update the answer when I figure this out.