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.
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.
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.
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
- "Sigmoid function - Wikipedia", Wikipedia, 2018. http://en.wikipedia.org/wiki/Sigmoid_function
- "Logistic function - Wikipedia", Wikipedia, 2018. http://en.wikipedia.org/wiki/Logistic_function
- "Function Grapher Online", 2011. http://www.walterzorn.de/en/grapher/grapher_e.htm
- " OriginLab - Origin and OriginPro - Data Analysis and Graphing Software " http://www.originlab.com/
hi,
could you please help me with further explanation about how to find the parameters (in order to minimize the error) ? I’m trying R to program, but not good at programming.. 🙁
thanks,
SV.
¡Hola Stephany!
Sorry for my late answer – was a little busy the last weeks.
If you could tell me more about your problem, I may help you. However, I am not too familiar with R, but I try my best 🙂
Cheers,
Sven
Hi Sven,
thanks a lot for your tips on fitting sigmoidal curves!
Especially your howto for doing this in Calc is great and has helped me a lot to better analyze the results of my ELISA.
There’s only one thing that confuses me a little – when trying to solve the generic sigmoidal function above for x (i.e. reverse the function), I constantly end up with a different result than given above, mine is:
x=f−ln((a−b∙(y−t))/(c∙(y−t)))∙1/d
i.e. the parameters b, c, and d appear at different positions than in the formula above.
Can you give a hint in which steps you reversed the formula?
Best regards,
Frank
Hi Frank!
Sorry for the late comment. You are right: I did this on a piece of paper and get the same solution as you did. I think I got the formula from Matlab – I wanted to be sure to be right. Well. Should use my brain more often 🙂
Thanks for pointing it out! I corrected it in the text!
Regards,
Sven