\(x\) \(y\) \(\hat{y}_{i}\) \(y_{i} - \hat{y}_{i}\) \(\chi\) \(\Psi\) \(\hat{\Psi}_{i}\) \(\Psi_{i} - \hat{\Psi}_{i}\) \(y = 5e^{x} + 2\) \(\Psi = 5\chi + 2\)
\(y = 5e^{x} + 2,\; \Psi = y,\; \chi = e^{x}\)
\(y = 5x^{-1} + 2,\; \Psi = y,\; \chi = x^{-1}\)
\(y = 5\ln(x) + 2,\; \Psi = y,\; \chi = \ln(x)\)
\(y^{2} = 5x^{5} + 2,\; \Psi = y^{2},\; \chi = x^{5}\)

Directions

This simulation shows how transformations can be used to manipulate nonlinear equations into a form for linear regression analysis. Four different equations are shown on the right-hand side of the window and can be selected with the radio buttons. The selected nonlinear equation is plotted in the upper left plot (dashed black line). Experimental data are generated from this equation by adding white Gaussian noise and are shown on the same plot (blue circles). These nonlinear experimental data are fit with a linear model (solid green line). The residuals of that fitting are shown in the lower left plot and exhibit a clear trend, indicating the linear approximation is violated.

The nonlinear equation and experimental data are transformed accordingly and shown in the upper right plot. The transformed data are fit with a linear model. The residuals for the resulting fit are shown in the lower right plot. New experimental data are generated each time an equation is selected.

Details

Each nonlinear equation \(y = f(x)\) is transformed into a linear form \(\Psi = \beta_{1}\chi + \beta_{0}\) using the transformed variables \(\Psi\) and \(\chi\):

Nonlinear equationTransformationLinear form
\(y = 5e^{x} + 2\)\(\Psi = y,\; \chi = e^{x}\)\(\Psi = 5\chi + 2\)
\(y = 5x^{-1} + 2\)\(\Psi = y,\; \chi = x^{-1}\)\(\Psi = 5\chi + 2\)
\(y = 5\ln(x) + 2\)\(\Psi = y,\; \chi = \ln(x)\)\(\Psi = 5\chi + 2\)
\(y^{2} = 5x^{5} + 2\)\(\Psi = y^{2},\; \chi = x^{5}\)\(\Psi = 5\chi + 2\)

Experimental data are simulated by evaluating the equation at \(x = 0.05, 0.10, \ldots, 3.00\) and adding white Gaussian noise with a signal-to-noise ratio of 1 dB relative to a 1 W reference (noise standard deviation \(\sigma = \sqrt{10^{-\mathrm{SNR}/10}} \approx 0.89\)). Independent noise is added to the untransformed data \(y\) and to the transformed data \(\Psi\).

Simple linear regression is used to fit the data. The least-squares estimates of the slope \(\hat{\beta}_{1}\) and intercept \(\hat{\beta}_{0}\) are:

\[\hat{\beta}_{1} = \frac{\displaystyle\sum_{i=1}^{n}\left(\chi_{i} - \bar{\chi}\right)\left(\Psi_{i} - \bar{\Psi}\right)} {\displaystyle\sum_{i=1}^{n}\left(\chi_{i} - \bar{\chi}\right)^{2}}\] \[\hat{\beta}_{0} = \bar{\Psi} - \hat{\beta}_{1}\,\bar{\chi}\]

where \(\bar{\chi}\) and \(\bar{\Psi}\) are the sample means and \(n = 60\) is the number of data points. The fitted values and residuals are:

\[\hat{\Psi}_{i} = \hat{\beta}_{0} + \hat{\beta}_{1}\,\chi_{i}, \qquad e_{i} = \Psi_{i} - \hat{\Psi}_{i}\]

The correlation coefficient \(r\) is:

\[r = \frac{\displaystyle\sum_{i=1}^{n}\left(\chi_{i} - \bar{\chi}\right) \left(\Psi_{i} - \bar{\Psi}\right)} {\sqrt{\displaystyle\sum_{i=1}^{n}\left(\chi_{i} - \bar{\chi}\right)^{2}}\, \sqrt{\displaystyle\sum_{i=1}^{n}\left(\Psi_{i} - \bar{\Psi}\right)^{2}}}\]

and \(r^{2}\) is the coefficient of determination. The same regression formulas are applied to the untransformed data \((x_{i},\, y_{i})\) for the plots on the left. When the linear model is appropriate, the residuals scatter randomly about zero; a clear trend in the residuals indicates that the linear model is violated.

Symbols:
\(x,\, y\) = independent and dependent variables
\(\chi,\, \Psi\) = transformed independent and dependent variables
\(\hat{y},\, \hat{\Psi}\) = values predicted by the linear fit
\(\hat{\beta}_{0},\, \hat{\beta}_{1}\) = least-squares intercept and slope
\(e_{i}\) = residual of data point \(i\)
\(r^{2}\) = coefficient of determination

About

This simulation was created in the Department of Chemical and Biological Engineering at University of Colorado Boulder for LearnChemE.com by John L. Falconer using Claude AI. It is a JavaScript/HTML5 implementation of a MATLAB simulation by Keith Regner. It was prepared with financial support from the National Science Foundation (DUE 2336987 and 2336988). Address any questions or comments to LearnChemE@gmail.com.

⚠️ Simulation Under ReviewThis content is still being reviewed for quality and accuracy and may be updated in the future. Feel free to send us feedback.