Special Topic: Matrix Algebra and the ANOVA Matrix properties Types of matrices Matrix operations Matrix algebra in Excel Regression using matrices ANOVA.

Slides:



Advertisements
Similar presentations
Applied Informatics Štefan BEREŽNÝ
Advertisements

Matrices A matrix is a rectangular array of quantities (numbers, expressions or function), arranged in m rows and n columns x 3y.
APPENDIX A: REVIEW OF LINEAR ALGEBRA APPENDIX B: CONVEX AND CONCAVE FUNCTIONS V. Sree Krishna Chaitanya 3 rd year PhD student Advisor: Professor Biswanath.
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.
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.
Mathematics. Matrices and Determinants-1 Session.
3_3 An Useful Overview of Matrix Algebra
MF-852 Financial Econometrics
Maths for Computer Graphics
Chapter 2 Basic Linear Algebra
ECIV 301 Programming & Graphics Numerical Methods for Engineers Lecture 12 System of Linear Equations.
Review of Matrix Algebra
Chapter 2 Matrices Definition of a matrix.
Ch 7.2: Review of Matrices For theoretical and computation reasons, we review results of matrix theory in this section and the next. A matrix A is an m.
Boot Camp in Linear Algebra Joel Barajas Karla L Caballero University of California Silicon Valley Center October 8th, 2008.
Part 3 Chapter 8 Linear Algebraic Equations and Matrices PowerPoints organized by Dr. Michael R. Gustafson II, Duke University All images copyright © The.
Pam Perlich Urban Planning 5/6020
Linear regression models in matrix terms. The regression function in matrix terms.
Matrices and Determinants
Special Topic: Matrix Algebra and the ANOVA Matrix properties Types of matrices Matrix operations Matrix algebra in Excel Regression using matrices ANOVA.
Matrix Approach to Simple Linear Regression KNNL – Chapter 5.
Intro to Matrices Don’t be scared….
Arithmetic Operations on Matrices. 1. Definition of Matrix 2. Column, Row and Square Matrix 3. Addition and Subtraction of Matrices 4. Multiplying Row.
CE 311 K - Introduction to Computer Methods Daene C. McKinney
3.8 Matrices.
Chapter 7 Matrix Mathematics Matrix Operations Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
1 Statistical Analysis Professor Lynne Stokes Department of Statistical Science Lecture 5QF Introduction to Vector and Matrix Operations Needed for the.
Linear Algebra & Matrices MfD 2004 María Asunción Fernández Seara January 21 st, 2004 “The beginnings of matrices and determinants.
Compiled By Raj G. Tiwari
ECON 1150 Matrix Operations Special Matrices
 Row and Reduced Row Echelon  Elementary Matrices.
Fin500J Mathematical Foundations in Finance Topic 1: Matrix Algebra Philip H. Dybvig Reference: Mathematics for Economists, Carl Simon and Lawrence Blume,
Overview Definitions Basic matrix operations (+, -, x) Determinants and inverses.
Matrices. Definitions  A matrix is an m x n array of scalars, arranged conceptually as m rows and n columns.  m is referred to as the row dimension.
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.
ES 240: Scientific and Engineering Computation. Chapter 8 Chapter 8: Linear Algebraic Equations and Matrices Uchechukwu Ofoegbu Temple University.
Meeting 18 Matrix Operations. Matrix If A is an m x n matrix - that is, a matrix with m rows and n columns – then the scalar entry in the i th row and.
Chapter 2 … part1 Matrices Linear Algebra S 1. Ch2_2 2.1 Addition, Scalar Multiplication, and Multiplication of Matrices Definition A matrix is a rectangular.
Matrices and Determinants
Matrices and Matrix Operations. Matrices An m×n matrix A is a rectangular array of mn real numbers arranged in m horizontal rows and n vertical columns.
2.5 – Determinants and Multiplicative Inverses of Matrices.
LEARNING OUTCOMES At the end of this topic, student should be able to :  D efination of matrix  Identify the different types of matrices such as rectangular,
Boot Camp in Linear Algebra TIM 209 Prof. Ram Akella.
Matrix Algebra Basics Chapter 3 Section 5. Algebra.
Linear Algebra Engineering Mathematics-I. Linear Systems in Two Unknowns Engineering Mathematics-I.
Matrix Algebra Definitions Operations Matrix algebra is a means of making calculations upon arrays of numbers (or data). Most data sets are matrix-type.
Matrices. Variety of engineering problems lead to the need to solve systems of linear equations matrixcolumn vectors.
10.4 Matrix Algebra. 1. Matrix Notation A matrix is an array of numbers. Definition Definition: The Dimension of a matrix is m x n “m by n” where m =
A very brief introduction to Matrix (Section 2.7) Definitions Some properties Basic matrix operations Zero-One (Boolean) matrices.
MATRICES A rectangular arrangement of elements is called matrix. Types of matrices: Null matrix: A matrix whose all elements are zero is called a null.
Matrices. Matrix A matrix is an ordered rectangular array of numbers. The entry in the i th row and j th column is denoted by a ij. Ex. 4 Columns 3 Rows.
College Algebra Chapter 6 Matrices and Determinants and Applications
MTH108 Business Math I Lecture 20.
Matrices and Vector Concepts
3.8 Matrices L Al-zaid Math1101.
Linear Algebraic Equations and Matrices
Linear Algebra review (optional)
Matrix Operations SpringSemester 2017.
Section 7.4 Matrix Algebra.
Matrix Algebra.
Dr Huw Owens Room B44 Sackville Street Building Telephone Number 65891
Matrices and Matrix Operations
MATRICES Operations with Matrices Properties of Matrix Operations
Matrix Algebra.
Basics of Linear Algebra
Linear Algebra review (optional)
Matrix Operations SpringSemester 2017.
3.5 Perform Basic Matrix Operations Algebra II.
3.8 Matrices L Al-zaid Math1101.
Presentation transcript:

Special Topic: Matrix Algebra and the ANOVA Matrix properties Types of matrices Matrix operations Matrix algebra in Excel Regression using matrices ANOVA in matrix notation

Definition of a Matrix a matrix is a rectangular array of elements Matrix order (dimensions or size) –m=#rows, n=#columns  m x n a 13 = 6 matrix element order is 2 x 3

Types of Matrices a single value is called a ‘scalar’ B = 6 a single row is called a ‘row vector’ a single column is called a ‘column vector’

Types of Matrices A square matrix has equal numbers of rows and columns In a symmetric matrix, a ij = a ji a 31 = a 13 = 4 In a diagonal matrix, all off-diagonal elements = 0 An identity matrix is a diagonal matrix with diagonals = 1

Common Variance, Independence e ij are independent, with common variance Off-diagonal elements are zero, showing that there is no covariance (there is independence)

Trace The trace of a matrix is the sum of the elements on the main diagonal (  a ii ) tr(A) = = 20

Matrix Addition and Subtraction Add or subtract corresponding elements of each matrix The order (dimensions) of the matrices must be the same

Matrix Multiplication A r x n B n x c M r x c m 11 = 2*4 + 5*1 + 1*9 + 8*5 = 62 Take the sum of crossproducts of rows from the first matrix with columns from the second matrix The number of columns in the first matrix must be the same as the number of rows in the second matrix

Transpose of a Matrix To transpose a matrix, exchange rows and columns A prime () or a ( T ) is used to denote a transpose Note that AA gives the uncorrected sum of squares and crossproducts for the columns of A Sum of squares on the diagonal Sum of crossproducts a 21  a 12 = 5

Inverse of a Matrix Taking the inverse of a matrix is analagous to division in math It’s easy for diagonal matrices Use (-1) as an exponent to denote an inverse

Inverting a 2x2 Matrix D = ad - bcD = 2*9 – 5*3 = 3 Inverting a 2 x 2 matrix is not too hard Find the determinant (D), often written as |M| For larger matrices, use a computer!

Linear Dependence D = ad - bc D = 2*9 – 6*3 = 0 The matrix is singular because one column can be obtained by multiplying another by a constant (3 in this case) |M| = 0 The rank of a matrix = the number of linearly independent columns (1 in this case) A nonsingular matrix is full rank – the rank equals the total number of columns

Properties of Full Rank Matrices A square, nonsingular matrix has a unique inverse For a full rank matrix A -1 A = AA -1 = I If A -1 exists, then (A -1 ) -1 = A If A -1 exists, and B -1 exists then (AB) -1 = B -1 A -1 Using Excel: MDETERM(G3:I5) = 54 The determinant ≠ 0, so there is a unique inverse

Idempotent Matrices A matrix is idempotent if it can be multiplied by itself and the result is the original matrix AA = A Idempotent matrices must be square The trace of an idempotent matrix is equal to its rank

Generalized Inverse A generalized inverse (M – ) can be obtained for any matrix, but the solution is not unique MM – M = M

Matrix Algebra in Excel A little cumbersome, but may be handy for a limited number of calculations Addition and subtraction are the same as always –Use the usual shortcuts: fill down, fill right, copy, paste To transpose a matrix, there are two options: 1.Copy the original matrix, select a single destination cell, use “paste special” and select the option “Transpose” 2.Use the matrix function TRANSPOSE

Matrix Functions in Excel Examples: MMULT, TRANSPOSE, MINVERSE Steps for Matrix operations (on a PC) –Select destination cells (must be the right dimensions) –Enter the matrix formula –Press F2 –Press Ctrl-Shift-Enter

Regression in Matrix Notation Y = X  + ε b = (XX) -1 XY Linear model Parameter estimates SourcedfSSMS Regression ( uncorrected ) p bXYbXY MSR ResidualN-p YY – bXY MSE Total ( uncorrected )NY p = number of parameters estimated in the model N = total number of observations Correction for mean

Regression example Fit a quadratic curve Y = X  + ε Linear model in matrix notation XY Y i = b 0 + b 1 X i + b 2 X i 2 Solution: b = (XX) -1 XY Using Excel, SAS or R Y i = X i -0.5X i 2

Working with Matrices in R Create a matrix Add matrices C <- A + B Multiply matrices D <- A %*% B Transpose a matrix Xp <- t(X) Invert a matrix XpXinv <- solve(XpX)

ANOVA example TRTY CRD with 3 treatment levels, 2 reps Y = X  + ε Linear model   1  2  3 Reparameterize to make a nonsingular matrix (rank = 3) Let  1 = 0

Recalculating the parameters of interest R uses the first treatment as the standard The result is the same as setting  1 =0 R Code for a one-way ANOVA ONE.crd<-lm(Y ~ TRT, data=ONE) summary(ONE.crd)