Presentation is loading. Please wait.

Presentation is loading. Please wait.

Psychology 202b Advanced Psychological Statistics, II January 25, 2011.

Similar presentations


Presentation on theme: "Psychology 202b Advanced Psychological Statistics, II January 25, 2011."— Presentation transcript:

1 Psychology 202b Advanced Psychological Statistics, II January 25, 2011

2 Overview Continuing discussion of matrices. Matrices in R. The identity matrix. Matrix inversion. Singularity and determinants. Eigenvalues. A taste of why matrices are useful in statistics.

3 Matrices in R Three ways to create a matrix in R: –cbind() –rbind() –matrix()

4 The identity matrix The rank of a matrix is the number of linearly independent rows or columns it has. Example: has rank=3. In contrast, has rank=2, because the last row is exactly two times the first row.

5 The identity matrix (cont.) The identity matrix I of rank k is defined as the k  k diagonal matrix with all diagonal values equal to 1. It is so called because any matrix of rank k that pre- or post-multiplies the identity matrix is equal to itself. That is, AI = A = IA.

6 Matrix inverses The Inverse of a square matrix A (denoted A -1 ) is the square matrix of the same rank such that A A -1 = A -1 A = I. An easy way to understand the inverse is to think of it as the matrix equivalent of division.

7 Matrix inverses (cont.) The inverse of a diagonal matrix is simply the diagonal matrix containing the reciprocals of the original diagonal elements. (Illustration in R.)

8 Matrix inverses (cont.) The inverse of a 2  2 matrix is where a, b, c, and d are the upper left, upper right, lower left, and lower right elements of the matrix.

9 Matrix inverses (cont.) The inverses of matrices of higher rank are tedious to calculate by hand. Fortunately, R can invert matrices for us. (Digression in R.)

10 Singularity and determinants That last example produced a strange error message. By describing the system of equations as singular, R is telling us that the matrix cannot be inverted. Note the similarity of this language to terms used in physics: a black hole is nature’s divide-by-zero error.

11 Singularity and determinants (cont.) One way to determine if a matrix is singular is to examine its determinant. The calculation of a determinant is complicated, and the idea of the determinant is defined in terms of that process. We won’t go there.

12 Singularity and determinants (cont.) The most common mathematical notation for the determinant of a matrix A is |A|. For us, the determinant will be important because a square matrix is singular if and only if its determinant is zero. (Illustration in R.)

13 Eigenvalues A scalar value λ is an eigenvalue of a k  k square matrix A if it satisfies |A – λI| = 0, where I is the k  k identity matrix. Each eigenvalue has a corresponding eigenvector x, which satisfies Ax = λx. Eigenvalues will be useful later on because they help us with linear transformations of matrices.

14 Why do matrices help with statistics? Imagine that you wish to calculate a variance. The defining formula for the sample variance is However, if we must do the calculations by hand, it is useful to know that the numerator is equivalent to

15 Why do matrices help? (cont.) (Simple illustration on board, followed by Raven example in R.) So with creative use of matrices, a relatively complicated set of operations can be expressed as a single operation.

16 Another example of matrices helping. For simple linear regression, we estimate a slope by Then we estimate the intercept by

17 Another example (cont.) In matrix form, this becomes where X is an n  2 matrix with ones in the first column and values of the predictor in the second column.


Download ppt "Psychology 202b Advanced Psychological Statistics, II January 25, 2011."

Similar presentations


Ads by Google