# Regression Analysis and Least Squares

March 29, 2018

Back to: Random Testing

In non-mathematical terminology *Regression Analysis* involves fitting smooth curves to scattered data. Around 1800, determining the “best” method to do this for the orbits of the planets and comets was a major motivating factor for the development of the Normal Distribution [1], the Central Limit Theorem [2], and the method of Least Squares [5]. And regression analysis is still used today for important data (e.g., Fig. 18).

Linear regression in its simplest form fits a straight line to a series of data points (*x _{n}*,

*y*),

_{n}*n*= 1, …,

*N*, as illustrated in Fig. 18. The equation for the line is

*y*=

*a x*+

*b*, where

*a*and

*b*are to be determined. The error, or

*residual*, is the difference between the line and data points at each

*x*:

_{n}*e*

*=*

_{n}*y*–

_{n}*a x*–

_{n}*b*. The method of

**Least Squares**is used to determine the “best” values for

*a*and

*b*. This is done by summing the squares of the residuals,

*e*

*, and finding the values of*

_{n}*a*and

*b*that minimize this sum. (Using calculus this involves setting to zero the derivatives of the sum, with respect to

*a*and

*b*, and solving these two equation for

*a*and

*b*.) The resulting formulas are

where are the mean values.

The confidence interval for this curve fit can be obtained by assuming the errors are Normally distributed. The variance of the residuals is given by

where *N* – 2 is used in the denominator since the two equations for *a* and *b* have reduced the number of degrees of freedom by two. To this must be added the variance of the determination of the *y _{n}* data,

*σ*

_{yn}^{2}. (It is often assumed that the error bound specified for a measurement is equal to 2

*σ*

*, based on a 95% confidence level.) Then the standard deviation for the line values,*

_{y}*y*, is

A common measure for the “goodness of fit” for the regression analysis is the ** R-square** coefficient given by

The square root of *R*^{2} is often called the *correlation coefficient*, . In the example of the global surface temperatures in Fig. 18, *σ _{e}* = 0.133 ºC. The error bound for each temperature measurement is given as ± 0.1 ºC, so it is assumed that

*σ*

*= 0.050 ºC. Then*

_{yn}*σ*

*= 0.14 ºC and the 95% confidence interval is ± 0.28 ºC. The calculated value for*

_{y}*R*-square is

*R*

^{2}= 0.83.

In many cases the data do not fit a straight line very well when using linear scales. Rather than trying non-linear curve fits in this format, it is often convenient to use log-values for the linear regression. For example log(*y*) vs. *x*; *y* vs. log(*x*); or log(*y*) vs. log (*x*). As an illustration, the damping in a structure causes the vibration to decay at the rate of A(*t*) = A_{o} e^{-2π}* ^{ f ζ t}* (theoretically) after an impact (where

*f*is the frequency in Hz,

*t*is the time in sec., and

*is the critical damping ratio.). So to determine the damping value*

^{ζ}*, the rms acceleration level is measured vs. time after the structure is impacted, as shown in Fig. 19a for*

^{ζ}*f*= 200 Hz. The theoretical decay will be a straight line when plotted as log(A) = log(A

_{o}) – [2

*π*

*f*log(e)]

^{ζ}*t*, shown in Fig. 19b. In this example the linear regression gives the slope to be -8.28, so

*= 8.28 / [2*

^{ζ}*π*

*f*log(e)] = 0.015.

* *