# Function to fit acid reaction curve

Data in the image below shows a variable DME reacting to the increase in acid concentration. It looks like it has a very fast increase from when the concentration is raised from 0 to 0.5 and then a rapid diminishing return. I thought that a base 10 log function would be a good approximation for this based on the figure below (I admit, the pH scale was an inspiration even though the fact it is base 10 is not relevant here as far as I can tell). This and other bases for log did not yield good fits. Any ideas about a good functional form to use?

• Could you explain how you were fitting these functions and in what sense the results were not "good"? – whuber Jun 16 '19 at 13:45
• I wanted to keep it as simple as possible. So I tried to linearize it by taking 10^y-variable and then running a simple linear regression. The results were not very good because the first observations at the 0 concentration still stand out like outliers (robust regression methods kick them right out). But those results at 0-concentration are part of a real, non-linear process – Deathkill14 Jun 16 '19 at 18:01
• Linearizing by transforming $y$ can be a good idea, but not here, because the error terms look about the same size no matter what $x$ might be; transforming $y$ will ruin this desirable property. Consider instead transforming $x.$ When you do, you will be confronted with the heart of the problem: what to do when $x=0.$ Perhaps an understanding of this process (whatever it might be) will suggest an appropriate procedure. – whuber Jun 16 '19 at 20:21
• Could you please say more about the experimental conditions? There presumably is some acid concentration even at your value of "0" unless you are working in an aprotic solvent. So what you are plotting on the x-axis is presumably the added amount of acid. Any buffers in your solution will affect how the pH/hydrogen-ion activity (presumably the predictor variable of fundamental interest) will change as different amounts of acid are added. – EdM Jun 16 '19 at 20:53
• Thanks @whuber. Well, in the end, I found a pretty good fit with a sigmoid curve. That's pretty similar to what james philips did below. So I think that's kind of a good approach here. I'll try to get some prediction intervals for this now. – Deathkill14 Jun 17 '19 at 19:35

## 1 Answer

I extracted the data from your scatterplot and an equation search turned up a standard Power equation with offset as a good candidate, "AcidConc = a * pow(DME, b) + Offset" with parameters a = 1.3097975059317559E+01, b = 5.6301545542873851E-02, and Offset = 7.3917630382840713E+01 giving R-squared = 0.824 and RMSE = 2.196 with no logs needed. • Cool answer. I ended up with a sigmoid as a fit, so looks pretty much the same as this one. I like that you got a different form. i used one like a/(1 + exp(-b * (x-c))). But maybe yours will be more useful. – Deathkill14 Jun 17 '19 at 19:36