curvefit.com. Guide to nonlinear regression.Try our software free for 30 days.StatMate leads you step by step through power and sample size calculations.InStat is a less cumbersome alternative to typical heavy-duty statistical programs. With InStat, even a statistical novice can analyze data in just a few minutes.Prism is a powerful combination of basic biostatistics, curve fitting and scientific graphing in one comprehensive program.GraphPad Software. Data analysis and biostatistics resources.


spa

Table of contents
Intro to regression
Nonlinear regression
Curve fitting with Prism


s

Nonlin with Prism
Initial values
Fixing constants
Method options
Output options
Default options
Importing equations
Writing equations
Constraining
Two models in one
Simulate a curve
Interpreting the results
Comparing two curves
Distributions of best-fit values
Radioligand binding
Saturation binding
Competitive binding
Kinetics of binding
Dose-response curves
Enzyme kinetics
Standard curves
More information
Search curvefit.com

curvefit.com was created by GraphPad Software, Inc. Send comments or questions to the author of these pages, Dr. Harvey Motulsky, president of GraphPad Software.

In April 2003, GraphPad released Prism 4 and published Fitting Models to Biological Data using Linear and Nonlinear Regression. This book includes all the information that comprises curvefit.com, and much more. You can read this book as a pdf file.

How to fit different portions of the data to different equations

In some situations you may wish to fit different models to different portions of your data. This often occurs in kinetic experiments where you add a drug or perform some sort of intervention while recording data. The values collected before the intervention follow a different model than those collected afterwards.

Although Prism has no built-in way to fit different equations to different portions of the data, you can achieve that effect using a user-defined equation containing the IF function.

Example 1. Plateau followed by exponential association

In this example, you collected data that established a baseline early in the experiment, up to "Start". You then added a drug, and followed the outcome (Y) as it increased towards a plateau. Prior to the injection the data followed a horizontal line; after the injection the data formed an exponential association curve.


Y1=BASELINE
Y2=BASELINE + SPAN*(1-exp(-K*(X-START)))
Y=IF[(X<START),Y1,Y2)

It is easiest to understand this equation by reading the bottom line first. For X values less than START, Y equals Y1, which is the baseline. Otherwise, Y equals Y2, which is defined by the exponential association equation.

This equation has two intermediate variables (Y1 and Y2). Prism can fit the four true variables: START, SPAN, K, and BASELINE.

In many cases, you'll make START a constant equal to the time of the experimental intervention. If you want Prism to fit START, choose an initial value carefully.  

Example 2. Two linear regression segments

This example fits one linear regression line to points where X is less than some value X0 and another linear regression line to points where X is greater than X0. You can make X0 a constant (the time of an experimental intervention). Or you can ask Prism to find the best fit value of X0. The two lines will not necessarily meet at X0, and may intersect far from it.

Use this user-defined equation in Prism's nonlinear regression:

Y1=slope1*X + intercept1
Y2=slope2*X + intercept2
Y=IF(X<X0, Y1, Y2)

Y1 and Y2 define the two linear regression lines, each with their own slope and intercept. If X is less than X0, Y is computed using the Y1 formula, otherwise the Y2 formula is used.

If you want Prism to fit X0, give Prism a reasonable initial value. The rule that the initial value of X0 equals 1 times XMID works well for many data sets. The initial values of the two slopes and intercepts don't really matter (since this is a linear, rather than a nonlinear, equation). Prism will fit them accurately even if all initial values are set to zero.

This method fits two linear regression lines, but does not ensure that the lines meet at X0. The curve may be discontinuous, as shown below. In this example the best-fit value of X0 is 6.5. The two regression lines do not intersect at X=6.5, so the curve is discontinuous. The next example fits two linear regression lines that intersect at X0.

Example 3. Two linear regression segments that meet at the breakpoint

This equation fits two linear regression lines, ensuring that they intersect at X=X0.  

Y1 = intercept1 + slope1*X  
YatX0 = slope1*X0 + intercept1
Y2 = YatX0 + slope2*(X - X0)
Y = IF(X<X0, Y1, Y2)

The first line of the equation defines the first line segment from its intercept and slope.

The second line of the equation computes the Y value of the first regression at the right end of that segment, when X=X0.

The third line of the equation computes the second regression segment. Since we want a continuous line, the Y value at the left end of the second segment must equal the Y value at the right end of the first segment (YatX0). The Y value at any other position along the second segment equals YatX0 plus the increase due to the second regression line. That increase equals the slope of the second segment (slope2) times the distance from X to X0.  

The final line defines Y for all values of X. If X is less than X0 then Y is set equal to Y1. Otherwise Y is set equal to Y2.

Here are the results with sample data. The program found that the best-fit value of X0 was 5.00, and the two lines meet at that X value.

Example 4. Linear regression with three segments

This equation fits three linear regression lines, ensuring that they intersect at X=X0 and X=X1.  

Y1 = intercept1 + slope1*X  
YatX0 = intercept1 + slope1*X0
Y2 = YatX0 + slope2*(X - X0)YatX1 = YatX0 + slope2*(X1-X0)Y3 = YatX1 + slope3*(X - X1)
Y = IF(X<X0, Y1, IF(X<X1, Y2, Y3))

The logic is identical to that of the two segment regression line.

Use segmental linear regression cautiously

Segmental linear regression is appropriate when something happens at X0 to change the slope of the line. For example, segmental linear regression might be appropriate if X is time, and you added a drug or changed a voltage at time X0.

If you didn't perform an intervention at X0, consider carefully whether segmental linear regression is the analysis of choice. Without an experimental intervention, segmental linear regression is rarely an appropriate method, as there usually is not a sharp break point. Instead, you probably want to fit some sort of curve.

Warning. Segmental linear regression is definitely NOT an appropriate method to analyze a biphasic Scatchard plot. A biphasic Scatchard plot follows a curve, not two intersecting lines. There is no abrupt break point. You should fit the original data to a two-site binding curve instead.

How to simulate a theoretical curve                                                                                                                                                                                                                                                                                                            


All contents copyright © 1999 by GraphPad Software, Inc. All rights reserved.