# Piecewise Nonlinear Regression

SigmaPlot’s nonlinear regression is based on a powerful transform language. This allows multi-line fit equations to be defined over different independent variable (x) intervals. An excellent example is the analysis of cell growth data. This data measures the number of viable cells as a function of time. The shape of a cell growth curve consists of the four segments shown in the following graph. The data in this graph has five replicates that are graphed using SigmaPlot’s replicate data format. It is graphed using a log y-axis scale to display with straight lines the exponential growth and (possibly) death behavior. The multi-line equation for the four-segment piecewise-linear growth curve f is:

```f = if(t <= T1, region1(t),
if(t <= T2, region2(t),
if(t <= T3, region3(t), region4(t))))
region1(t) = (x1*(T1-t) + x2*(t-t1))/(T1-t1)
region2(t) = (x2*(T2-t) + x3*(t-T1))/(T2-T1)
region3(t) = (x3*(T3-t) + x4*(t-T2))/(T3-T2)
region4(t) = (x4*(t4-t) + x5*(t-T3))/(t4-T3)```

The transform language “if” statement is used to create the four x intervals defined by the time points t1 < T1 < T2 < T3 < t4. The “region” equations are defined so that the end points of each segment meet. The nonlinear curve fitter varies 8 parameters — the 5 line end-point heights x1, x2, x3, x4 and x5 and the 3 inter-segment times T1, T2 and T3. You can see in the following animation how the nonlinear curve fitter varies the line end point heights and inter-segment times to find the best fit line. Download the file piecewise_curve_fitting and double click on it to obtain the SigmaPlot notebook with this example and the piecewise-linear curve fit definition.