Presentation is loading. Please wait.

Presentation is loading. Please wait.

Linear regression and correlation. Linear systems A widely used methodology of modern science is to cut a big object into many small objects, and describe.

Similar presentations


Presentation on theme: "Linear regression and correlation. Linear systems A widely used methodology of modern science is to cut a big object into many small objects, and describe."— Presentation transcript:

1 Linear regression and correlation

2 Linear systems A widely used methodology of modern science is to cut a big object into many small objects, and describe each small object using a linear system The basic idea of calculus is to approximate a curve with many straight lines Linear systems are widely used in atmospheric sciences, geography and other natural and social sciences

3 Linear regression (line fit) Assume: y=b 0 +b 1 x Find the b 0 and b 1 that minimize the distance of the data points from the line, which is measured by: S = [y i – (b 0 +b 1 x i )] 2 x y

4 Linear regression coefficients

5 Linear correlation coefficient – A measure of if x and y have a linear relationship where x i (i=1, n) and y i (i=1, n) are the two arrays. Overbar represents the mean value.

6

7 IDL intrinsic functions for linear regression and correlation Linear regression coeff = poly_fit(x, y, 1) Linear correlation coeff = correlate(x, y)

8 Example x = [0.05, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 0.95] y = [0.02, 0.01, 0.04, 0.03, 0.05, 0.06, 0.05, 0.08, 0.12, 0.09, 0.10] coeff=poly_fit(x, y, 1) b0=coeff(0) b1=coeff(1) y2=b0+b1*x c=correlate(x, y) print, b0, b1, c plot, x, y, psym=2 oplot, x, y2, thick=4 end

9 Assignment X Go to http://www.biostathandbook.com/linearregression.html read in the data from the first table, make the plot, calculate the linear regression and correlation coefficients http://www.biostathandbook.com/linearregression.html Repeat for the data from the second table. Go to http://www.esrl.noaa.gov/psd/data/climateindices/list/ Read any two of the climate indices, make the scatter plot, calculate the linear regression and correlation coefficientshttp://www.esrl.noaa.gov/psd/data/climateindices/list/ Repeat for another two climate indices (Bonus) Write your own subroutine for calculating linear regression and correlation. Use your own subroutine for the above questions and compare with the results using IDL intrinsic functions.


Download ppt "Linear regression and correlation. Linear systems A widely used methodology of modern science is to cut a big object into many small objects, and describe."

Similar presentations


Ads by Google