# What equation should I fit this set of data points to?

I have done an experiment Estimation of silver nitrate by potentiometric titration with standard KCl solution.

A plot of $$\dfrac{\Delta E}{\Delta V}$$ versus Volume of KCl solution gives the following: $\dfrac{\Delta E}{\Delta V}$ versus Volume of KCl ">

What would be the possible equation which I can fit this data to?

(I tried fitting it to a degree 5 polynomial, but it doesn't give a good fit:) PS: I have used gnuplot for plotting.

Edit: Here's the data, if it helps.

• Although the data has one increment (the third) where the function increases, the rest of the data suggests a monotone decreasing property. If that is consistent with the theory (model) behind your understanding of the data, you might be interested in the topic of monotone approximations. Oct 20, 2018 at 14:56
• Yes, the monotone decreasing is consistent with the theory. As far as I know, ignoring a couple of points like the one which you pointed out, the data follows the theory. Oct 20, 2018 at 18:56

You could either fit a logistic function (possibly composing it with a linear function), use segmented regression, or classification and regression trees, among other options.

The original data, shown in the figure below, was fitted in Gnuplot using the following commands:

h(x) = k * 0.5 * (1.0 - tanh(0.5 * (a * x + b))) + c * x + d
fit h(x) 'plot-EV.txt' via 'start.par'


where the file start.par contains an initial guess (with values in the ballpark of the optimal parameters) for the optimization process. The specific contents of the initial guess file are:

k = 100
a = 1
b = 1
c = 1
d = 100


The reasoning behind the choice of initial values for k (and d) is that they should be of the same order of magnitude as the original function.

• I tried this method. However, the function produces a straight line with a negative slope: Final set of parameters Asymptotic Standard Error ======================= ========================== k = -49.9422 +/- 7.828e+12 (1.567e+13%) a = -27.7593 +/- 3.724 (13.42%) b = 337.122 +/- 20.47 (6.072%) correlation matrix of the fit parameters: k a b k 1.000 a 0.305 1.000 b -0.352 -0.887 1.000 Oct 21, 2018 at 10:04
• I have added the data which I'm trying to plot. Oct 21, 2018 at 10:15
• I have updated the answer with a regression of the original data. Oct 21, 2018 at 16:07

An assortment of curves for fitting chemistry examples is presented in these Colby College class notes. Of particular application is the sigmoid response curve with variable "slope" for the central part of the curve:

$$f(x) = \frac{a}{1 + e^{bx - c} } + d$$

[This is similar to the suggested logistic function proposed in the first Answer, but has four rather than three parameters allowing for the inflection points (changing sign of second derivative) to appear in a location other than at the origin.]

Such functions are inherently monotone (decreasing when $$b\gt 0$$ and increasing when $$b\lt 0$$), so they will "automatically" possess that property if you fit your data to one of these models, avoiding the tendency of polynomial curve fits to oscillations seen in your graph.

A disadvantage of this nonlinear parameterization is that computing it requires an iterative process, rather than by the direct solvers available for a linear least squares fitting as you seem to have used for the fifth degree polynomial.

But nonlinear least squares fitting is often not difficult when reasonable initial estimates for the parameters are available. There are online solvers (at a glance Nonlinear Least Squares Regression suggested in the class note above seems to be intact, although a second site mentioned there returns 404:Not found). Most spreadsheets have either built-in or add-in solvers that would be capable of doing the fit. But you may find it edifying to do the fit "manually" so that you understand the roles played by the parameters.

I would start with the two extremes where the curve levels off. That is, for arguments well below the "drop-off" portion of the curve, the data appears to approach $$f(0) = 360$$ more or less. From this one might estimate:

$$a + d \approx 360$$

while the data well above the "drop-off" suggests $$d \approx 130$$. So we can get initial estimates for parameters $$a,d$$ easily.

Visually the inflection point (change from concave down to concave up) appears to occur at about $$x=3.5$$. Solving $$f''(x) = 0$$ gives us $$bx = c$$, thus eliminating one more parameter estimate. Finally the first derivative of $$f(x)$$ at the inflection point can be estimated visually from the slope exhibited by the data (although this seems rather steep, circa $$600$$, so less firmly estimated by sight).

The iterative procedure (nonlinear least squares regression) will seek to adjust the parameters $$a,b,c,d$$ to minimize the least squares measure of error:

$$\sum_{i=1}^n (y_i - f(x_i))^2$$

where summation is taken over the set of data $$(x_i,y_i)$$ from your titration experiments.

• Could you tell me the value of the parameters to which I can try plotting this curve? Nov 11, 2018 at 17:22
• Sure. I thought I'd sketched an Initial guess for all four parmeters, but rereading what I wrote I realize I could have been clearer. Nov 13, 2018 at 18:14