Raphael Mrode. Training in quantitative genetics and genomics 30 May 10 June 2016 ILRI, Nairobi. Partner Logo. Partner Logo

Similar documents
Best unbiased linear Prediction: Sire and Animal models

Phys 201. Matrices and Determinants

Matrices. Chapter Definitions and Notations

Multiplying matrices by diagonal matrices is faster than usual matrix multiplication.

Matrix Basic Concepts

. a m1 a mn. a 1 a 2 a = a n

Review of Linear Algebra

3. Properties of the relationship matrix

Mathematics 13: Lecture 10

Lecture 3: Matrix and Matrix Operations

MAC Module 2 Systems of Linear Equations and Matrices II. Learning Objectives. Upon completing this module, you should be able to :

Linear Algebra (Review) Volker Tresp 2018

Numerical Analysis Lecture Notes

1 Multiply Eq. E i by λ 0: (λe i ) (E i ) 2 Multiply Eq. E j by λ and add to Eq. E i : (E i + λe j ) (E i )

Matrices and Vectors

Linear Algebra (Review) Volker Tresp 2017

Lecture 6: Geometry of OLS Estimation of Linear Regession

Lecture 3 Linear Algebra Background

Linear Algebra V = T = ( 4 3 ).

Chapter 1: Systems of linear equations and matrices. Section 1.1: Introduction to systems of linear equations

I = i 0,

Section 9.2: Matrices.. a m1 a m2 a mn

CS100: DISCRETE STRUCTURES. Lecture 3 Matrices Ch 3 Pages:

Matrix & Linear Algebra

Matrices: 2.1 Operations with Matrices

Matrices BUSINESS MATHEMATICS

Introduction. Vectors and Matrices. Vectors [1] Vectors [2]

Linear Algebra and Matrix Inversion

Math Camp II. Basic Linear Algebra. Yiqing Xu. Aug 26, 2014 MIT

A FIRST COURSE IN LINEAR ALGEBRA. An Open Text by Ken Kuttler. Matrix Arithmetic

Kevin James. MTHSC 3110 Section 2.1 Matrix Operations

10: Representation of point group part-1 matrix algebra CHEMISTRY. PAPER No.13 Applications of group Theory

Matrix Algebra & Elementary Matrices

Section 2.2: The Inverse of a Matrix

ANALYTICAL MATHEMATICS FOR APPLICATIONS 2018 LECTURE NOTES 3

Chapter 4 - MATRIX ALGEBRA. ... a 2j... a 2n. a i1 a i2... a ij... a in

Systems of Linear Equations and Matrices

Linear Algebra Review

Systems of Linear Equations and Matrices

MATRIX ALGEBRA AND SYSTEMS OF EQUATIONS. + + x 1 x 2. x n 8 (4) 3 4 2

Matrices and Determinants

MATH 2030: MATRICES ,, a m1 a m2 a mn If the columns of A are the vectors a 1, a 2,...,a n ; A is represented as A 1. .

Elementary Row Operations on Matrices

Chapter 5 Matrix Approach to Simple Linear Regression

Quantitative characters - exercises

Maternal Genetic Models

7.4. The Inverse of a Matrix. Introduction. Prerequisites. Learning Outcomes

Matrix Algebra: Definitions and Basic Operations

Linear Equations and Matrix

Linear Models for the Prediction of Animal Breeding Values

3 (Maths) Linear Algebra

William Stallings Copyright 2010

CHAPTER 6. Direct Methods for Solving Linear Systems

Elementary Linear Algebra

CS 246 Review of Linear Algebra 01/17/19

Linear Algebra. Matrices Operations. Consider, for example, a system of equations such as x + 2y z + 4w = 0, 3x 4y + 2z 6w = 0, x 3y 2z + w = 0.

Linear Algebra Review. Vectors

Introduction to Matrices

Section 9.2: Matrices. Definition: A matrix A consists of a rectangular array of numbers, or elements, arranged in m rows and n columns.

Knowledge Discovery and Data Mining 1 (VO) ( )

Appendix A: Matrices

Chapter 2. Ma 322 Fall Ma 322. Sept 23-27

Matrix Multiplication

MATRICES The numbers or letters in any given matrix are called its entries or elements

CLASS 12 ALGEBRA OF MATRICES

ICS 6N Computational Linear Algebra Matrix Algebra

Matrix Algebra. Matrix Algebra. Chapter 8 - S&B

Vectors and matrices: matrices (Version 2) This is a very brief summary of my lecture notes.

TOPIC III LINEAR ALGEBRA

Elementary maths for GMT

MATH2210 Notebook 2 Spring 2018

MAC Module 1 Systems of Linear Equations and Matrices I

A Review of Matrix Analysis

. =. a i1 x 1 + a i2 x 2 + a in x n = b i. a 11 a 12 a 1n a 21 a 22 a 1n. i1 a i2 a in

Lecture 8: Determinants I

Chapter 1 Matrices and Systems of Equations

Prepared by: M. S. KumarSwamy, TGT(Maths) Page

Matrices. Math 240 Calculus III. Wednesday, July 10, Summer 2013, Session II. Matrices. Math 240. Definitions and Notation.

Matrices and Linear Algebra

Stage-structured Populations

Matrix operations Linear Algebra with Computer Science Application

Matrices and systems of linear equations

Matrix Algebra Determinant, Inverse matrix. Matrices. A. Fabretti. Mathematics 2 A.Y. 2015/2016. A. Fabretti Matrices

1 Matrices and matrix algebra

Matrices. 1 a a2 1 b b 2 1 c c π

Calculus II - Basic Matrix Operations

The Matrix Algebra of Sample Statistics

Review of Vectors and Matrices

Linear Algebra Tutorial for Math3315/CSE3365 Daniel R. Reynolds

Lecture Notes in Linear Algebra

A primer on matrices

Getting Started with Communications Engineering. Rows first, columns second. Remember that. R then C. 1

Properties of Matrices and Operations on Matrices

Lesson U2.1 Study Guide

Addition and subtraction: element by element, and dimensions must match.

Matrix representation of a linear map

CHAPTER 8: Matrices and Determinants

Matrix Operations. Linear Combination Vector Algebra Angle Between Vectors Projections and Reflections Equality of matrices, Augmented Matrix

Elementary Linear Algebra

Linear Algebra review Powers of a diagonalizable matrix Spectral decomposition

Transcription:

Basic matrix algebra Raphael Mrode Training in quantitative genetics and genomics 3 May June 26 ILRI, Nairobi Partner Logo Partner Logo

Matrix definition A matrix is a rectangular array of numbers set in rows and columns. These elements are called the elements of a matrix: Matrix B with 2 rows and 3 columns or B 2x3 or in general B nxm 2 b b b 2 3 B= B = b2 b22 b23 6 8 9 4 5

Matrix definition A matrix is a simple way to order information Pen size Breed A Breed B Breed C Pen 4. 8. 6. Pen 2 5. 9. 8. Pen 3 35.. 2.

Matrix definition A matrix consisting of a single row of elements is called a row vector. y = 2 6-4

Matrix definition A matrix consisting of a single column is called a column vector. - 2 6 d = 8 2 A scalar is matrix with one row and one column.

6 Special matrices Square : equal number of rows and columns Diagonal: A square matrix having zero for all of its offdiagonal elements is referred to as a diagonal matrix (B). When all the diagonal elements of a diagonal matrix are one, it is referred to as an identity matrix (I). In animal breeding, relationship matrix for a group of animals which are unrelated is an identity matrix 8 4 3 B = I =

7 Special matrices Triangular matrices A square matrix with all elements above the diagonal being zero is called a lower triangular matrix (D). In animal breeding, we come across this sort of matrices when we trace a flow of genes from parents to progeny when parents precede progeny in the pedigree. When all the elements below the diagonal that are zeros, it is referred to as an upper triangular matrix (E). Note: D = transpose of E and vice versa 6 8 4 9 3 E 9 7-2 3 4 D = ; =

Symmetric matrix A symmetric matrix is a square matrix with the elements above the diagonal equal to the corresponding elements below the diagonal, that is, element ij is equal to element ji. An example in animal breeding is the relationship matrix that describes the relatedness among animals 2-4 A = - 4 6 3 3 7 8

Basic matrix operations Transpose The transpose of a matrix A usually written as A ' or A T, is the matrix whose ji elements are the ij elements of the original matrix, that is a' ji = a ij. Therefore the transpose of a (m x n) matrix A is the (n x m) matrix where the rows and columns have been swapped. 9

Basic matrix operations Matrix addition and subtraction. Two matrices can be added together only if they have the same number of rows and columns, that is, they are of the same order and they are said to be conformable for addition. Given that W is the sum of the matrices X and Y, then w ij = x ij + y ij. 4 X = 39 ; - 25-2 2 Y= 4 4 4 ( 2) + 2 38 3 W = = 39 + 4-25 + 4 43 5

Basic matrix operations Matrix multiplication Two matrices can be multiplied only if the number of columns in the first matrix equals the number of rows in the second. The order of the product matrix is equal to the number of rows of the first matrix by the number of columns in the second. Given that C = AB, then C c ij m n z ji k a ik b kj where m = number of columns in B, n = number of rows in A and z = number of rows in B.

Basic matrix operations Direct product of matrices Given a matrix G of order 2 by 2 and A of order t by s, the direct product is g G A= g 2 A A g g 2 22 A A G = 5 5 and A= 2 2 4 2 4 2 G A= 5 4 5 2 2 4 2 5 5 2 2 5 2 2 8 2 5 4 8 2 Also known as the Kronecker product. It is useful when you carry out multi-trait analysis 2

Basic matrix operations Matrix inversion An inverse matrix is one which when multiplied by the original matrix gives an identity matrix. The inverse of a matrix A is usually denoted as A -, therefore A - A = I, Only square matrices can be inverted diagonal matrix the inverse is calculated simply as the reciprocal of the diagonal elements. For a 2x2 matrix the inverse is easy to calculate A = a a 2 a a 2 22 a - a - 22 2 A = aa22 - a2a2 - a2 a If (a a 22 a 2 a 2 ) is zero, then an inverse does not exist and matrix is singular 3

Basic matrix operations TRANSPOSES AND INVERSES OF PRODUCTS If we have a product AB, then (AB) T = B T A T If we have a product AB then, assuming the inverses exist, (AB) - = B - A -. 4

Some examples Assume we have 3 animals each with 2 records for milk yield We want to calculate total litres of milk for each animal using matrix algebra Animal Milk yield 2.5 25. 2 3.5 2 5. 3. 3 6. 5

6 Some examples Set up an incidence matrix for the animals X= Set a column vector containing the yield of each animal Finally compute total as follows 6.. 5. 3.5 25. 2.5 y 26. 28.5 37.5 6.. 5. 3.5 25. 2.5 X'Y

7 Some examples Simple simultaneous equations (Eg. Selection index). We want solve for x, y and z 4x + 2y + z = 8 x + 2y z = 2 x y + 2z = 5 Then this set of equations can be described as Cb = y, where C is the (3 x 3) matrix, b =(3x) and y = (3,) vectors C = ; b = ; y = 2 2 4 z y x 5 2 8

Some examples We compute that the inverse of C. Then we solve: Cb = y to get b b = C - y =.5.5.5 8.5.5.67.8332 2.5.5.833.675 3.5 8

Suppose we do a -way ANOVA with fixed effects, on 5 data points with a factor of 3 treatment levels. Data point 2 3 4 5 Factor level (herds) 2 2 3 Observation (y vector) 3 4 2 6 Model: y ij = m + a i + e ij for i =,,5. To fit the model choose a constraint among the treatment levels to allow us to fit the mean, so we shall assume the first treatment level is. We can then write the model as y = Xb + e 9

Some examples Here y is the (5 x ) column vector of data points y T = (3, 4, 2,, 6) e is the (5 x ) column vector of residuals, b is the (3 x ) vector of parameters that need to be estimated; b T = (µ,a 2,a 3 ) X is called the design matrix which relates the model parameters to the data points and has dimension (5,3): 2

Some examples Solve for b as b = (X X) - X y 5 b 2 2 2 65.5.5 26.5..5.5.565.5 26.5 4.5.5 4.5 2

better lives through livestock ilri.org The presentation has a Creative Commons licence. You are free to re-use or distribute this work, provided credit is given to ILRI.

CRP and CG logos