Finding an interval by curve fitting

103 Views Asked by At

Suppose I have a function like the one in this graph:

A function which is sine-like on an interval, and noisy samples thereof

I have samples $x_i,y_i$ from this function, with some Gaussian noise (like the black points).

The function behaves, in some interval $[a,b]$, like $\sin(x)$ (indeed it equals $\sin(x)$ in $[0,4\pi]$, but that's not the point).

Question

Given the samples $x_i,y_i$, how can I numerically determine the interval on which the function behaves like $\sin(x)$?

Context

I'm not really looking to fit a function that locally behaves like $\sin(x)$, that's just an example, but I do have data that behaves in a well-understood way only in an unknown interval. I seek a way to find this interval, ideally with as few assumptions as possible on what happens outside of the interval. (the function is continuous and remains continuous even outside the interval)

One approach would be to construct some measure of fitting quality, perhaps the total square error $/(b-a)$, and minimize it over all possible $a,b$. In my experience this type of approach introduces a bias towards very short intervals, on which the curve just happens to be unusually well-behaved. They do not find the whole interval.