0

I have two different density plots in R- one of them is the observed data (x1), and the other is randomly generated data from a Poisson distribution with the observed mean (x2). I would like to approximate the curves, i.e. make the expected curve look more like the observed data as it is over and under-estimated in certain areas. How do I go about doing this? I know you can get the absolute value between the curves by using

abs (x1 - x2) 

However I'm not too sure how to proceed. Anybody have any ideas?

Gavin Simpson
  • 157,540
  • 25
  • 364
  • 424
clattenburg cake
  • 695
  • 2
  • 10
  • 20
  • 1
    Are you trying to find a new model (better than Poisson) to describe your observed data? This sounds like a better question for stats.stackexchange.com than Stackoverflow. One place you might want to start looking is at the *Kolmogorov-Smirnov test* and similar tests for comparing two distributions. – The Photon Sep 08 '12 at 16:12
  • Also, what does this question have to do with Newton's method? – The Photon Sep 08 '12 at 16:13
  • 1
    To tie this to R, you might also want to compare some candidate distributions to the observed data. To do this graphically is with a Q-Q plot. Some more info at http://www.r-bloggers.com/the-many-uses-of-q-q-plots/ – The Photon Sep 08 '12 at 16:20

1 Answers1

0

I think if you want to find an analytical solution, you might just have to play with the functions for a while. Otherwise, it seems that you could use calculus of variations to do this. That is, you take the difference between the area under both of your functions, and then minimize that (take the derivative). Formally, you need to take the second derivative to find if it's a max, min, or inflection point. However, you don't need to in this case if the function fits the data. I'm not sure what the best program would be for finding an analytical solution, but maybe that will put you on the right track. Just an idea to bounce around

Peter Klipfel
  • 4,441
  • 2
  • 25
  • 43