<?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/vectors using correlation matrix? in SAS/IML Software and Matrix Computations</title>
    <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Eigenvalues-vectors-using-correlation-matrix/m-p/652780#M5129</link>
    <description>&lt;P&gt;Thank you!!&lt;/P&gt;</description>
    <pubDate>Wed, 03 Jun 2020 08:01:22 GMT</pubDate>
    <dc:creator>axelpuri</dc:creator>
    <dc:date>2020-06-03T08:01:22Z</dc:date>
    <item>
      <title>Eigenvalues/vectors using correlation matrix?</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Eigenvalues-vectors-using-correlation-matrix/m-p/652760#M5127</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;im using the following code for obtaining eigenvalues / vectors for deriving principal components&amp;nbsp; .&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My data-lines have a covariance matrix.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data have(type=cov); /* leave off a lot of the TYPE=COV data for simplicity */&lt;BR /&gt;_type_='COV';&lt;BR /&gt;input m1 m2 m3 m4;&lt;BR /&gt;datalines;&lt;BR /&gt;18.8767 26.8567 7.5550 -5.1533&lt;BR /&gt;26.8567 47.2433 5.1033 -15.2300&lt;BR /&gt;7.5550 5.1033 92.1900 58.8983&lt;BR /&gt;-5.1533 -15.2300 58.8983 48.5233&lt;BR /&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;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;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It works perfectly but what do i need to do while trying to use a correlation matrix ? when i change the cov to cor i get an error that the system is not expecting COR&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So I tried the code below but this throws an error&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ERROR: (execution) Matrix should be square.&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;ERROR: Matrix eigvals has not been set to a value.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc iml;&lt;/P&gt;&lt;P&gt;sigma={1.00000 0.89933 0.18110 -0.17027&lt;BR /&gt;0.89933 1.00000 0.07733 -0.31809&lt;BR /&gt;0.18110 0.07733 1.00000 0.88061&lt;BR /&gt;-0.17027 -0.31809 0.88061 1.00000};&lt;/P&gt;&lt;P&gt;eigvals=eigval(sigma);&lt;BR /&gt;eigvec=eigvec(sigma);&lt;BR /&gt;print eigvals;&lt;BR /&gt;print eigvec;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Many thanks.&amp;nbsp;&lt;/P&gt;&lt;DIV class="sasError"&gt;&amp;nbsp;&lt;/DIV&gt;</description>
      <pubDate>Wed, 03 Jun 2020 05:39:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Eigenvalues-vectors-using-correlation-matrix/m-p/652760#M5127</guid>
      <dc:creator>axelpuri</dc:creator>
      <dc:date>2020-06-03T05:39:59Z</dc:date>
    </item>
    <item>
      <title>Re: Eigenvalues/vectors using correlation matrix?</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Eigenvalues-vectors-using-correlation-matrix/m-p/652778#M5128</link>
      <description>&lt;P&gt;I think the issue with PRINCOMP is that the correct syntax is TYPE=CORR with two 'R's.&lt;/P&gt;
&lt;P&gt;The error message from IML is informative since sigma is not square, actually it is a row vector.&amp;nbsp; To declare a matrix you need to add commas at the end of the rows like this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;sigma={ 1.00000  0.89933 0.18110 -0.17027,
        0.89933  1.00000 0.07733 -0.31809,
        0.18110  0.07733 1.00000  0.88061,
       -0.17027 -0.31809 0.88061  1.00000};&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 03 Jun 2020 07:54:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Eigenvalues-vectors-using-correlation-matrix/m-p/652778#M5128</guid>
      <dc:creator>IanWakeling</dc:creator>
      <dc:date>2020-06-03T07:54:00Z</dc:date>
    </item>
    <item>
      <title>Re: Eigenvalues/vectors using correlation matrix?</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Eigenvalues-vectors-using-correlation-matrix/m-p/652780#M5129</link>
      <description>&lt;P&gt;Thank you!!&lt;/P&gt;</description>
      <pubDate>Wed, 03 Jun 2020 08:01:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Eigenvalues-vectors-using-correlation-matrix/m-p/652780#M5129</guid>
      <dc:creator>axelpuri</dc:creator>
      <dc:date>2020-06-03T08:01:22Z</dc:date>
    </item>
    <item>
      <title>Re: Eigenvalues/vectors using correlation matrix?</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Eigenvalues-vectors-using-correlation-matrix/m-p/652797#M5130</link>
      <description>&lt;P&gt;You do not need to type in the matrix. You can use the &lt;A href="https://go.documentation.sas.com/?docsetId=imlug&amp;amp;docsetTarget=imlug_langref_sect095.htm&amp;amp;docsetVersion=15.1&amp;amp;locale=en" target="_self"&gt;COV2CORR function in SAS/IML&lt;/A&gt; to rescale the covariance matrix into a correlation matrix.&lt;/P&gt;</description>
      <pubDate>Wed, 03 Jun 2020 09:43:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Eigenvalues-vectors-using-correlation-matrix/m-p/652797#M5130</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2020-06-03T09:43:30Z</dc:date>
    </item>
  </channel>
</rss>

