# Finding out whether or not two graphs are “close”, given 20 points on each graph whose Xs do not match

Let's assume we have two graphs where:

1. Each graph has 600 points per minute.
2. We're allowed to get only one point per minute.
3. We do not get the same point per minute in both graphs. So for example, in a given minute, for graph A we'll have the 20th point and for graph B the 517th point.
4. In each minute the measurements we get are of different xTH measurement. So once it can be 20th and 517th, the next minute may be 51st and 212th.
5. 99% of the time, the graphs should be fairly close (that is, if we had all the points, the difference between the Y values should be fairly low).
6. Generally, these graphs are not very erratic. So you'd expect a chance of probably a fraction of a percent between two measurements and over the course of a minute no more than X% (where X is probably 20 or 30 or so). However, over the course of a day, they can go from 0 to 1.2 million and back.

I need some algorithm that within 20 minutes of the graphs straying away from one another, I know that they have done so. Where straying away needs to be defined as well (as a percentage probably). I'm allowed to keep only 60 minutes worth of measurements, which means 60 measurements per graph, including the 20 in which I need to identify the problem.

-
Both current tags seem wrong. –  Did Mar 25 '12 at 14:29
You need to be more specific, the problem is too ambiguous and there is no concrete question. Especially "straying away needs to be defined" does not help, i.e. I could define straying as a condition that never happens and the trivial algorithm would do perfectly. If I were to guess what might help you, I would consider your graphs as a signal with noise, filter it somehow and then apply some measure, like sums of squares of differences. Also, as Didier Piau said, tags (probability) and (correlation) seem wrong. –  dtldarek Mar 25 '12 at 20:10
@DidierPiau What tags would you suggest? –  Yon Mar 26 '12 at 13:48
@dtldarek Well, we're looking to define the straying away as a certain percentage of the size of one of the two graphs. What do you mean regarding handling this as a signal with noise? Where's the noise here? –  Yon Mar 26 '12 at 13:49
If for every minute you were to take the average, then it would still be, as you put it, "fairly close" (depending on the distribution it may be much closer, but for sure it won't be worse). If you pick a sample from this one-minute interval, it varies from the average by something and this variation could be treated as a noise. –  dtldarek Mar 26 '12 at 18:14