## Making the logistic formula more versatile, stage one—shifting right or left

While it is useful to be able to control the rate of transition by using the rate parameter, more adjustability is needed to make this formula a good match to typical transition situations whose graphs have shapes similar to the basic logistic. We can handle this by adding more parameters to control the size and position of the curve.

So in addition to the rate/slope parameter, we will add a center parameter that tells the x value where the midpoint occurs, enabling us to shift the curve to the right (with positive center values) or to the left (with negative center values). Since the logistic formula equals ½ when the exponent is equal to zero, the way to put the center parameter into the formula is to subtract center from the x value before multiplying by the rate. This leads to the following version of the logistic formula, in which both slope and left-right position can be controlled:

Simple logistic formula (with center adjustment): $y=\frac{1}{1+{{0.018316}^{rate\cdot(x-center)}}}$

The advantage of having the center parameter is that we can use it for data where we can see that there is a logistic transition from zero to one, but we don’t know exactly when that transition occurred. By fitting a simple logistic model to the data, we can have the data tell us both when the transition occurred (the best-fit value for the center parameter) and what its maximum rate of change was (the best-fit value for the rate parameter).

Example 2: Wine fermentation time

As wine matures, a small amount of yeast grows and converts the sugar in the grapes to alcohol. At first growth is rapid because there is plenty of sugar and no alcohol; as more alcohol accumulates, the rate slows down as the increasing amount of alcohol and decreasing amount of sugar interferes with yeast metabolism, finally stopping when the maximum alcohol level for that type of wine is reached..

For the data shown below, [a] When was half the alcohol produced? [b] How fast was the percentage of alcohol compared to the saturation alcohol level increasing at that time?

Solution approach:

The data shows a transition from zero to one (since 100% = 1), so it can be modeled with the simple logistic model constructed from the General Model template.   The appropriate spreadsheet formula to put in cell C3 is =1/(1+0.018316^($G$3*(A3-$G$4))) if we use cell G3 for the rate parameter and cell G4 for the center parameter.

[a] Half the alcohol was produced by 8.68 days of fermentation (from the best-fit value of the center parameter).

[b] At the midpoint of fermentation, the alcohol level was growing at the rate of 16.5% of the saturation level per day (from the best-fit value of the rate parameter).

 Days of fermentation Saturation level % 0 0% 3 2% 6 15% 9 55% 12 90% 15 99% 18 100% 21 100%

The worksheet for this example should be similar to this:

 A B C D E F G H X y data y model Residual Squared y = 1/(1+0.018316^($G$3*(x-$G$4))) 1 Days Saturation prediction deviation deviation Simple-logistic parameters: 2 0 0% 0.003294 -0.003294 1.09E-05 0.164513 Rate 3 3 2% 0.023243 -0.003243 1.05E-05 8.680789 Center 4 6 15% 0.146279 0.003721 1.38E-05 5 9 55% 0.552322 -0.002322 5.39E-06 Model and data value counts 6 12 90% 0.898822 0.001178 1.39E-06 2 Number of parameters 7 15 99% 0.984607 0.005393 2.91E-05 8 Number of deviations averaged 8 18 100% 0.997834 0.002166 4.69E-06 9 21 100% 0.999699 0.000301 9.09E-08 Goodness of fit of this model 10 7.59E-05 Sum of squared deviations 11 0.003556 Standard deviation

The data and model match well, but it would be difficult to give an accurate value for the midpoint or the rate of change at the center by visually reading the graph. This is where the numerical aspect of the model is particularly useful.

Didn’t we do something like this before? The technique used here of implementing a shift in x position by subtracting the amount of the shift from the x value used in the formula should be familiar. It is essentially the same approach that we used in an earlier topic when we subtracted the year 1992 from x in the model formula rather than subtracting it from the input values in the dataset. But the difference here is that the amount of the shift is a parameter, so we don’t have to know its value in advance—we can instead get the model-fitting process to tell us the exact amount of shift that the data implies.