简体   繁体   English

逼近R中的两条不同曲线

[英]Approximating two different curves in R

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). 我在R中有两个不同的密度图-其中一个是观察到的数据(x1),另一个是从泊松分布中观察到的平均值(x2)随机生成的数据。 I would like to approximate the curves, ie 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? 有人有什么想法吗?

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 只是一个想法反弹

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM