3
$\begingroup$

I have an unknown 'smooth' function that is sampled at some $n$ equally spaced locations $x_i$ between $0$ and $1$, with some measurement values $f(x_i)=y_i$, but each has some Gaussian uncertainty ($(\sigma_y)_i$). I am interested in the integral $I=\int f\; \mathrm{d}x$.

One way to get it is to use a Riemann sum, which would yield $I=\frac{1}{N}\sum_i x_i$. (Or if the errors are different, the sum should be weighted.) But Riemann integration just assumes a piecewise function which is not a good approximation if there is some curvature in the function.

Another way would be to use a higher order method, for example Simpson's rule. These are higher order, but have worse behaviour with large uncertainties: if one measurement is off, the quadratic interpolation would be much more wrong than a linear interpolation, and hence the integral of the quadratic interpolation would be worse than the integral of the linear interpolation.

So there seems to be a tradeoff: if there are high uncertainties, use lower-order methods, and if the uncertainties are low, use higher order methods. But how to choose? What would be the best way of estimating $I$ (and its uncertainty)?

One way would be to parametrize the 'smooth function', estimate the parameters and calculate the integral of the parametrization. But then, if there is not an obvious model, what parametrization should I use? (And what priors on the parameters?)

$\endgroup$
2
  • $\begingroup$ Do you have data (x,y) that you can plot or is this just a general function? Are you wanting to perform the integration over limits or do you want the general solution? $\endgroup$
    – jcken
    Jun 5, 2020 at 20:34
  • $\begingroup$ I have data points (x,y), know nothing about the function, except that it should be smooth. I want to know the integral of the function that generates the data points y=f(x). I forgot to mention, the integral is between 0 and 1, ie the extent of the data points x. Of course you can always renormalize your data this way. $\endgroup$
    – Ewoud
    Jun 5, 2020 at 20:52

1 Answer 1

3
$\begingroup$

I think what you need is the smoothing spline. You'd be minimizing the following functional by looking for a function $\hat f(x)$: $$ \sum_{i=1}^n \{y_i - \hat f(x_i)\}^2 + \lambda \int \hat f''(x)^2 \,dx. $$ Once you got the function, integrating it is yrivial for cubic or other polynomial splines.

There a similar technique called Kernel density estimation. Here you approximate your function with a chosen kernel:
$$ \widehat{f}_h(x) = \frac{1}{n}\sum_{i=1}^n K_h (x - x_i) = \frac{1}{nh} \sum_{i=1}^n K\Big(\frac{x-x_i}{h}\Big), $$ Again, once you have a Kernel, integrating it is trivial.

Neither of these techniques use the distribution of errors directly, i.e. you don't need them to be Gaussian.

$\endgroup$
1
  • 1
    $\begingroup$ Thanks, very interesting, I will read a bit more on these techniques. To estimate the final error on the integral, I suppose I should use some kind of bootstrap method? $\endgroup$
    – Ewoud
    Jun 5, 2020 at 21:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.