Corporate Profile by aP68V1sd

VIEWS: 1 PAGES: 9

									Matrix Algebra and Regression


                  2   5   6          matrix element
         A   =
                                          a13 = 6
                  1   2   3

•   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 is called a ‘row vector’ B = 12 25 91 30
•   a single column is called a ‘column vector’
    Matrix Algebra and Regression

•    a square matrix has equal numbers of rows and columns
•    in a symmetric matrix, aij = aji       2    0   4   0   11
                                            0    6   0   0   0
                                            4    0   3   8   9
                                            0    0   8   1   0
                                            11   0   9   0   8


•    in a diagonal matrix, all off-diagonal elements = 0
•    an identity matrix is a diagonal matrix with diagonals = 1
                                1   0   0   0

                       I=       0   1   0   0
                                0   0   1   0
                                0   0   0   1
Trace

• The trace of a matrix is the sum of the
 elements on the main diagonal
                    2   0   4   0   11
                    0   6   0   0   0
            A=      4   0   3   8   9
                    0   0   8   1   0
                    11 0    9   0   8



             tr(A) = 2 + 6 + 3 + 1 + 8 = 20
Matrix addition and subtraction


         4   6   2       9   2   5       13   8    7
                     +               =
         8   3   0       4   7   1       12 10     1


         4   6   2       9   2   5       -5   4   -3
                     -               =
         8   3   0       4   7   1       4    -4 -1


•   The dimensions of the matrices must be the same
Matrix multiplication


          A                       B                   C
         mxn                     nxm                 mxm
     2   5   1     8         2    3    7            94   77   72
     3   6   9     4         5    6    3            77 142 86
                        X                   =
     7   3   3     5         1    9    3            72   86   92
                             8    4    5


                 C11 = 2*2 + 5*5 + 1*1 + 8*8 = 94
Matrix operations

•   To transpose a matrix, exchange rows and columns

              2   5   6                        2      1
      A   =                      A'    =       5      2
              1   2   3                        6      3

•   the inverse of a matrix is analagous to division in
    math
                  6   0   0                1/6 0      0
          A   =   0   3   0      A-1   =   0 1/3 0
                  0   0   9                0       0 1/9
Inverting a 2x2 matrix


             a     b                  2     5
      M=                   M=
             c     d                  3     9


           D = ad - bc             D = 2*9 – 5*3



   M-1 =   d/D    -b/D               9/3   -5/3
                         M-1   =
           -c/D   a/D               -3/3   2/3
Linear dependence

              a     b                         2     6
       M=                             M=
              c     d                         3     9

            D = ad - bc                 D = 2*9 – 6*3 = 0

 The matrix is singular because one row (or column) can be
 obtained by multiplying another by a constant
 The rank of a matrix = the number of linearly independent
 rows or columns (1 in this case)
 A nonsingular matrix is full rank and has a unique inverse
 A generalized inverse (M–) can be obtained for any matrix
                          MM–M = M
Regression in matrix notation


  Linear model          Y = X + ε

  Parameter estimates   b = (X’X)-1X’Y

  Source         df     SS               MS

  Regression     p      b’X’Y            MSR

  Residual       n-p    Y’Y - b’X’Y      MSE

  Total          n      Y’Y

								
To top