Presentation is loading. Please wait.

Presentation is loading. Please wait.

2/12/2016 1 Linear Regression Electrical Engineering Majors Authors: Autar Kaw, Luke Snyder

Similar presentations


Presentation on theme: "2/12/2016 1 Linear Regression Electrical Engineering Majors Authors: Autar Kaw, Luke Snyder"— Presentation transcript:

1 2/12/2016 http://numericalmethods.eng.usf.edu 1 Linear Regression Electrical Engineering Majors Authors: Autar Kaw, Luke Snyder http://numericalmethods.eng.usf.edu Transforming Numerical Methods Education for STEM Undergraduates

2 Linear Regression http://numericalmethods.eng.usf.edu http://numericalmethods.eng.usf.edu

3 3 What is Regression? What is regression? Given n data points best fitto the data. The best fit is generally based on minimizing the sum of the square of the residuals, Residual at a point is Figure. Basic model for regression Sum of the square of the residuals.

4 http://numericalmethods.eng.usf.edu4 Linear Regression-Criterion#1 Given n data pointsbest fit to the data. Does minimizingwork as a criterion, where x y Figure. Linear regression of y vs. x data showing residuals at a typical point, x i.

5 http://numericalmethods.eng.usf.edu5 Example for Criterion#1 xy 2.04.0 3.06.0 2.06.0 3.08.0 Example: Given the data points (2,4), (3,6), (2,6) and (3,8), best fit the data to a straight line using Criterion#1 Figure. Data points for y vs. x data. Table. Data Points

6 http://numericalmethods.eng.usf.edu6 Linear Regression-Criteria#1 xyy predicted ε = y - y predicted 2.04.0 0.0 3.06.08.0-2.0 2.06.04.02.0 3.08.0 0.0 Table. Residuals at each point for regression model y = 4x – 4. Figure. Regression curve for y=4x-4, y vs. x data Using y=4x-4 as the regression curve

7 http://numericalmethods.eng.usf.edu7 Linear Regression-Criteria#1 xyy predicted ε = y - y predicted 2.04.06.0-2.0 3.06.0 0.0 2.06.0 0.0 3.08.06.02.0 Table. Residuals at each point for y=6 Figure. Regression curve for y=6, y vs. x data Using y=6 as a regression curve

8 http://numericalmethods.eng.usf.edu8 Linear Regression – Criterion #1 for both regression models of y=4x-4 and y=6. The sum of the residuals is as small as possible, that is zero, but the regression model is not unique. Hence the above criterion of minimizing the sum of the residuals is a bad criterion.

9 http://numericalmethods.eng.usf.edu9 Linear Regression-Criterion#2 x y Figure. Linear regression of y vs. x data showing residuals at a typical point, x i. Will minimizingwork any better?

10 http://numericalmethods.eng.usf.edu10 Linear Regression-Criteria 2 xyy predicted |ε| = |y - y predicted | 2.04.0 0.0 3.06.08.02.0 6.04.02.0 3.08.0 0.0 Table. The absolute residuals employing the y=4x-4 regression model Figure. Regression curve for y=4x-4, y vs. x data Using y=4x-4 as the regression curve

11 http://numericalmethods.eng.usf.edu11 Linear Regression-Criteria#2 xyy predicted |ε| = |y – y predicted | 2.04.06.02.0 3.06.0 0.0 2.06.0 0.0 3.08.06.02.0 Table. Absolute residuals employing the y=6 model Figure. Regression curve for y=6, y vs. x data Using y=6 as a regression curve

12 http://numericalmethods.eng.usf.edu12 Linear Regression-Criterion#2 Can you find a regression line for whichand has unique regression coefficients? for both regression models of y=4x-4 and y=6. The sum of the errors has been made as small as possible, that is 4, but the regression model is not unique. Hence the above criterion of minimizing the sum of the absolute value of the residuals is also a bad criterion.

13 http://numericalmethods.eng.usf.edu13 Least Squares Criterion The least squares criterion minimizes the sum of the square of the residuals in the model, and also produces a unique line. x y Figure. Linear regression of y vs. x data showing residuals at a typical point, x i.

14 http://numericalmethods.eng.usf.edu14 Finding Constants of Linear Model Minimize the sum of the square of the residuals: To find giving andwe minimizewith respect toand.

15 http://numericalmethods.eng.usf.edu15 Finding Constants of Linear Model Solving for and directly yields,

16 http://numericalmethods.eng.usf.edu16 Example 1 To simplify a model for a diode, it is approximated by a forward bias model consisting of DC voltage, and resistor. Below are the current vs. voltage data that is collected for a small signal. V (volts) I (amps) 0.60.01 0.70.05 0.80.20 0.90.70 1.02.00 1.14.00 Table. Data points for I vs. V Figure. Data points for I vs. V data.

17 http://numericalmethods.eng.usf.edu17 Example 1 cont. The I vs. V data is regressed to Once and are known, and can be calculated as and Find the value of and.

18 http://numericalmethods.eng.usf.edu18 Example 1 cont. VI VoltsAmperesVolts 2 Volt-Amps 0.60.01 0.360.006 0.70.05 0.490.035 0.80.20 0.640.16 0.90.70 0.810.63 1.02.00 1.02.00 1.14.00 1.214.40 5.16.964.517.231 The necessary summations are given as, Table. Necessary summations for the calculation of constants for linear model. With

19 http://numericalmethods.eng.usf.edu19 Example 1 cont. We can now calculateusingwhere

20 http://numericalmethods.eng.usf.edu20 Example 1 cont. This gives the equation as our linear regression model. Figure. Linear regression of current vs. voltage

21 http://numericalmethods.eng.usf.edu21 Example 2 StrainStress (%)(MPa) 00 0.183306 0.36612 0.5324917 0.7021223 0.8671529 1.02441835 1.17742140 1.3292446 1.4792752 1.52767 1.562896 To find the longitudinal modulus of composite, the following data is collected. Find the longitudinal modulus, Table. Stress vs. Strain data using the regression model and the sum of the square of the residuals. Figure. Data points for Stress vs. Strain data

22 http://numericalmethods.eng.usf.edu22 Example 2 cont. Residual at each point is given by The sum of the square of the residuals then is Differentiate with respect to Therefore

23 http://numericalmethods.eng.usf.edu23 Example 2 cont. iεσε 2 εσ 1 0.0000 2 1.8300×10 −3 3.0600×10 8 3.3489×10 −6 5.5998×10 5 3 3.6000×10 −3 6.1200×10 8 1.2960×10 −5 2.2032×10 6 4 5.3240×10 −3 9.1700×10 8 2.8345×10 −5 4.8821×10 6 5 7.0200×10 −3 1.2230×10 9 4.9280×10 −5 8.5855×10 6 6 8.6700×10 −3 1.5290×10 9 7.5169×10 −5 1.3256×10 7 7 1.0244×10 −2 1.8350×10 9 1.0494×10 −4 1.8798×10 7 8 1.1774×10 −2 2.1400×10 9 1.3863×10 −4 2.5196×10 7 9 1.3290×10 −2 2.4460×10 9 1.7662×10 −4 3.2507×10 7 10 1.4790×10 −2 2.7520×10 9 2.1874×10 −4 4.0702×10 7 11 1.5000×10 −2 2.7670×10 9 2.2500×10 −4 4.1505×10 7 12 1.5600×10 −2 2.8960×10 9 2.4336×10 −4 4.5178×10 7 1.2764×10 −3 2.3337×10 8 Table. Summation data for regression model With and Using

24 http://numericalmethods.eng.usf.edu24 Example 2 Results The equation Figure. Linear regression for Stress vs. Strain data describes the data.

25 Additional Resources For all resources on this topic such as digital audiovisual lectures, primers, textbook chapters, multiple-choice tests, worksheets in MATLAB, MATHEMATICA, MathCad and MAPLE, blogs, related physical problems, please visit http://numericalmethods.eng.usf.edu/topics/linear_regr ession.html

26 THE END http://numericalmethods.eng.usf.edu


Download ppt "2/12/2016 1 Linear Regression Electrical Engineering Majors Authors: Autar Kaw, Luke Snyder"

Similar presentations


Ads by Google