<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Eigenvalues in SAS/IML Software and Matrix Computations</title>
    <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Eigenvalues/m-p/150078#M1364</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;PROC PRINCOMP thinks that the values in the HAVE data set are observations.&amp;nbsp; PROC PRINCOMP can compute the eigenvalues and eigenvector of SYMMETRIC matrices. However, you have to use a TYPE=COV data set and you have to use the COV option on the PROC PRINCOMP stmt.&amp;nbsp; For unsymmetric matrices, PROC PRINCOMP will give you an error.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The correct way to do it (for SYMMETRIC matrices) is as follows:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data have(type=cov);&amp;nbsp; /* leave off a lot of the TYPE=COV data for simplicity */&lt;BR /&gt;_type_='COV';&lt;BR /&gt;input m1-m3;&lt;BR /&gt;datalines;&lt;BR /&gt;0.145373 -0.261593&amp;nbsp;&amp;nbsp; 1.4433602&lt;BR /&gt;-0.261593 1.0143407 -0.116446&lt;BR /&gt;1.4433602 -0.116446&amp;nbsp; 0.9282068&lt;BR /&gt;;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ods select eigenvalues eigenvectors;&lt;BR /&gt;proc princomp data=have(TYPE=COV) cov;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc iml;&lt;BR /&gt;use have; read all var _NUM_ into M; close;&lt;BR /&gt;eigm=eigval(m);&lt;BR /&gt;print eigm; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 18 Sep 2014 15:28:30 GMT</pubDate>
    <dc:creator>Rick_SAS</dc:creator>
    <dc:date>2014-09-18T15:28:30Z</dc:date>
    <item>
      <title>Eigenvalues</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Eigenvalues/m-p/150071#M1357</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear all,&lt;/P&gt;&lt;P&gt;I need to find the eigenvalues of&amp;nbsp; 3*3 matrix.&lt;/P&gt;&lt;P&gt;I get 3*2 matrix as an answer for eigenvalues. (The second column is zero's)&lt;/P&gt;&lt;P&gt;How can it be? Why I don't get a vector?&lt;/P&gt;&lt;P&gt;Thank you,&lt;/P&gt;&lt;P&gt;Orit&lt;/P&gt;&lt;P&gt;I enclose the code:&lt;/P&gt;&lt;P&gt;proc iml;&lt;/P&gt;&lt;P&gt;m={0.145373 0.018866 -0.000675, &lt;/P&gt;&lt;P&gt;-0.261593 1.0143407 0.0145192, &lt;/P&gt;&lt;P&gt;1.4433602 -0.116446 0.9282068};&lt;/P&gt;&lt;P&gt;eigm=eigval(m);&lt;/P&gt;&lt;P&gt;print eigm; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;THE ANSWER:&lt;/P&gt;&lt;TABLE cellpadding="5" cellspacing="0" class="table" frame="box" rules="all" summary="Procedure Iml: eigm"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD class="r data"&gt;0.9882288&lt;/TD&gt;&lt;TD class="r data"&gt;0&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="r data"&gt;0.9467909&lt;/TD&gt;&lt;TD class="r data"&gt;0&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="r data"&gt;0.1529008&lt;/TD&gt;&lt;TD class="r data"&gt;0&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 18 Sep 2014 12:04:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Eigenvalues/m-p/150071#M1357</guid>
      <dc:creator>oriti</dc:creator>
      <dc:date>2014-09-18T12:04:38Z</dc:date>
    </item>
    <item>
      <title>Re: Eigenvalues</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Eigenvalues/m-p/150072#M1358</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Not sure, how proc iml process this. You can try proc princom to get eigen vectors.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data have;&lt;BR /&gt;input m1 m2 m3;&lt;BR /&gt;datalines;&lt;BR /&gt;0.145373 0.018866 -0.000675 &lt;BR /&gt;-0.261593 1.0143407 0.0145192 &lt;BR /&gt;1.4433602 -0.116446 0.9282068&lt;BR /&gt;;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc princom data=have;&lt;BR /&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 18 Sep 2014 13:37:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Eigenvalues/m-p/150072#M1358</guid>
      <dc:creator>stat_sas</dc:creator>
      <dc:date>2014-09-18T13:37:58Z</dc:date>
    </item>
    <item>
      <title>Re: Eigenvalues</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Eigenvalues/m-p/150073#M1359</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Try something like:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; x={2 2, -1 0};&lt;/P&gt;&lt;P&gt;&amp;nbsp; print (eigval(x));&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;A non-symmetric matrix of reals may have complex eigenvalues, so the second column is for the complex part.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 18 Sep 2014 13:55:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Eigenvalues/m-p/150073#M1359</guid>
      <dc:creator>IanWakeling</dc:creator>
      <dc:date>2014-09-18T13:55:15Z</dc:date>
    </item>
    <item>
      <title>Re: Eigenvalues</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Eigenvalues/m-p/150074#M1360</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;For symmetric matrices, EIGVAL returns a column vector. For nonsymmetric matrices, EIGVAL returns an N x 2 matrix, where the first column is the real part and the second column is the imaginary part.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 18 Sep 2014 14:31:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Eigenvalues/m-p/150074#M1360</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2014-09-18T14:31:23Z</dc:date>
    </item>
    <item>
      <title>Re: Eigenvalues</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Eigenvalues/m-p/150075#M1361</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you for your reply!!&lt;/P&gt;&lt;P&gt;The results between SAS/IML and &lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;proc princom are really different.&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 18 Sep 2014 14:50:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Eigenvalues/m-p/150075#M1361</guid>
      <dc:creator>oriti</dc:creator>
      <dc:date>2014-09-18T14:50:42Z</dc:date>
    </item>
    <item>
      <title>Re: Eigenvalues</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Eigenvalues/m-p/150076#M1362</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you Rick!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 18 Sep 2014 14:56:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Eigenvalues/m-p/150076#M1362</guid>
      <dc:creator>oriti</dc:creator>
      <dc:date>2014-09-18T14:56:22Z</dc:date>
    </item>
    <item>
      <title>Re: Eigenvalues</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Eigenvalues/m-p/150077#M1363</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Can you please share eigen values and eigen vectors obtained through proc iml?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 18 Sep 2014 15:04:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Eigenvalues/m-p/150077#M1363</guid>
      <dc:creator>stat_sas</dc:creator>
      <dc:date>2014-09-18T15:04:11Z</dc:date>
    </item>
    <item>
      <title>Re: Eigenvalues</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Eigenvalues/m-p/150078#M1364</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;PROC PRINCOMP thinks that the values in the HAVE data set are observations.&amp;nbsp; PROC PRINCOMP can compute the eigenvalues and eigenvector of SYMMETRIC matrices. However, you have to use a TYPE=COV data set and you have to use the COV option on the PROC PRINCOMP stmt.&amp;nbsp; For unsymmetric matrices, PROC PRINCOMP will give you an error.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The correct way to do it (for SYMMETRIC matrices) is as follows:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data have(type=cov);&amp;nbsp; /* leave off a lot of the TYPE=COV data for simplicity */&lt;BR /&gt;_type_='COV';&lt;BR /&gt;input m1-m3;&lt;BR /&gt;datalines;&lt;BR /&gt;0.145373 -0.261593&amp;nbsp;&amp;nbsp; 1.4433602&lt;BR /&gt;-0.261593 1.0143407 -0.116446&lt;BR /&gt;1.4433602 -0.116446&amp;nbsp; 0.9282068&lt;BR /&gt;;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ods select eigenvalues eigenvectors;&lt;BR /&gt;proc princomp data=have(TYPE=COV) cov;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc iml;&lt;BR /&gt;use have; read all var _NUM_ into M; close;&lt;BR /&gt;eigm=eigval(m);&lt;BR /&gt;print eigm; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 18 Sep 2014 15:28:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Eigenvalues/m-p/150078#M1364</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2014-09-18T15:28:30Z</dc:date>
    </item>
    <item>
      <title>Re: Eigenvalues</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Eigenvalues/m-p/150079#M1365</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;TABLE cellpadding="5" cellspacing="0" class="table" frame="box" rules="all" summary="Procedure Princomp: Eigenvalues of the Correlation Matrix"&gt;&lt;/TABLE&gt;&lt;TABLE cellpadding="5" cellspacing="0" class="table" frame="box" rules="all" summary="Procedure Princomp: Eigenvalues of the Correlation Matrix"&gt;&lt;/TABLE&gt;&lt;P&gt;The first column is eigenvalue through proc &lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;princom&lt;/SPAN&gt;&lt;/P&gt;&lt;TABLE cellpadding="5" cellspacing="0" class="table" frame="box" rules="all" summary="Procedure Princomp: Eigenvalues of the Correlation Matrix"&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE cellpadding="5" cellspacing="0" class="table" frame="box" rules="all" summary="Procedure Princomp: Eigenvalues of the Correlation Matrix"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TH class="r rowheader" scope="row"&gt;1&lt;/TH&gt;&lt;TD class="r data"&gt;2.55176487&lt;/TD&gt;&lt;TD class="r data"&gt;2.10352974&lt;/TD&gt;&lt;TD class="r data"&gt;0.8506&lt;/TD&gt;&lt;TD class="r data"&gt;0.8506&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TH class="r rowheader" scope="row"&gt;2&lt;/TH&gt;&lt;TD class="r data"&gt;0.44823513&lt;/TD&gt;&lt;TD class="r data"&gt;0.44823513&lt;/TD&gt;&lt;TD class="r data"&gt;0.1494&lt;/TD&gt;&lt;TD class="r data"&gt;1.0000&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TH class="r rowheader" scope="row"&gt;3&lt;/TH&gt;&lt;TD class="r data"&gt;0.00000000&lt;/TD&gt;&lt;TD class="r data"&gt; &lt;/TD&gt;&lt;TD class="r data"&gt;0.0000&lt;/TD&gt;&lt;TD class="r data"&gt;1.0000&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc iml&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;/P&gt;&lt;TABLE cellpadding="5" cellspacing="0" class="table" frame="box" rules="all" style="border: 0px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;" summary="Procedure Iml: eigm"&gt;&lt;TBODY style="font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;&lt;TR style="border: 0px; font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;&lt;TD class="r data" style="padding-right: 4px; padding-left: 4px; border: 0px; font-style: inherit; font-family: inherit;"&gt;0.9882288&lt;/TD&gt;&lt;TD class="r data" style="padding-right: 4px; padding-left: 4px; border: 0px; font-style: inherit; font-family: inherit;"&gt;0&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="border: 0px; font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;&lt;TD class="r data" style="padding-right: 4px; padding-left: 4px; border: 0px; font-style: inherit; font-family: inherit;"&gt;0.9467909&lt;/TD&gt;&lt;TD class="r data" style="padding-right: 4px; padding-left: 4px; border: 0px; font-style: inherit; font-family: inherit;"&gt;0&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="border: 0px; font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;&lt;TD class="r data" style="padding-right: 4px; padding-left: 4px; border: 0px; font-style: inherit; font-family: inherit;"&gt;0.1529008&lt;/TD&gt;&lt;TD class="r data" style="padding-right: 4px; padding-left: 4px; border: 0px; font-style: inherit; font-family: inherit;"&gt;0&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;As you can see the results are really different,&lt;/P&gt;&lt;P&gt;The proc iml results are more logical&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Orit&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 18 Sep 2014 15:31:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Eigenvalues/m-p/150079#M1365</guid>
      <dc:creator>oriti</dc:creator>
      <dc:date>2014-09-18T15:31:42Z</dc:date>
    </item>
    <item>
      <title>Re: Eigenvalues</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Eigenvalues/m-p/150080#M1366</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Dr. Rick,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for your feedback on this. Just to understand it in a better way have a couple of questions. When we use princom it calculates eigen values either using correlation matrix or cov matrix. So if we execute analysis given below, calculations will be done based on symmetric cov matrix . Why we need to feed princomp a cov matrix, if it can be calculated as part of proc princom?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Naeem&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data have;&lt;BR /&gt;input m1 m2 m3;&lt;BR /&gt;datalines;&lt;BR /&gt;0.145373 0.018866 -0.000675 &lt;BR /&gt;-0.261593 1.0143407 0.0145192 &lt;BR /&gt;1.4433602 -0.116446 0.9282068&lt;BR /&gt;;&lt;/P&gt;&lt;P&gt;proc princomp data=have cov;&lt;BR /&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 18 Sep 2014 16:25:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Eigenvalues/m-p/150080#M1366</guid>
      <dc:creator>stat_sas</dc:creator>
      <dc:date>2014-09-18T16:25:49Z</dc:date>
    </item>
    <item>
      <title>Re: Eigenvalues</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Eigenvalues/m-p/150081#M1367</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;A _jive_internal="true" href="https://communities.sas.com/message/229284#229284"&gt;As I said&lt;/A&gt;, by default PROC PRINCOMP thinks that the data in the DATA= option are observations. In your example, it thinks that you are specifying 3 variables, each with three observations. Call that data X. The covariance matrix for X is formed as follows:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; C = X - mean(X);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* center the data */&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; S = (C` * C) / (nrow(X)-1); /* assume no missing values */&lt;/P&gt;&lt;P&gt;In other words, the eigenvalues that are reported for your example are for the covariance matrix S, which is the crossproduct of the centered data, divided by n-1. The IML code is reporting the eigenvalues for X; the PRINCOMP code is reporting the eigenvalues for S.&lt;/P&gt;&lt;P&gt;In my earlier post, I showed that you can specify TYPE=COV as a data set option in order to make PROC PRINCOMP understand that the DATA= data is a covariance matrix, not raw observations.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 18 Sep 2014 17:37:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Eigenvalues/m-p/150081#M1367</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2014-09-18T17:37:32Z</dc:date>
    </item>
    <item>
      <title>Re: Eigenvalues</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Eigenvalues/m-p/150082#M1368</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks so much Dr. Rick. I was just mixing observations with cov matrix. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 18 Sep 2014 17:55:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Eigenvalues/m-p/150082#M1368</guid>
      <dc:creator>stat_sas</dc:creator>
      <dc:date>2014-09-18T17:55:28Z</dc:date>
    </item>
  </channel>
</rss>

