{"id":4296,"date":"2014-10-02T01:33:36","date_gmt":"2014-10-02T06:33:36","guid":{"rendered":"http:\/\/www.thejuliagroup.com\/blog\/?p=4296"},"modified":"2014-10-02T01:35:30","modified_gmt":"2014-10-02T06:35:30","slug":"matrix-algebra-just-because","status":"publish","type":"post","link":"https:\/\/www.thejuliagroup.com\/blog\/matrix-algebra-just-because\/","title":{"rendered":"Matrix Algebra, Just Because"},"content":{"rendered":"<p>I was talking to a friend of mine today who had taken a test for a new job recently and he had a hard time with the math portion of it. We were in college about the same time and he did perfectly fine in math, but it had been a while. This got me to thinking that I should review things like matrix algebra from time to time, just because it has been a while since I had any need to multiply a matrix without a computer. Well, actually, I can&#8217;t imagine that I will ever have such a need but since I&#8217;m teaching multivariate statistics and the textbooks generally have a lot of matrix algebra, I thought I should brush up on it whether I ever need it or not.<\/p>\n<p>I had the normal equations for regression drilled into my brain in graduate school and there was a time in my life when I actually had spare time when I found solving systems of linear equations something amusing to do. All of that was a very long time ago.<\/p>\n<p>So &#8230;. as I sit here thinking what do my students need to know, I run into the Goldilocks problem yet again. Nothing seems just right. Teaching multiplying a scalar by a matrix seems a waste of time, no matter how brief. All you do is multiply every number in the matrix by that value. Okay, got it.<\/p>\n<p>They should know what an Identity matrix is. This could actually have some useful implications in statistics. If your correlation matrix is close to an identity matrix, with 1 in the diagonals and 0s in the off-diagonal then it tells you that your variables are uncorrelated. If you analyzed a matrix of random data, this is exactly what you would expect to get.<\/p>\n<p>If you multiply a matrix by the identity matrix, I, you are going to get the original matrix as a result, hence the name, identity matrix.<\/p>\n<p>IA = A<\/p>\n<p>This is analogous to the identity property of scalar (that is, regular numbers, not matrices) multiplication that 1X = X<\/p>\n<p>The determinant of a matrix is, for a 2 x 2 matrix,\u00a0 of this form<\/p>\n<p>a b<\/p>\n<p>c d<\/p>\n<p>is equal to<\/p>\n<p>(ad &#8211; bc)<\/p>\n<p>To find the inverse of a matrix, the reciprocal of the determinant, that is 1 \/ (ad-bc), in the case of\u00a0 our same 2 x 2 matrix is multiplied by the following matrix<\/p>\n<p>d -b<\/p>\n<p>c -a<\/p>\n<p><a href=\"https:\/\/www.opened.io\/#!\/resources\/116167\">Here is a really good Khan Academy video on finding the inverse of a matrix.<\/a><\/p>\n<p>This is particularly important in statistics because you will occasionally get a message on your output that the &#8220;determinant is zero&#8221; and it would be helpful to you if you understood what that meant and why it was important.<\/p>\n<p>One important point here is that you need the determinant to find the inverse of a matrix. For example, to find the vector of regression coefficients you would use this equation<\/p>\n<p><a href=\"http:\/\/www.thejuliagroup.com\/blog\/wp-content\/uploads\/2014\/10\/normaleq.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-4297\" src=\"http:\/\/www.thejuliagroup.com\/blog\/wp-content\/uploads\/2014\/10\/normaleq.png\" alt=\"X transpose multiplied by X, take the inverse and multiply by the X matrix\" width=\"176\" height=\"35\" \/><\/a>Notice here that you need to take the inverse of the product of the transpose of the X matrix and the X matrix. What if the determinant is zero? Well, you can&#8217;t divide by zero &#8211; SO THERE IS NO SOLUTION.<\/p>\n<p>At this point, you want to start to chase down why the determinant is zero. Do you have redundant measures? Is there no variance in the sample?<\/p>\n<p>All of this is very interesting to me personally, but aside from that, I keep asking myself whether the students really need an in-depth understanding of matrix algebra when it is all done by a computer. I really don&#8217;t know the answer to that, which is why I keep thinking about it.<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I was talking to a friend of mine today who had taken a test for a new job recently and he had a hard time with the math portion of it. We were in college about the same time and he did perfectly fine in math, but it had been a while. This got me&#8230;<\/p>\n","protected":false},"author":5,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_kad_post_transparent":"","_kad_post_title":"","_kad_post_layout":"","_kad_post_sidebar_id":"","_kad_post_content_style":"","_kad_post_vertical_padding":"","_kad_post_feature":"","_kad_post_feature_position":"","_kad_post_header":false,"_kad_post_footer":false,"_kad_post_classname":"","_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[5,11],"tags":[],"class_list":["post-4296","post","type-post","status-publish","format-standard","hentry","category-algebra","category-statistics"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.thejuliagroup.com\/blog\/wp-json\/wp\/v2\/posts\/4296","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.thejuliagroup.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.thejuliagroup.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.thejuliagroup.com\/blog\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/www.thejuliagroup.com\/blog\/wp-json\/wp\/v2\/comments?post=4296"}],"version-history":[{"count":2,"href":"https:\/\/www.thejuliagroup.com\/blog\/wp-json\/wp\/v2\/posts\/4296\/revisions"}],"predecessor-version":[{"id":4299,"href":"https:\/\/www.thejuliagroup.com\/blog\/wp-json\/wp\/v2\/posts\/4296\/revisions\/4299"}],"wp:attachment":[{"href":"https:\/\/www.thejuliagroup.com\/blog\/wp-json\/wp\/v2\/media?parent=4296"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.thejuliagroup.com\/blog\/wp-json\/wp\/v2\/categories?post=4296"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.thejuliagroup.com\/blog\/wp-json\/wp\/v2\/tags?post=4296"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}