Piecewise linear interpolation with uncertainties

Click For Summary

Discussion Overview

The discussion revolves around the challenges of performing piecewise linear interpolation when both the dependent and independent variables have associated uncertainties. Participants explore how to handle cases where different pairs of independent variables yield the same dependent variable, raising concerns about the adequacy of standard interpolation methods in such scenarios.

Discussion Character

  • Exploratory
  • Technical explanation
  • Debate/contested

Main Points Raised

  • One participant inquires about methods for piecewise linear interpolation given uncertainties in both dependent and independent variables.
  • Another participant suggests that if specific knot locations are known, the problem simplifies to an optimization task, but if the number and location of knots are unknown, it complicates the process.
  • Clarification is provided on the concept of knots, defined as points where the piecewise function transitions between linear segments.
  • A participant emphasizes that the challenge increases in two dimensions, noting that determining the number and location of knots is complex and requires balancing predictive power against overfitting.
  • There is a distinction made between linear interpolation and linear regression, with the latter being described as more complex and potentially requiring specialized algorithms or packages.

Areas of Agreement / Disagreement

Participants express differing views on the complexity of the problem based on the known or unknown nature of knots, indicating that no consensus exists on a straightforward solution.

Contextual Notes

Participants acknowledge that the presence of uncertainties complicates the interpolation process, particularly when multiple independent variable pairs can yield the same dependent variable value. The discussion highlights the need for careful consideration of knot placement and the implications for model fitting.

Malamala
Messages
348
Reaction score
28
Hello! I have a function ##y = f(x_1,x_2)##, and I would like to do a piecewise linear interpolation. However, both the dependent (##y##) and independent variables (##x_1, x_2##) have uncertainties associated to them (the uncertainty is the same for a given variable i.e. all ##x_1## measurements will have the same uncertainty). How can I do piecewise linear interpolation in this case? I am mainly worried about cases where different ##(x_1, x_2)## will give the same ##y##, in which case normal piecewise linear interpolation would fail (or not?), but that is still physically correct, given that ##y## has some uncertainty. Is there an easy way to deal with uncertainties in this case? Thank you!
 
Physics news on Phys.org
If you have specific locations where you want to put the knots (where it transitions from one linear function to another) then it's just an optimization problem to find the best fit (plus maybe you want to apply some priors). If you don't know where the knots should go, or even worse how many you want, it becomes more complicated.

Which scenario are you in?
 
Office_Shredder said:
If you have specific locations where you want to put the knots (where it transitions from one linear function to another) then it's just an optimization problem to find the best fit (plus maybe you want to apply some priors). If you don't know where the knots should go, or even worse how many you want, it becomes more complicated.

Which scenario are you in?
What do you mean by knots?
 
Knots are your choice of x value where your piece wise function transitions between pieces - in your case, where you have a linear function in thy left, and one on the right, and they intersect at a certain x value.

Edit to add: for example if you knew you wanted to have a linear function in each of the four quadrants, then the problem would be greatly simplified
 
Last edited:
Office_Shredder said:
Knots are your choice of x value where your piece wise function transitions between pieces - in your case, where you have a linear function in thy left, and one on the right, and they intersect at a certain x value.

Edit to add: for example if you knew you wanted to have a linear function in each of the four quadrants, then the problem would be greatly simplified
In my case I can choose the ##(x_1,x_2)##, but I do have uncertainties on the values. Also the obtained value for the y can be the same for 2 different ##(x_1,x_2)## pairs. For example it might be that ##f(0,0) = f(0,0.1)## and I am not sure how to deal with that.
 
Sorry, I am not talking about the data, I'm talking about the best fit function.For example suppose you have y=|x| (function of one variable). This is a piecewise linear function with a knot at x=0.

If you have data of the form (x,y) and you want to fit a piecewise linear function, you could do something like say it has one knot at 0, and find the best combination of line before x=0 and line after x=0. This is an easy problem to solve. On the other hand you could say you know there is one knot, you just don't know where it is. This is also not hard to solve. What is really hard is if you say there are multiple knots of unknown number, and unknown location. If you don't actually believe your data is a piecewise linear function and are just trying to approximate a nonlinear function, this is probably the state you are in (from what you have posted so far I think this is probably what you're doing?)

Your situation is even harder, because the domain is 2 dimensions. An example of a piecewise linear function would be ##f(x_1,x_2)= |x_1| + |x_2| +|x_1+x_2 |## this has knots along the lines ##x_1=0##, ##x_2=0## and ##x_1+x_2=0##.

Picking where the knots go and how many of them there should be is a non trivial question that doesn't have a literal answer - it's a balance between making a model with more predictive power vs one that is overfit. That's why if you come in knowing what they should look like, you can get a significantly better answer.

I think the real point here is you don't want to do linear interpolation, which is easy, but linear regression, which is a lot harder. I'm not immediately sure if there is a package/algorithm that will just solve this problem for you, but I feel like there should be one. I'll look around a little more for it.
 
  • Like
Likes   Reactions: pbuk

Similar threads

  • · Replies 30 ·
2
Replies
30
Views
4K
  • · Replies 5 ·
Replies
5
Views
2K
  • · Replies 8 ·
Replies
8
Views
3K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 28 ·
Replies
28
Views
3K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 6 ·
Replies
6
Views
3K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 22 ·
Replies
22
Views
4K
  • · Replies 5 ·
Replies
5
Views
2K