3

I have 3 visually similar graphs pictured below. They have similar peak patterns that are visible to the naked eye, but I want to compare their similarity mathematically.

I can sum each column to flatten the intensity present, giving you a line curve so the intensity need not be a factor necessarily.

I'm not sure what domain/strategy I should be looking at. I want to essentially measure the similarity of the curves, but since amplitude can vary to some extent, I'm not sure how that would be accounted for, and I'm frankly a bit out of my depths here and don't know exactly where to look.

Any help in direction would be most appreciated.

Picture of three similar graphs

Grant H.
  • 131
  • Noisy data? Interesting... Any suspected distribution? Could use some statistic test to check against it (or just against one of them assuming it is 100% correct)... – vonbrand Feb 05 '13 at 02:13
  • I don't think I'd actually call this off topic here, but it wouldn't surprise me if you'd get better results asking it at stats.stackexchange.com. – Micah Feb 05 '13 at 02:48
  • whats the graph of their differences look like? What is the way to measure how some function approximates another function? – jimjim Feb 05 '13 at 03:16

2 Answers2

2

Ultimately, you have to decide what you mean by "similar", but here are a couple of ideas.

Let's suppose we want to compare two functions $p(t)$ and $q(t)$. I'm assuming that these two functions are defined over the same range of values, so it makes sense to compare $p(t)$ with $q(t)$ for all values of $t$. Suppose you know the function values at $n$ points, $t_1,t_2, \dots, t_n$.

Spaces of functions have many different "metrics" (ways of measuring the distance between functions). For your purpose, a reasonable one might be the $\ell_2$ metric. This says that $$ distance(p,q) = \sqrt{ \sum_{i=1}^n (p(t_i) - q(t_i))^2 }$$

In some fields, this would be called the root-mean-square difference between the functions.

Before doing this measurement, you might want to "normalize" the function values in some way, if you care more about trends than actual function values. The basic technique is described here: http://en.wikipedia.org/wiki/Standard_score, and here: https://web.archive.org/web/20141220184825/https://www.d.umn.edu/~deoka001/Normalization.html

PeterJ
  • 105
bubba
  • 43,483
  • 3
  • 61
  • 122
1

I would subscribe to the answer given by the user bubba, however the correct formula is $$ distance(p,q) = \sqrt{\frac{1}{n}\sum_{i=1}^n(p(t_i)-q(t_i))^2}. $$

The reason for that is if you don't divide for the number of samples, you make this metric dependent of the number of samples, the more samples you have, the greater the distance, and you wouldn't want that, unless you guarantee the same number of samples for all distances you compute.