SE-280 Dr. Mark L. Hornick Multiple Regression (Cycle 4)

Slides:



Advertisements
Similar presentations
SOLVING SYSTEMS OF LINEAR EQUATIONS An equation is said to be linear if every variable has degree equal to one (or zero) is a linear equation is NOT a.
Advertisements

Gaussian Elimination Matrices Solutions By Dr. Julia Arnold.
Linear Algebra Applications in Matlab ME 303. Special Characters and Matlab Functions.
FTP Biostatistics II Model parameter estimations: Confronting models with measurements.
Matrix Algebra Matrix algebra is a means of expressing large numbers of calculations made upon ordered sets of numbers. Often referred to as Linear Algebra.
The General Linear Model. The Simple Linear Model Linear Regression.
Systems of Linear Equations
Chapter 9 Gauss Elimination The Islamic University of Gaza
Maths for Computer Graphics
Variance and covariance M contains the mean Sums of squares General additive models.
Linear Algebraic Equations
Basic Mathematics for Portfolio Management. Statistics Variables x, y, z Constants a, b Observations {x n, y n |n=1,…N} Mean.
Linear regression models in matrix terms. The regression function in matrix terms.
Arithmetic Operations on Matrices. 1. Definition of Matrix 2. Column, Row and Square Matrix 3. Addition and Subtraction of Matrices 4. Multiplying Row.
LIAL HORNSBY SCHNEIDER
CE 311 K - Introduction to Computer Methods Daene C. McKinney
Copyright © Cengage Learning. All rights reserved. 7.6 The Inverse of a Square Matrix.
Solving System of Linear Equations. 1. Diagonal Form of a System of Equations 2. Elementary Row Operations 3. Elementary Row Operation 1 4. Elementary.
Variance and covariance Sums of squares General linear models.
Example of Simple and Multiple Regression
Matrix Solution of Linear Systems The Gauss-Jordan Method Special Systems.
Sec 10.3 Coefficient of Determination and Standard Error of the Estimate.
Solving Systems of Equations and Inequalities
Least-Squares Regression
LU Decomposition 1. Introduction Another way of solving a system of equations is by using a factorization technique for matrices called LU decomposition.
MATRICES AND DETERMINANTS
Systems and Matrices (Chapter5)
ECON 1150 Matrix Operations Special Matrices
TH EDITION LIAL HORNSBY SCHNEIDER COLLEGE ALGEBRA.
Solving Systems of Equations and Inequalities Section 3.1A-B Two variable linear equations Section 3.1C Matrices Resolution of linear systems Section 3.1D.
Barnett/Ziegler/Byleen Finite Mathematics 11e1 Review for Chapter 4 Important Terms, Symbols, Concepts 4.1. Systems of Linear Equations in Two Variables.
Row Reduction Method Lesson 6.4.
8.1 Matrices and Systems of Equations. Let’s do another one: we’ll keep this one Now we’ll use the 2 equations we have with y and z to eliminate the y’s.
SE-280 Dr. Mark L. Hornick 1 Statistics Review Linear Regression & Correlation.
Some matrix stuff.
F UNDAMENTALS OF E NGINEERING A NALYSIS Eng. Hassan S. Migdadi Inverse of Matrix. Gauss-Jordan Elimination Part 1.
Matrix Solutions to Linear Systems. 1. Write the augmented matrix for each system of linear equations.
Solving Systems of 3 or More Variables Why a Matrix? In previous math classes you solved systems of two linear equations using the following method:
Chapter 12 Multiple Linear Regression Doing it with more variables! More is better. Chapter 12A.
Copyright © 2013, 2009, 2005 Pearson Education, Inc. 1 5 Systems and Matrices Copyright © 2013, 2009, 2005 Pearson Education, Inc.
MIT and James Orlin © –Developed by James Orlin, MIT Animation of the Gauss-Jordan Elimination Algorithm.
8.1 Matrices & Systems of Equations
Matrices Addition & Subtraction Scalar Multiplication & Multiplication Determinants Inverses Solving Systems – 2x2 & 3x3 Cramer’s Rule.
10.4 Matrix Algebra 1.Matrix Notation 2.Sum/Difference of 2 matrices 3.Scalar multiple 4.Product of 2 matrices 5.Identity Matrix 6.Inverse of a matrix.
Matrix Algebra and Regression a matrix is a rectangular array of elements m=#rows, n=#columns  m x n a single value is called a ‘scalar’ a single row.
Regression Regression relationship = trend + scatter
Matrix Differential Calculus By Dr. Md. Nurul Haque Mollah, Professor, Dept. of Statistics, University of Rajshahi, Bangladesh Dr. M. N. H. MOLLAH.
Class Opener:. Identifying Matrices Student Check:
Copyright © 2011 Pearson Education, Inc. Solving Linear Systems Using Matrices Section 6.1 Matrices and Determinants.
Chapter 9 Gauss Elimination The Islamic University of Gaza
3.6 Solving Systems Using Matrices You can use a matrix to represent and solve a system of equations without writing the variables. A matrix is a rectangular.
Objective 1 You will be able to find the determinant of a 2x2 and a 3x3 matrix.
2.5 – Determinants and Multiplicative Inverses of Matrices.
Math 1320 Chapter 3: Systems of Linear Equations and Matrices 3.2 Using Matrices to Solve Systems of Equations.
1 ECE 102 Engineering Computation Chapter 3 Math Review 3: Cramer’s Rule Dr. Herbert G. Mayer, PSU Status 10/11/2015 For use at CCUT Fall 2015.
1 ECE 221 Electric Circuit Analysis I Chapter 6 Cramer’s Rule Herbert G. Mayer, PSU Status 11/14/2014 For use at Changchun University of Technology CCUT.
Chapter 5: Matrices and Determinants Section 5.5: Augmented Matrix Solutions.
Matrices. Variety of engineering problems lead to the need to solve systems of linear equations matrixcolumn vectors.
1 SYSTEM OF LINEAR EQUATIONS BASE OF VECTOR SPACE.
SE-280 Dr. Mark L. Hornick 1 Measuring Software Size.
Copyright © Cengage Learning. All rights reserved. 8 Matrices and Determinants.
Downhill product – Uphill product.
Regression.
Multiple Regression.
Substitution, Elimination, Graphing, Matrices
Chapter 4 Systems of Linear Equations; Matrices
5.4 General Linear Least-Squares
Multiplication of Matrices
Chapter 4 Systems of Linear Equations; Matrices
Warm-up: Solve the system: 2x – 0.4y = -2 3x – 1 2 y = -2
Presentation transcript:

SE-280 Dr. Mark L. Hornick Multiple Regression (Cycle 4)

SE-280 Dr. Mark L. Hornick Est Proxy Size (LOC) Time (hrs) Review: Linear Regression (from Cycle 3) x k = estimated LOC (in this example) y k = estimated time (in this example)  0 = offset  1 = slope xkxk ykyk

SE-280 Dr. Mark L. Hornick 3 The regression algorithm assumed a single independent variable. Estimated proxy size (E) Added+modified size (A+M) Development effort (time) y size =β s0+ β s1 x k y time =β t0 +β t1 x k

SE-280 Dr. Mark L. Hornick 4 Can we still apply regression if our estimates involve more than one independent variable? Web pages (JSP) Database tables Java classes If development of each component type is completely independent, we can make separate estimates and add them up. But what if they are so interdependent that we can't do that?

One possible solution is to use multiple regression m = number of independent variables (j =1..m)  0 = offset  j = "slope" relative to each independent variable x k,j = current independent value estimates (e.g. proxy size) y k = projected value (e.g., time) Where do the  values come from?

SE-280 Dr. Mark L. Hornick 6 The  values are calculated by solving a system of linear equations:. n = number of historical data points (i = 1..n) x i,j = historical independent variable values y i = historical dependent variable values

SE-280 Dr. Mark L. Hornick 7 The same equation in matrix form. Use these slides as reference when you implement Cycle 3

SE-280 Dr. Mark L. Hornick 8 When rank(A)=2 (that is, 1 independent variable), the familiar regression equations result when the equations are refactored:

To solve numerically for the  values, we need to calculate values for the A and b matrices. where

If you look close, you will see a pattern to the equation coefficients. What about the x ?,0 terms? They are “fictitious” values that are treated as being equal to one (1.0)!!!

SE-280 Dr. Mark L. Hornick 11 In general, (especially for rank(A)>2), we have to solve the system of equations to get the  i values. Mathematically, we can do this by inverting the coefficient matrix A. However, it's more common to solve the equations using a technique like Gauss-Jordan elimination with back substitution (remember that?).

OK, let's try an example, using test case 4-3 from Cycle 3. x1x1 x2x2 y ACol 0Col 1Col 2 Row 0 Row 1 Row 2 bCol 0 Row 0 Row 1 Row 2 "x 0 " What is the value of a 0,0 ? We pretend there is an x0 column, with all "1" values.

Since A 0,0 is always "n", the number of points, let's try another matrix element. x1x1 x2x2 y ACol 0Col 1Col 2 Row 07 Row 1 Row 2 bCol 0 Row 0 Row 1 Row 2 "x 0 " What is the value of a 0,1 ?

Since a 0,1 is the sum of the x 1 values, a 0,2 must be the sum of the x 2 values. x1x1 x2x2 y ACol 0Col 1Col 2 Row Row 1 Row 2 bCol 0 Row 0 Row 1 Row 2 "x 0 "

Now, what about the rest of the first column in the A matrix? x1x1 x2x2 y ACol 0Col 1Col 2 Row Row 1 Row 2 bCol 0 Row 0 Row 1 Row 2 "x 0 " What is the value of a 1,0 ?

Yes, the values in column 0 are the same as those in row 0, making the matrix symmetric (at least so far). x1x1 x2x2 y ACol 0Col 1Col 2 Row Row 190 Row bCol 0 Row 0 Row 1 Row 2 "x 0 "

Next, let's try an element on the diagonal of matrix A. x1x1 x2x2 y ACol 0Col 1Col 2 Row Row 190 Row bCol 0 Row 0 Row 1 Row 2 "x 0 " Sum of squares = 1746 What is the value of a 1,1 ?

Since the same independent variable appears twice in the diagonal terms, they are computing by summing the squares. x1x1 x2x2 y ACol 0Col 1Col 2 Row Row Row bCol 0 Row 0 Row 1 Row 2 "x 0 "

Let's try one of the remaining terms. x1x1 x2x2 y ACol 0Col 1Col 2 Row Row Row bCol 0 Row 0 Row 1 Row 2 "x 0 " Sum of products = What is the value of a 1,2 ?

Since sum of products for x 1 and x 2 is the same as for x 2 and x 1, the last remaining value is the same. x1x1 x2x2 y ACol 0Col 1Col 2 Row Row Row bCol 0 Row 0 Row 1 Row 2 "x 0 "

OK, now how about the b vector? x1x1 x2x2 y ACol 0Col 1Col 2 Row Row Row bCol 0 Row 0 Row 1 Row 2 "x 0 " What is the value of b 0 (b 0,0 )? Sum of y values = 2438

b 0 is always the sum of the y values; let's try the next one. x1x1 x2x2 y ACol 0Col 1Col 2 Row Row Row bCol 0 Row Row 1 Row 2 "x 0 " Sum of products = What is the value of b 1 (b 1,0 )?

OK, we need just one more value. x1x1 x2x2 y ACol 0Col 1Col 2 Row Row Row bCol 0 Row Row Row 2 What is the value of b 2 (b 2,0 )? Sum of products = "x 0 "

Finally, we have our A and b matrices, and can solve for the  values. ACol 0Col 1Col 2 Row Row Row bCol 0 Row Row Row  Col 0 Row Row Row Matrix betas = a.solve(b);

To extend the correlation calculation to handle multiple independent variables, the only change is in calculating the predicted y values. One independent variable ("linear regression") One or more independent variables ("multiple regression") Obviously, both are forms of "linear" regression, despite the names.

We use the usual approach to calculate the correlation coefficient. Just in case you are curious, the statisticians label the sum-square values like this: Total sum of squares (variability) Sum of squares – predicted (explained) Sum of squares – error (unexplained)

SE-280 Dr. Mark L. Hornick 27 Another Numerical Example y = {16, 30, 44, 58, 96} x 1 = {0, 2, 4, 6, 8} x 2 = {1, 3, 5, 7, 11} x 3 = {1, 2, 3, 4, 10} Determine  values such that

SE-280 Dr. Mark L. Hornick 28 The values in the data vectors are used in the summation terms of the matrices: y = {16, 30, 44, 58, 96} x 1 = {0, 2, 4, 6, 8} x 2 = {1, 3, 5, 7, 11} x 3 = {1, 2, 3, 4, 10}

SE-280 Dr. Mark L. Hornick 29 Evaluating terms in the matrices:.