1 / 18

Welcome to the Matrix (Algebra) or: Is this torture really necessary?!

Welcome to the Matrix (Algebra) or: Is this torture really necessary?!. What for? Permits compact, intuitive depiction of regression analysis Flexible, in that it can handle any number of independent variables Generally used in statistical presentation, for OLS and other techniques

saskia
Download Presentation

Welcome to the Matrix (Algebra) or: Is this torture really necessary?!

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Welcome to the Matrix (Algebra) or:Is this torture really necessary?! • What for? • Permits compact, intuitive depiction of regression analysis • Flexible, in that it can handle any number of independent variables • Generally used in statistical presentation, for OLS and other techniques • You need to be able to interpret it.

  2. The Basics • Matrix form:

  3. Transpose (“prime”) of a Matrix

  4. Vectors • Vectors are essentially single rows or columns:

  5. Adding Matrices Addition works only if matrices have the same dimension:

  6. Multiplication of Matrices Dimensions: A(r*q) * B(q*c) = C(r*c), So the number of columns in the first matrix must match the number of rows in the second matrix

  7. Rules for Matrix Multiplication • Are matrices conformable? A x B = C (r x q) (q x c) (r x c) • Vector times a matrix: A x B = C (r x c) (c x 1) (r x 1) • Row and column vectors: A x B = C (r x 1) (1 x p) (r x p) A x B = C (1 x r) (r x 1) (1 x 1) a scalar

  8. Identity Matrices Square matrices with 1’s on diagonal and 0’s elsewhere: 4 x 4 identity matrix Identity matrices act like 1’s in familiar algebra: I x B = B (r x r) (r x c) (r x c)

  9. Matrix Inversion Acts a bit like dividing any number by itself in algebra: any matrix multiplied by its inverse is equal to the identity matrix: Here an example (multiply it out and check): Inversion works only for square matrices

  10. Finding the Identity Matrix:An Example 2a + 4b = 0 so 2a = -4b and a = -2b 3a + b = 1 so 3(-2b) + b = 1, and -5b=1 so b = -1/5 Therefore: a = -2(-1/5) so a = 2/5 3c + d = 0 so d = -3c 2c + 4d = 1 so 2c + 4(-3c) = 1 and -10c = 1 so c = -1/10 Therefore d = -3(-1/10) so d = 3/10

  11. Example Continued Now we can check and see the result of C x C-1:

  12. Regression in Matrix Form • Assume a model using n observations, with K-1 Xi (independent) variables

  13. Regression in Matrix Form Note: we can’t uniquely define (X’X)-1 if any column in the X matrix is a linear function of any other column(s) in X. Why is that?

  14. The X’X Matrix Note that you can obtain the basis for all the necessary means, variances and covariances among the Xs from the (X’X) matrix

  15. An Example of Matrix Regression Using a sample of 7 observations, where X has Elements {X0, X1, X2, X3}

  16. Example:Analysis of Test Scores Source | SS df MS Number of obs = 420 -------------+------------------------------ F( 3, 416) = 107.45 Model | 66409.8837 3 22136.6279 Prob > F = 0.0000 Residual | 85699.7099 416 206.008918 R-squared = 0.4366 -------------+------------------------------ Adj R-squared = 0.4325 Total | 152109.594 419 363.030056 Root MSE = 14.353 ------------------------------------------------------------------------------ testscr | Coef. Std. Err. t P>|t| [95% Conf. Interval] -------------+---------------------------------------------------------------- str | -.2863992 .4805232 -0.60 0.551 -1.230955 .658157 expn_stu | .0038679 .0014121 2.74 0.006 .0010921 .0066437 el_pct | -.6560227 .0391059 -16.78 0.000 -.7328924 -.5791529 _cons | 649.5779 15.20572 42.72 0.000 619.6883 679.4676 ------------------------------------------------------------------------------

  17. Application of Multivariate Regression Analysis • Use the .do file posted to replicate the preceding model using matrix algebra • Evaluate the Output • Draw Initial Conclusions • Some Hints! • Enlarge your matrix size (set mat command) • Drop unnecessary variables

  18. Break for analysis... • Feel free to work in groups • Discuss Analyses • Take 20 minutes

More Related