As seen on the previous post, linear regression only works for data that behaves in a linear way. But, there is a way to transform nonlinear models into linear models. After this, we can apply linear regression and then transform back into the nonlinear form. In particular, there are two ways:
Each case has its corresponding transformation.
In order to transform back, one must apply the correspondning antilogarithm to the constant a. Also, to calculate error, one must use the regular sums and not the logarithmic sums.
The following data compares the volume of a gas against its pressure.
|Gas volume||Gas pressure|
The resulting functions are:
The plot from both the values cloud and the functions is
Quantificating the error we get the following values:
- Standard error: 162.971
- Correlation coefficient: 0.781008
- Determination coefficient: 0.609973
- Standard error: 5.8508
- Correlation coefficient: 0.999749
- Determination coefficient: 0.999497
In this case, the potential (green) approach is far better than the exponential (blue) approach.
Both approaches are really helpful for calculating nonlinear functions. They are a great alternative to polynomail regression, since this one is a bit more complex. But, if the data contains close to zero values, the algorithm may fail, since evaluating the logarithm of a small value tends to minus infinity.