My Math Forum  

Go Back   My Math Forum > Math Forums > Math

Math General Math Forum - For general math related discussion and news


Thanks Tree1Thanks
  • 1 Post By DarnItJimImAnEngineer
Reply
 
LinkBack Thread Tools Display Modes
October 9th, 2019, 05:23 AM   #1
Newbie
 
Joined: Oct 2019
From: Tabriz

Posts: 3
Thanks: 0

Fitting line to data

I want to fit two lines to the data in the attached image; one line from the top and one line from the bottom. Like what you see in the attachment. What is the best way to do this? Is there any software that can do this?

1111.jpg

thank you for your attention
RHassanpour is offline  
 
October 9th, 2019, 05:41 AM   #2
Senior Member
 
Joined: Jun 2019
From: USA

Posts: 310
Thanks: 162

It depends on what you want the lines to represent.
This kind of resembles the confidence interval of the curve fit (also known as the Scheffé band), although unless you set the confidence level extremely high, it would be a much tighter fit than that.

You could also estimate a precision interval of the curve fit using the same technique.

In both of these cases, you would start by curve-fitting the data (which you can do in Excel) and then calculating the standard error of the fit (which you can also do in Excel.

I don't know if this is what you want, though.
DarnItJimImAnEngineer is online now  
October 9th, 2019, 06:03 AM   #3
Newbie
 
Joined: Oct 2019
From: Tabriz

Posts: 3
Thanks: 0

Thanks for answering,
What I need here is the slope and intercept of the two upper and lower lines. As far as I know, in Excel, only one line fits into the data.
RHassanpour is offline  
October 9th, 2019, 06:04 AM   #4
Senior Member
 
Joined: Oct 2009

Posts: 884
Thanks: 340

Quote:
Originally Posted by RHassanpour View Post
Thanks for answering,
What I need here is the slope and intercept of the two upper and lower lines. As far as I know, in Excel, only one line fits into the data.
Yes, but the red curves are not straight lines if you look at it. So you can't get a slope and intercept.

Try quantile regression for what you want.

Last edited by skipjack; October 9th, 2019 at 09:04 AM.
Micrm@ss is offline  
October 9th, 2019, 06:32 AM   #5
Senior Member
 
Joined: Jun 2019
From: USA

Posts: 310
Thanks: 162

Quote:
Originally Posted by Micrm@ss View Post
Yes, but the red curves are not straight lines if you look at it. So you can't get a slope an intercept.
That's not even the problem. Polynomial, exponential, etc. regressions are totally possible; even a linear regression would get you some kind of estimate.

The problem is, regressions try to fit the data set (as a whole). OP is trying to fit the upper limit and lower limit of the data set. There is no simple or unique way to define this.

Does quantile regression address this somehow? (I'm honestly not familiar with the concept, and couldn't follow the Wikipedia article at first glance.)
DarnItJimImAnEngineer is online now  
October 9th, 2019, 07:25 AM   #6
Senior Member
 
Joined: Oct 2009

Posts: 884
Thanks: 340

Quote:
Originally Posted by DarnItJimImAnEngineer View Post
That's not even the problem. Polynomial, exponential, etc. regressions are totally possible; even a linear regression would get you some kind of estimate.
That was totally not my remark. Please read it more carefully.
Micrm@ss is offline  
October 9th, 2019, 08:06 AM   #7
Senior Member
 
Joined: Jun 2019
From: USA

Posts: 310
Thanks: 162

Quote:
Originally Posted by Micrm@ss View Post
That was totally not my remark. Please read it more carefully.
No, I know. He was asking how to get the slope and intercept of a curve, and you were pointing out neither curve was a straight line and therefore neither had a singular slope or intercept. I got that.

I was skipping ahead and responding to the next question. OP might have asked, "If we make it a straight line instead, how can we find the slope and intercept?" Or, "If we model it as a quadratic equation, how can we get the coefficients of the quadratic equation?" Except the only good way I saw to do that was with some kind of regression, and linear/polynomial/exponential/etc. regression tries to fit the entire data set. We would need to select some form of "edge detection" algorithm to select points to represent the upper boundary and the lower boundary, and curve fit each of these. This, of course, begs the definition of what constitutes an "edge point."

And that's kind of why I was asking what the lines were supposed to represent in the first place. Is OP looking for something like, "draw a curve that will contains 95 % of the data points from an infinite set?" Because we can do this with some assumptions about the probability distribution. Or do they just want a curve that looks somewhat like the general shape we discern as humans? Because in that case, I'd just grab a French curve, pick three points, and trace it.

(And seriously, if quantile regression does what they want, then I have egg on my face. I still don't understand what it is or does.)
Thanks from RHassanpour
DarnItJimImAnEngineer is online now  
October 9th, 2019, 08:36 AM   #8
Newbie
 
Joined: Oct 2019
From: Tabriz

Posts: 3
Thanks: 0

Thanks for your valuable comments,
As I mentioned above, I need the slope and intercept of the upper limit and lower limit of the data set in both linear and nonlinear fitting. My question was, is there any particular software or method to do this or should it be done manually? The red lines drawn do not matter.
RHassanpour is offline  
Reply

  My Math Forum > Math Forums > Math

Tags
data, fitting, line



Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Fitting Linear and Quadratic Functions to Data d423 Pre-Calculus 2 October 1st, 2018 09:41 PM
Multidimensional fitting of two sets of data datameng Linear Algebra 2 September 3rd, 2014 05:30 AM
Two data sets fitting Simon39 Abstract Algebra 4 November 29th, 2013 09:41 PM
Deviation of coefficients of line fitting bloons Advanced Statistics 1 October 26th, 2010 04:14 AM
simple data fitting problem dimper129 Linear Algebra 0 October 7th, 2009 07:01 AM





Copyright © 2019 My Math Forum. All rights reserved.