4

I'm using a genetic algorithm to generate a string that produces certain results I map into a line/bar graph. I'm trying to rate how closely the results produced by the genetic string compares to a graph I have produce manually by hand.

Currently I am comparing the graphs be finding the area of difference between the two and getting a percentage representing where it sits between 0 difference and a worst case difference being where they don't overlap at all.

Though I don't feel this rating really represents how closely the shape matches the other. As this is what concerns me the most, as two different results could have the same difference in terms of area but one may be a closer shape then the other, and I would like the one with the closer shape to have a higher rating!

My question is, is there a standard way of rating graphs where i can get a percentage of how closely one matches the other and can you provide the way of going about this?

Tristan
  • 141
  • 2

1 Answers1

3

You question is very closely related to this question about differences between distributions.

Have a look at the three answers. That should give you some R code to get started.

BTW, I don't think your question is duplicate. It's a just a question that shares answers.

csgillespie
  • 11,849
  • 9
  • 56
  • 85
  • 1
    @csgillepsie: there is catch here. The answers about comparing distributions assume the draws from the distributions are iid. From the tone of the questions (.."mapped to line chart") this may not be the case in Tristan's application. That would invalidate all the solutions (k-s, chi-2,...) proposed. – user603 Oct 05 '10 at 13:26
  • @kwak: Very good spot and something that I missed. Just to clarify it invalidates the *k-s* and *chi-2* solutions, not all **all** the answers given, i.e. my answer and the answer by Joris still stand. – csgillespie Oct 05 '10 at 13:31
  • @kwak @csgillepsie: yeah just to clarify the data i'm dealing with is not iid at all. – Tristan Oct 05 '10 at 13:40