# Modeling non-linear data using least squares best fit

I have some data for liquid viscosity as a function of pressure and temperature.

I would like to learn how come up with a single equation that would determine this fluid's viscosity with pressure and temperature as inputs. How can I go about doing this? This seems like it would require a multi-parameter, nonlinear, least squared best fit method -- But, 1) I'm not sure if that is true, 2) I wouldn't know how to do this sort of method if that is true.

See here for the plot of the data:

I used a 2nd order polynomial trendline to describe each curve. I'm not sure if this would be best. Looking at wiki's page for viscosity, it seems viscosity has an exponential dependence on temperature.

How can this issue be solved?

Edit: Here is the same data, viscosity as a function of temperature:

• This question would probably get better answers at stats.stackexchange.com. ${}\qquad{}$ Aug 15, 2014 at 21:48
• Fitting polynomials by least squares is not nonlinear; it's linear. Aug 15, 2014 at 21:55
• Could you post the data points somewhere ? I would like to play with them (just to remember the old time !). Thanks. Aug 17, 2014 at 9:04
• @ClaudeLeibovici please email me. Aug 18, 2014 at 2:40
• I don't have your e-mail. Mine is cfl-consultant@club-internet.fr. Aug 18, 2014 at 4:13

From an engineering and practical point of view, very good models have been proposed.

For temperature dependency, Vogel proposed $$\Large\eta=a~ e^{\frac{b}{T+c}}$$ (ignore $c$ if you want to have a model which can be linearized to provide you good estimates for the nonlinera regression - but, in such a case, $T$ must be absolute) and for pressure dependency, Barus proposed $$\Large\eta=\eta_0~ e^{\alpha P}$$

If I had to solve your problem, I should work independently each isobar in order to get for each pressure the value of the coefficients $a,b,(c)$. Then, plot each of the parameters as a function of pressure to see if something even simpler could be emprically found. If not, for the considered temperature, compute the viscosity at the different pressures and just interpolate linearly.

If I may add a comment : very few (or even less) physical properties are represented by polynomials.

Searching my old notes, I found that I used (very long time ago), a model which write $$\Large\eta=\eta_0 \exp \left(\frac{{c_1} (T-T_0)}{{c_2}+(T-T_0)}+ [d_1 +d_2 (T-T_0)]~(P-P_0)\right)$$ which was quite good. You can see that it is just a combination of the other models with a simple assumption concerning the dependency of parameter $\alpha$ with respet to temperature.
In order to make your life simple, you could consider as a model $$\Large\eta=e^{a+b P +\frac{c+dP}{T}}$$ So $$\log(\eta)={a+b P +\frac{c+dP}{T}}$$ So perform a linear regression with independent variables $P,\frac{1}{T},\frac{P}{T}$; this gives you good estimates of the parameters $a,b,c,d$. You can now start a nonlinear regression.