Sigma Plot, Non-linear regression, fitting a line to a set of points

In summary, In SigmaPlot, it is not possible to force an inverse logistic function curve through a known point at a known slope, while fitting the the curve.
  • #1
dwwhite5150
5
0
I model arterial baroreflex data that I have collected in humans using the Kent equation which is:
y=p1/(1+exp((x-p3)*p2))+p4; where Y=heart rate, X= estimated carotid sinus pressure, p1=range of Y, p2=slope coeff, p3=centerpoint on X, p4 = minimum Y.

I use Sigma Plot to do a best fit line on the points I have collected. The points are actually in six groups of 3 with one point which is the operating point. out of all of those points, the only one i know the gain at for sure is the single operating point.

What I would like to know is: Is there any way to force the best fit line through a point which I have the coordinates and a gain that the line should have while passing through that point.

Attached is a test file graph that explains my problem. the line fits the points with r^2 =0.966 but it does not go through the point (95,70) at a gain of -0.54, which is the only point and gain which is constant. Anybody know how to force fit the line to the point in Sigma Plot?

X Y
175.0000 58.0000 p1= 21.6905
179.0000 59.0000 p2= 0.1047
174.0000 62.0000 p3= 91.5081
155.0000 59.0000 p4= 59.9046
150.0000 57.0000
158.0000 62.0000
135.0000 62.0000
136.0000 63.0000
137.0000 60.0000
114.0000 63.0000
115.0000 59.0000
116.0000 60.0000
95.0000 70.0000
75.0000 78.0000
75.0000 77.0000
74.0000 79.0000
55.0000 83.0000
53.0000 80.0000
59.0000 81.0000
 

Attachments

  • test curve.png
    test curve.png
    13 KB · Views: 1,311
Physics news on Phys.org
  • #2
I suppose with gain you mean the slope?
First note that it is not possible to estimate p2 and p3 independently from the data but only the product p5= p2*exp(-p3).
Then when you know dy/dx at some point you can solve this equation for e.g. p1 and eliminate it from the equation which relates y to x, p1, p4 and p5.
 
  • #3
DrDu,
thank you for the reply, I guess what I am really asking is, "In SigmaPlot, Does anybody know how to force an inverse logistic function curve through a known point at a known slope, while fitting the the curve?" the reason I ask is that through manipulation of blood pressure, I get a heart rate response that falls along a curve identified by the equation above, but the only point for which i can calculate the slope is at steady state resting because i have hundreds of small interactions between BP and HR which allow for the dY/dX. the rest of the curve is built with 18 other data points. Just wish I could figure out the syntax for forcing a line through a point at a slope.
 
  • #4
I think I understood your question, although I am not sure whether you understood the solution I was proposing.
I don't know Sigmaplot, but I don't think that's relevant. What you want to do is to find a solution which obeys an auxiliary condition, namely that it's slope at a given point has a given value.
I recommended to include this information explicitly in the equation by elimination of one of the parameters before doing the optimization.
Another method would be to use the technique of Lagrangian multipliers. maybe something of this kind is implemented directly in Sigmaplot.
 
  • #5
DrDu,

You are probably correct in the assumption that I cannot visualize the solution you have given in my mind. Mathematically you suggestions are probably spot on and I will search the SigmaPlot manuals for Lagrangian multipliers and I will also try to eliminate a variable in the equation. As you probably know, some of these statistics programs are touchy and without full knowledge of the syntax, even something as simple in the mind as "Hey, go through this point at this slope while fitting the line," becomes terribly difficult.

If you happen to run across the syntax solution to force fit a line, let me know. Even if you find it in some other computer program, it can probably be translated to SigmaPlot.

Again, thank you for all of your insight, it has given me tons to consider for future data analysis. If I use your suggestions, I will include you in the acknowledgments section of my dissertation and any other publications that come.
 
  • #6
DrDu said:
I think I understood your question, although I am not sure whether you understood the solution I was proposing.
I don't know Sigmaplot, but I don't think that's relevant. What you want to do is to find a solution which obeys an auxiliary condition, namely that it's slope at a given point has a given value.
I recommended to include this information explicitly in the equation by elimination of one of the parameters before doing the optimization.
Another method would be to use the technique of Lagrangian multipliers. maybe something of this kind is implemented directly in Sigmaplot.

So far as I know, this cannot be done in Sigmaplot.
 
  • #7
Add this as your constraint by setting RHS to -0.54 at x=95:

St8vYzH.gif
 
  • #8
Actually the slope and pass-through-point constraint give you two independant eq. in (p1, p2, p3, p4).

Using algebra, can't you restate the model in just 2 variable and then use the fit function?

Do you see what I mean?

The algebra seems a bit messy for the slope constraint though.

i.e.

p4=70-p1/(1+exp((95-p3)*p2))

and

p1={ 0.54*[exp(p2*p3)+exp(p2*95)]^2 } / {p2 * exp(p2*(p3 + 95)) }

So now fit in SigmaPlot the following fn but only for p2 and p3.

y=[{ 0.54*[exp(p2*p3)+exp(p2*95)]^2 } / {p2 * exp(p2*(p3 + 95)) }]/(1+exp((x-p3)*p2))+70-p1/(1+exp((95-p3)*p2))

Messy, but you put the constraints on and not me. :)
 
Last edited:
  • #9
rollingstein,

thanks for the reply. I tried putting the solution that you gave as a constraint but i got an error message. I am assuming that it is a parenthetical problem so i put it into excel and the slope I get back while putting in the parameters 1.6*10^-74. It is probably something that I did wrong. you seem to have some experience with sigmaplot. how would you type the equation into the constraint section?
 
  • #10
dwwhite5150 said:
rollingstein,

thanks for the reply. I tried putting the solution that you gave as a constraint but i got an error message. I am assuming that it is a parenthetical problem so i put it into excel and the slope I get back while putting in the parameters 1.6*10^-74. It is probably something that I did wrong. you seem to have some experience with sigmaplot. how would you type the equation into the constraint section?

Its likely I did an algebra blunder. Verify my rearrangements.
 
  • #11
The red line looks right?

qoxSAo8l.jpg


Larger image here:

http://i.imgur.com/qoxSAo8.jpg

Verification:

predict(fit1,list(x=95))
[1] 70

(predict(fit1,list(x=96))-predict(fit1,list(x=94)))/(96-94)
[1] -0.5395504

PS. I used R instead; didn't have Sigmaplot handy.
 
Last edited:
  • #12
rollingstein said:
Its likely I did an algebra blunder. Verify my rearrangements.


It was a mistake. Left a p1 unsubstituted.

Try fitting this in Sigmaplot for p2 and p3.:

y=(( 0.54*(exp(p2*p3)+exp(p2*95))^2 ) / (p2 * exp(p2*(p3 + 95)) ))/(1+exp((x-p3)*p2))+70-(( 0.54*(exp(p2*p3)+exp(p2*95))^2 ) / (p2 * exp(p2*(p3 + 95)) ))/(1+exp((95-p3)*p2))
 
  • #13
Rollingstein,

That's pretty awesome, still can't get sigmaplot to accept the equations as fitting constraints. also I have to make the equations dynamic because p1, p2, p3, p4, OP(x,y), m(OP) change for every subject. OP is the operating point for which I have the point and slope. I have sent in a request to systat for them to make "force fitting a line" a drop down option in the regression wizard. Thanks for all the work you have put into this. I will keep trying to finesse the equations into existence but it may be a never-ending struggle with SigmaPlot.

Thanks a lot dude
 
  • #14
dwwhite5150 said:
Rollingstein,

That's pretty awesome, still can't get sigmaplot to accept the equations as fitting constraints. also I have to make the equations dynamic because p1, p2, p3, p4, OP(x,y), m(OP) change for every subject. OP is the operating point for which I have the point and slope. I have sent in a request to systat for them to make "force fitting a line" a drop down option in the regression wizard. Thanks for all the work you have put into this. I will keep trying to finesse the equations into existence but it may be a never-ending struggle with SigmaPlot.

Thanks a lot dude

Sure. It was an interesting problem; hence my motivation. :)


Try R:

Code:
fit<-nls(y~p1/(1+exp((x-p3)*p2))+p4,start=list(p1=20,p2=0.1,p3=90,p4=50))
 summary(fit)

  plot(x,y)
  
  tt<-seq(60,180,length=100)
  
  lines(tt, predict(fit,list(x=tt)))
  
  
fit1<-nls(y~(( 0.54*(exp(p2*p3)+exp(p2*95))^2 ) / (p2 * exp(p2*(p3 + 95)) ))/(1+exp((x-p3)*p2))+70-(( 0.54*(exp(p2*p3)+exp(p2*95))^2 ) / (p2 * exp(p2*(p3 + 95)) ))/(1+exp((95-p3)*p2)),start=list(p2=0.1,p3=90))

lines(tt, predict(fit1,list(x=tt)),col=34)

predict(fit1,list(x=95))
[1] 70

(predict(fit1,list(x=96))-predict(fit1,list(x=94)))/(96-94)
[1] -0.5395504
 
  • #15
dwwhite5150 said:
Rollingstein,

also I have to make the equations dynamic because p1, p2, p3, p4, OP(x,y), m(OP) change for every subject. OP is the operating point for which I have the point and slope.


I think the current formulation is pretty dynamic. Just replace 95 by x_OP,70 by y_OP and -0.54 by s_OP

The rest should be the same.

I'm telling you, it'll be a breeze in R. :biggrin:

PS. I'm no R loyalist. I believe in whatever works. Had tried Python on your problem at first but didn't get far.
 

FAQ: Sigma Plot, Non-linear regression, fitting a line to a set of points

1. What is Sigma Plot?

Sigma Plot is a data analysis and graphing software used by scientists and researchers to visually represent and analyze their data.

2. What is non-linear regression?

Non-linear regression is a statistical method used to analyze data that does not follow a linear trend. It involves fitting a curve or line to a set of data points in order to estimate the relationship between the variables.

3. How does non-linear regression differ from linear regression?

Linear regression assumes a linear relationship between the variables, while non-linear regression allows for a more complex relationship between the variables. Non-linear regression is often used when the data does not fit a straight line.

4. What is the purpose of fitting a line to a set of points?

Fitting a line to a set of points allows us to visualize the relationship between the variables and make predictions based on the data. It also helps to identify any patterns or trends in the data.

5. How does Sigma Plot help with fitting a line to a set of points?

Sigma Plot provides a variety of tools and functions to assist with fitting a line to a set of points, such as different regression models, curve fitting options, and customizable graphing features. It also allows for easy visualization and analysis of the fitted line and data points.

Similar threads

Back
Top