UnB - Financial Econometrics I Otavio Medeiros 1 The Matrix Otavio R. de Medeiros UnB Programa de Pós-Graduação em Administração Programa Multiinstitucional e Interregional de Pós-Graduação em Ciências Contábeis UnB-UFPB-UFRN Financial Econometrics I
UnB - Financial Econometrics I Otavio Medeiros 2 Matrices A Matrix is a collection or array of numbers Size of a matrix is given by number of rows and columns R x C If a matrix has only one row, it is a row vector If a matrix has only one column, it is a column vector If R = C the matrix is a square matrix
UnB - Financial Econometrics I Otavio Medeiros 3 Definitions Matrix is a rectangular array of real numbers with R rows and C columns. are matrix elements.
UnB - Financial Econometrics I Otavio Medeiros 4 Definitions Dimension of a matrix: R x C. Matrix 1 x 1 is a scalar. Matrix R x 1 is a column vector. Matrix 1 x C is a row vector. If R = C, the matrix is square. Sum of elements of leading diagonal = trace. Diagonal matrix : square matrix with all elements off the leading diagonal equal to zero. Identity matrix: diagonal matrix with all elements in the leading diagonal equal to one. Zero matrix: all elements are zero.
UnB - Financial Econometrics I Otavio Medeiros 5 Definitions Rank of a matrix: is given by the maximum number of linearly independent rows or columns contained in the matrix, e.g.:
UnB - Financial Econometrics I Otavio Medeiros 6 Matrix Operations Equality: A = B if and only if A and B have the same size and a ij = b ij i, j. Addition of matrices: A+B= C if and only if A and B have the same size and a ij + b ij = c ij i, j.
UnB - Financial Econometrics I Otavio Medeiros 7 Matrix operations Multiplication of a scalar by a matrix: k.A = k.[a ij ], i.e. every element of the matrix is multiplied by the scalar.
UnB - Financial Econometrics I Otavio Medeiros 8 Matrix operations Multiplication of matrices: if A is m x n and B is n x p, then the product of the 2 matrices is A.B = C, where C is a m x p matrix with elements: Example: Note: A.B B.A
UnB - Financial Econometrics I Otavio Medeiros 9 Transpose of a matrix matrix transpose: if A is m x n, then the transpose of A is n x m, i.e.:
UnB - Financial Econometrics I Otavio Medeiros 10 Properties of transpose matrices (A+B)+C=A+(B+C) (A.B).C=A(B.C)
UnB - Financial Econometrics I Otavio Medeiros 11 Propriedades: PROJEÇÕES
UnB - Financial Econometrics I Otavio Medeiros 12 Square matrices : Identity matrix I: Note: A.I = I.A = A, where A has the same size as I.
UnB - Financial Econometrics I Otavio Medeiros 13 Square matrices : Diagonal matrix:
UnB - Financial Econometrics I Otavio Medeiros 14 Square matrices: Scalar matrix = diagonal matrix, when n. Zero matrix: A + 0 = A; A x 0 = 0.
UnB - Financial Econometrics I Otavio Medeiros 15 Trace of a matrix: If A is m x n and B is n x m, then AB and BA are square matrices and tr(AB) = tr (BA)
UnB - Financial Econometrics I Otavio Medeiros 16 Determinants matrix 2 x 2:
UnB - Financial Econometrics I Otavio Medeiros 17 Determinants matrix 3 x 3:
UnB - Financial Econometrics I Otavio Medeiros 18 Determinants Matrix 3 x 3:
UnB - Financial Econometrics I Otavio Medeiros 19 Inverse matrix The inverse of a square matrix A, named A -1, is the matrix which pre or post multiplied by A gives the identity matrix. B = A -1 if and only if BA = AB = I Matrix A has an inverse if and only if det A 0 (i.e. A is non singular). (A.B) -1 = B -1.A -1 (A -1 )’=(A’) -1 if A é symmetrical and non singular, then A -1 is symmetrical. If det A 0 and A is a square matrix of size n, then A has rank n.
UnB - Financial Econometrics I Otavio Medeiros 20 Steps for finding an inverse matrix Calculation of the determinant: Kramer’s rule or cofactor matrix. Minor of the element a ij is the determinant of the submatrix obtained after exclusion of the i-th row and j-th column. Cofactor is the minor multiplied by (-1) i+j,
UnB - Financial Econometrics I Otavio Medeiros 21 Steps for finding an inverse matrix Laplace expansion: take any row or column and get the determinant by multiplying the products of each element of row or columns by its respective cofactor. Cofactor matrix: matrix where each element is substituted by its cofactor.
UnB - Financial Econometrics I Otavio Medeiros 22
UnB - Financial Econometrics I Otavio Medeiros 23 Example 2 x 2 matrix :
UnB - Financial Econometrics I Otavio Medeiros 24 Example 3 x 3 matrix :
UnB - Financial Econometrics I Otavio Medeiros 25 Matrix differentiation:
UnB - Financial Econometrics I Otavio Medeiros 26 Matrix differentiation:
UnB - Financial Econometrics I Otavio Medeiros 27 Matrix differentiation:
UnB - Financial Econometrics I Otavio Medeiros 28 Since = 0.5 e = 0.5, the regression equation is y t = x t Solution: Linear regression, example 1: Perform a linear regression, given that the data for the dependent variable are 1, 2, 1, 2, 2 and for the independent variable are 1, 2, 2, 3, 3.
UnB - Financial Econometrics I Otavio Medeiros 29
UnB - Financial Econometrics I Otavio Medeiros 30 Linear regression, example 2: a firm manufacturing bikes is preparing a project and wishes to find out what is the relationship between bike sales and national income (GDP). In the last 5 years, bike sales increased by 5%, 9%, 5%, 6% and 10%, whereas GDP increased by 2,5%, 4%, 3%, 2,5%, 4%. What is the relationship between bike sales and GDP?
UnB - Financial Econometrics I Otavio Medeiros 31 The past relationship between bike sales growth and GDP growth is given by: y t = x t Example 2: Solution 1
UnB - Financial Econometrics I Otavio Medeiros 32 Hint: to avoid working with decimals, we can multiply y and x by 100. To find the correct final result, divide by 100. doesn’t change. Example 2: Solution 2
UnB - Financial Econometrics I Otavio Medeiros 33 Graph (Excel):
UnB - Financial Econometrics I Otavio Medeiros 34 Goodness of fit: A measure of the goodness of fit of a regression is the coefficient of determination R 2, which is defined as:
UnB - Financial Econometrics I Otavio Medeiros 35 Goodness of fit: When all the residuals are equal to nil, R 2 = 1, meaning that the regression is perfect, with all data points located on the line. When thenR 2 = 0, meaning that there is no regression. Hence, the range for R 2 will be: 0 < R 2 < 1 Values of R 2 close to 1 indicate a good regression, while low values of R 2 indicate a bad or inexisting regression.
UnB - Financial Econometrics I Otavio Medeiros 36 Calculation of R 2 – Example 1:
UnB - Financial Econometrics I Otavio Medeiros 37 Calculation of R 2 – Example 2: