标题: Mahalanobis distances on a heat map [打印本页] 作者: shiyiming 时间: 2012-2-17 12:52 标题: Mahalanobis distances on a heat map From Dapangmao's blog on sas-analysis
<div class="separator" style="clear: both; text-align: center;"><a href="http://1.bp.blogspot.com/-bccx7mtmT64/Tz3NhKhJ9hI/AAAAAAAAA7U/ixPJe2yxiIM/s1600/SGRender20.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="300" src="http://1.bp.blogspot.com/-bccx7mtmT64/Tz3NhKhJ9hI/AAAAAAAAA7U/ixPJe2yxiIM/s400/SGRender20.png" width="400" /></a></div><br />
I just learned Mahalanobis distance from <a href="http://blogs.sas.com/content/iml/2012/02/15/what-is-mahalanobis-distance/">Rick’s blog post</a> yesterday, and realized <a href="http://blogs.sas.com/content/iml/2012/02/02/detecting-outliers-in-sas-part-3-multivariate-location-and-scatter/">its significance in detecting outliers</a>. One of SAS’s online documents shows how to <a href="http://support.sas.com/kb/30/662.html">use PCA method to find Mahalanobis distances</a>. And in SAS 9.3, the popular <a href="http://blogs.sas.com/content/graphicallyspeaking/2011/12/08/calendar-heatmaps-in-gtl/">heat map</a> becomes available<br />
<br />
SAS’s classic help dataset SASHELP.CLASS has weight, height, age and some other information for 19 teenagers. I calculated the pair-wise Mahalanobis distances according to their age, weight and height, and showed those distances on a heat map. It seems that it is helpful to tell how similar two teenagers are to each other.<br />
<br />
<pre style="background-color: #ebebeb; border: 1px dashed rgb(153, 153, 153); color: #000001; font-size: 14px; line-height: 14px; overflow: auto; padding: 5px; width: 100%;"><code>
/* 1 -- Find pairwise Mahalanobis distances */
proc princomp data=sashelp.class std out=_1 noprint;
var age weight height;
run;