Simple Linear Regression – Matrix Approach Recall our example: Hypothesize the relationship, Y = α + βx + ε and calculate the estimate, Attendance, x Amount Bet ($000), Y 117 2.07 128 2.80 122 3.14 119 2.26 131 3.40 135 3.89 125 2.93 120 2.66 130 3.33 127 3.54
Matrix Form of the Equation Define the matrices: Note: the column of 1s in the X matrix is referred to as a “dummy variable” used to allow us to calculate a in the regression equation.
General Matrix Form We obtain the least squares estimates (a, b) of (α, β) by solving the matrix equation: for b, or
Recall Basic Matrix Operations
For Our Example, Step 1: XTX 10 1254 (note: n=10, Σx = 1254, Σx2 = 157,558) XTX= 1254 157,558
For Our Example, Step 2: XTY 30.02 XTY= 3791 (note: n=10, Σy = 30.02, Σxy = 3791)
Inverting Matrices Calculate the determinant. 2 x 2 matrix (M) , D = ad – bc 3 x 3 matrix (Q), Z = a(ek – fh) – b(dk – fg) + c(dh – eg) Calculate the elements of the matrix 2 x 2 matrix (M) ,
Inverting Matrices (cont.) (cont.) Calculate the elements 3 x 3 matrix (Q),
For Our Example Step 3: (XTX)-1 D = _______________
Our Example Step 4: Determine b = ________________________
Your Turn (In-Class / Homework)