|Just another Perl shrine|
Re: Estimating continuous functionsby tilly (Archbishop)
|on Mar 30, 2004 at 03:16 UTC||Need Help??|
Several people have pointed out that this is a very hard problem to get right. There is no perfect answer, and tremendous amounts of energy has been spent on finding pretty good ones.
But nobody has given you a simple to implement "OK" answer. Not great. Just something that can readily be implemented which gives an answer that you can defend as somewhat reasonable. Depending on the application, this is often enough.
Here is an outline of one.
Let's say that the last variable a function of the rest, call it f. Make f(x_1, x_2, ... , x_(n-1)) into the weighted average of the known values of f at the points that you have. A reasonable weighting is that a point is weighted with weight 1/(square of distance from that point to the spot you're estimating). Then you can do it something like this (with some error checking added, of course...):
This works perfectly well. The resulting function is trivially smooth everywhere except at the estimating points, and I'm
Feel free to play with the weighting function.
Update: I verified it. The function is also smooth at the estimating points. Its derivative at all estimating points is 0 (ie each is a maxima, minima, or inflection point).