### Introduction

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:

*The exponential*

The *potential*

### Method

Each case has its corresponding transformation.

*Exponential*

Potential

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.

### Example

The following data compares the volume of a gas against its pressure.

Gas volume | Gas pressure |

1 | 7 |

2 | 30 |

3 | 90 |

4 | 170 |

5 | 290 |

6 | 450 |

7 | 650 |

The resulting functions are:

- Exponential:
- Potential:

The plot from both the values cloud and the functions is

Quantificating the error we get the following values:

- Exponential
- Standard error: 162.971
- Correlation coefficient: 0.781008
- Determination coefficient: 0.609973

- Potential
- 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.

### Flowchart

### Code

### Conclusions

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.