Analysis: Sigmoid functions for data evaluation

Note: There was an error in the reverse formula (and maybe also with some of the values given). Frank pointed this out (see comments section below).

In analytical chemistry, linear regression or linear function is a common (maybe the most common) tool to describe the relationship between a measured signal and the concentration of an analyte. Even if the relationship is much more complex, one usually works in small ranges only where the assumption of linearity is convenient.

However, there are analytical problems, which cannot be solved with this simple approach. In this short article I want to introduce and present another useful function for data evaluation on the basis of a real example.

The following plot shows the response (fluorescence emission at a certain wavelength) of a pH sensor foil to different pH values. The foil consists of a pH-sensitive dye in a hydrogel matrix.

Figure 1. Response curve of pH sensor foil.

Figure 1. Response curve of pH sensor foil.

As can be seen from the figure above, the response is not linear except for a small area around pH 6. On the contrary, the curve approaches asymptotic values for higher and lower pH values.

This effect is easily explainable. Since the receptor is a pH-sensitive dye, its fluorescence depends on the H+ concentration. The fluorescence intensity is the higher the less protons are bound to the receptor. Obviously, there is a limit in both directions. For very high proton concentrations (i.e. low pH values!), all available binding sites on the dye are blocked. Therefore, lowering the pH more won’t have any further effect. On the other hand, for low proton concentrations (i.e. high pH values!) all possibly bound protons are already removed from the dye and no further protons can’t be removed. So, the fluorescence intensity remains constant.

Now, how can we fit this sensor output? We could extract just the linear area and fit this with a linear equation. However, we don’t know which points actually belong to the linear area and, therefore, it would be possible that we choose too many or too few points. Also, we don’t want to exclude the two bending areas, since there is – even if the sensitivity is lower than in the linear region – still analytical information in these areas.

So, we need a function which fits to this S-shaped curve. Such a function is called ‘sigmoid‘ function. The name is derived from ‘sigma’ (=letter S) and ‘-oid’ (-like or -shaped). There are many forms of sigmoid functions [1]. A common example is the logistical function [2]:



\(f(x) = \frac{1}{1 + e^{-x}}\)

In our case the x is the pH value and f(x) is the fluorescence intensity F as a function of pH. If depicted, the function with the formula above will look similar to the one in Figure 2.

Figure 2. Example of a sigmoid function (black) showing also the linear section (red) and the two asymptotes (blue).

Figure 2. Example of a sigmoid function (black) showing also the linear section (red) and the two asymptotes (blue).

This form of the function returns values between 0 and 1 for a given x. Hence, it is not suitable for our needs and we have to modify it a little bit. First, let us introduce some parameters:



\(f(x) = \frac{a}{b + c \cdot e^{- d \cdot (x – f)}} + t\)

With these parameters we can control the position, form, shape, and range of the function. One can play around with the parameters in an online function plotter [3] to get a feeling for the behaviour of the function and in order to visualize the invidual effect of each parameter.

All we need to do now is to find the appropriate parameter values for our problem from above. Of course, this is a bit more complicated than finding the fit for a straight line. Usually, one uses software tools, such as Origin [4], for this purpose. If we do so the resulting function with all parameters has the following form:

Note: I replaced the parameters with values, which I know work. However, keep in mind there is always more than one good solution. Always double check your results!



\(F(pH) = \frac{1.31}{0.21 + 2.96 \cdot e^{- 1.69 \cdot (pH – 4.23)}} + 0.04\)

Now, we know all parameters (i.e. we calibrated the sensor foil) and can use the sensor foil and measure some pH. However, since we actually measure the fluorescence intensity, we need a method to calculate the pH from this intensity. Therefore, we solve the equation for pH to get the reverse function:

Note: I replaced this formula now with one, which is correct (see comments of Frank below). Originally, I used Matlab because I wanted to make sure this is correct. Maybe I copied it wrong or mixed things up. Mmh. Should have just trusted my good old brain a little more!



\(\begin{aligned}
pH(F) &= -\;ln( \frac{a – b \cdot (F – t)}{ c \cdot (F – t)} ) \cdot \frac{1}{d} + f = \\
&= -0.59 \cdot ln( \frac{1.31 – 0.21 \cdot (F – 0.04)}{ 2.96 \cdot (F – 0.04)} ) + 4.23 = \\
&= -0.59 \cdot F’ + 4.23
\end{aligned}
\)

Also the function looks complicated, it allows us to calculate the pH value to the respective fluorescence intensity. It should be noted that the reverse function is – of course – limited, which is obvious if plotted. Since the ln-function in the above formula only consists of constants and F as variable it can be substituted with a new variable F’, which makes the formula looking like an ordinary linear function.

Indeed, the relationship between F’ and pH is linear (but not the relationship between F and pH!). Substitution is not only good for presenting formulas but for entering them in calculation programs such as Excel or OpenOffice Calc. I have observed many people having problems with entering the whole thing at once – debugging and finding typos is horrible!

The following figure shows both the fitted function as well as the reverse function.

Figure 4. Response of the pH sensor foil with fitted sigmoid function (left) and the corresponding reverse function (right).

Figure 4. Response of the pH sensor foil with fitted sigmoid function (left) and the corresponding reverse function (right).

Finally, we can use the sensor foil to measure the pH of unknown solutions by dropping the solution onto the foil (or putting the foil into the solution), reading out the fluorescence intensity, and calculating the corresponding pH value. That’s it!

References

  1. "Sigmoid function - Wikipedia", Wikipedia, 2021. http://en.wikipedia.org/wiki/Sigmoid_function
  2. url:http://en.wikipedia.org/wiki/Logistic_function (Timed out)
  3. url:http://www.walterzorn.de/en/grapher/grapher_e.htm (Timed out)
  4. url:http://www.originlab.com/ (Timed out)

Kcite was unable to retrieve citation information for all the references, due to a timeout. This is done to prevent an excessive number of requests to the services providing this information. More references should appear on subsequent page views