Given two points (x1, y1) and (x2, y2), the linear interpolation at x (between x1 and x2) is y = (y1*(x2-x)+y2*(x-x1))/(x2-x1).
But when the two points are of different importance, this linear interpolation may not be ideal.
Suppose the weights of the two points are w1 and w2, a modification to the above linear interpolation may be y = (y1*w1*(x2-x)+y2*w2*(x-x1))/(w1*(x2-x)+w2*(x-x1)). I don't find a name to this interpolation. What is the name of this interpolation?
approxfun() in R is just linear interpolation. Does R have an implementation of the weighted interpolation that I described above?
EDIT: I am not sure if spline is relevant to this question. But I just add it as a tag in case it is relevant. If not, please remove it.
I mention spline, because I think there may be a way to expand the linear interpolation to spline so that different weights can be given to the input points. It also has the added benefit of making the fitted curve smooth. My above-proposed interpolation method may not be continuous at the 1st order derivative. But a spline should make the 1st order derivative continuous, which is good to have.
EDIT2: When the input data is monotone, my proposed rational interpolation should maintain the monotonousness (i.e., the input x_i < x_{i+1} and y_i < y_{i+1}, the output curve should have positive 1st order derivative). But a regular spline interpolation can not guarantee so. What spline interpolation can maintain the monotonousness? Is there an implementation that is read to use?
EDIT3: It seems that this implementation can maintain monotonicity. But it does not support weights. An implementation along this line but support weights could be helpful. Note that weights have an effect similar to that of the rational interpolation. In the rational interpolation above, if the weight is high at an input point, the slope should be greater than that if the weights of all points were equal.
Linear interpolation is equivalent to the trivial case of a first order spline. Weighing using a line does not make sense, because there is just one possible line between any two points. Therefore, it's the same interpolation line no matter on how you choose your weights. If you want to use a polynomial of a higher degree, there is indeed a e.g. weighted cubic spline interpolation emphasizing one point more than the other.