Register to reply 
Sigma Plot, Nonlinear regression, fitting a line to a set of points 
Share this thread: 
#1
Jan2913, 04:38 PM

P: 5

I model arterial baroreflex data that I have collected in humans using the Kent equation which is:
y=p1/(1+exp((xp3)*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 


#2
Jan3113, 09:01 AM

Sci Advisor
P: 3,564

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
Jan3113, 11:19 AM

P: 5

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
Feb113, 03:11 AM

Sci Advisor
P: 3,564

Sigma Plot, Nonlinear regression, fitting a line to a set of points
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
Feb113, 07:15 AM

P: 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 acknowledgements section of my dissertation and any other publications that come. 


#6
Feb113, 07:22 AM

PF Gold
P: 330




#7
Feb113, 07:39 AM

PF Gold
P: 330

Add this as your constraint by setting RHS to 0.54 at x=95:



#8
Feb113, 08:26 AM

PF Gold
P: 330

Actually the slope and passthroughpoint 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=70p1/(1+exp((95p3)*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((xp3)*p2))+70p1/(1+exp((95p3)*p2)) Messy, but you put the constraints on and not me. :) 


#9
Feb113, 08:41 AM

P: 5

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
Feb113, 09:03 AM

PF Gold
P: 330




#11
Feb113, 10:33 AM

PF Gold
P: 330

The red line looks right?
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)))/(9694) [1] 0.5395504 PS. I used R instead; didn't have Sigmaplot handy. 


#12
Feb113, 10:43 AM

PF Gold
P: 330

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((xp3)*p2))+70(( 0.54*(exp(p2*p3)+exp(p2*95))^2 ) / (p2 * exp(p2*(p3 + 95)) ))/(1+exp((95p3)*p2)) 


#13
Feb113, 11:19 AM

P: 5

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 in to this. I will keep trying to finesse the equations into existence but it may be a neverending struggle with SigmaPlot. Thanks alot dude 


#14
Feb113, 11:21 AM

PF Gold
P: 330

Try R:



#15
Feb113, 11:25 AM

PF Gold
P: 330

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. PS. I'm no R loyalist. I believe in whatever works. Had tried Python on your problem at first but didn't get far. 


Register to reply 
Related Discussions  
Fitting a curve in loglinear plot.  General Math  6  
Coefficient of Determination in case of repeat points, in linear regression  Set Theory, Logic, Probability, Statistics  3  
Matlab, fit custom regression line to data points  Math & Science Software  0  
Returning each coord between two points of a linear line  Calculus & Beyond Homework  1  
Fitting points from a straight line segment onto a circular segment  Programming & Computer Science  3 