Pedagogy in Action > Library > Teaching with Data > How to Teach With Data > Statistics > Linear Regression

Linear Regression


On this page we provide:


Finding the best linear fit between two paired variables is very useful in many geoscience applications. For example, one might want to estimate the increase in global temperature per decade by performing a linear regression of the global mean temperature on time. As another example, by plotting rock permeability versus density for a particular formation we can get a visual feeling for the possible relationship between these two variables. Performing a least squares linear regression of density on porosity provides an objective method to quantify the linear relationship between these measurements. Often using one's subjective judgment to draw a "best fit" line through the data can also serve as a useful first estimate in the field.


LeastSquaresGraph LeastSqEq1

The basic idea of any least squares fit whether it is a linear least squares fit or a polynomial fit is to find the curve which minimizes the sum of the vertical distances squared between all data point and the least squares line. The square of each distance is used to easily ignore the sign of this distance. Using Trendline command in MS Excel (Acrobat (PDF) 163kB Jul30 04) discusses how to get the least squares fit shown above within Microsoft Excel. The file LINEST Help (Acrobat (PDF) 169kB Aug3 04) describes how one can use the MS Excel LINEST function to obtain additional statistical information including the estimate of confidence intervals for the slope and intercept.


The linear least square line has a slope a and intercept b given by
LeastSqEq2
The correlation coefficient r varies between -1 and +1. The square of the correlation coefficient represents the fraction of the total variance explained by regression (0 to 1.0 indicating absolutely no linear relationship to a perfect linear fit).
LeastSqEq3

There are many textbooks and websites that present the basic theory, limitations, and estimate of confidence of least squares linear regression. We will not repeat that discussion here but simply provide links to online regression tools that you and your students may find useful when working with data. Most spreadsheet programs and calculators also have built in function to calculate the slope and intercept of the least squares fit between data points plotted on an X-Y scatter plot.



Tutorials


References:


« Previous Page      Next Page »