KNOWLEDGEBASE - ARTICLE #1821

How do I calculate the Y-intercept of the second line segment when analyzing data with the Segmental linear regression equation?

The Segmental linear regression equation produces a single line made up of two separate line segments.  The equation maybe useful if you have a data set that is composed of two linear components and you would like to define their linear relationship separately.  For example:

This is the segmental linear regression equation:

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

The results produced from this equation are a set of parameters that define the two linear segments where:
 
intercept1 and slope1 define the first line segment
 
X0 indicates the X value where the first line segment ends
 
slope2 defines the slope of the second line segment
 
If you would like to compute the Y intercept of the second line segment, this calculation is very easy to perform.  Using the parameter values, you can calculate a Y value for the X value at X0 as:
 
Y = (slope1 * X0) + intercept1
 
With this Y value, you can calculate the Y intercept of the second line segment (intercept2) as:
 
intercept2 = Y - (slope2 * X0)
 
Using the above example
 
Y = (2 * 3.56) + 1 = 8.12
intercept2 = 8.12 - (0.2 * 3.56) = 7.408
 
The red line in the image below includes a red line to indicate where the Y intercept  for the second line segment would be:
Click here to download this example file.

Explore the Knowledgebase

Analyze, graph and present your scientific work easily with GraphPad Prism. No coding required.