<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/244691</link>
    <title>MATLAB Central Newsreader - singular covariance matrix and svd</title>
    <description>Feed for thread: singular covariance matrix and svd</description>
    <language>en-us</language>
    <copyright>&amp;copy;1994-2012 by MathWorks, Inc.</copyright>
    <webmaster>webmaster@mathworks.com</webmaster>
    <generator>MATLAB Central Newsreader</generator>
    <docs>http://blogs.law.harvard.edu/tech/rss</docs>
    <ttl>60</ttl>
    <image>
      <title>MathWorks</title>
      <url>http://www.mathworks.com/images/membrane_icon.gif</url>
    </image>
    <item>
      <pubDate>Tue, 17 Feb 2009 10:33:01 -0500</pubDate>
      <title>singular covariance matrix and svd</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/244691#628804</link>
      <author>francesco santi</author>
      <description>Hello to everybody.&lt;br&gt;
Here is my problem:&lt;br&gt;
I have to compute a covariance matrix S at each step of my algorithm.&lt;br&gt;
This is done over an image matrix.&lt;br&gt;
The image matrix values are normalized to [0,1].&lt;br&gt;
Problems arise when I have to compute the determinant of S or its inverse.&lt;br&gt;
Sometimes it happens that S is singular or close to singular so I get numerical instability. Should it happen, all the formulas following the computation of S will have a Nan or Inf value and the algorithm would not converge.&lt;br&gt;
I've found out the svd Matlab built-in function and I was wondering if it might be helpful to solve my probem and how.&lt;br&gt;
&lt;br&gt;
The general solution is to analyzie the covariance matrix before passing it to other formulas and modify the values that make it singular.&lt;br&gt;
The question is: how?&lt;br&gt;
&lt;br&gt;
Any help would be appreciated.&lt;br&gt;
Thanks in advance.</description>
    </item>
    <item>
      <pubDate>Tue, 17 Feb 2009 11:58:47 -0500</pubDate>
      <title>Re: singular covariance matrix and svd</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/244691#628824</link>
      <author>Rune Allnor</author>
      <description>On 17 Feb, 11:33, &quot;francesco santi&quot; &amp;lt;fpsa...@gmail.com&amp;gt; wrote:&lt;br&gt;
&amp;gt; Hello to everybody.&lt;br&gt;
&amp;gt; Here is my problem:&lt;br&gt;
&amp;gt; I have to compute a covariance matrix S at each step of my algorithm.&lt;br&gt;
&amp;gt; This is done over an image matrix.&lt;br&gt;
&amp;gt; The image matrix values are normalized to [0,1].&lt;br&gt;
&amp;gt; Problems arise when I have to compute the determinant of S or its inverse.&lt;br&gt;
&amp;gt; Sometimes it happens that S is singular or close to singular so I get numerical instability.&lt;br&gt;
&lt;br&gt;
If the matrix is singular, the determinant is 0, or&lt;br&gt;
nearly 0. T&lt;br&gt;
&lt;br&gt;
&amp;gt; Should it happen, all the formulas following the computation of S will have a Nan or Inf value and the algorithm would not converge.&lt;br&gt;
&lt;br&gt;
In that case you either work with an ill-conditioned problem,&lt;br&gt;
use the wrong algorithm, or use an unstable implementation.&lt;br&gt;
Or all of the above.&lt;br&gt;
&lt;br&gt;
&amp;gt; I've found out the svd Matlab built-in function and I was wondering if it might be helpful to solve my probem and how.&lt;br&gt;
&lt;br&gt;
The SVD *might* be helpful for certain types of problems,&lt;br&gt;
but not all. Learning what the SVD is, how it works and&lt;br&gt;
how to use it is far beyond USENET, the ideal approach&lt;br&gt;
is to take a class on linear algebra.&lt;br&gt;
&lt;br&gt;
If that's not an option, find a copy of Strang's &quot;Linear&lt;br&gt;
Algebra and its Applications&quot; and read.&lt;br&gt;
&lt;br&gt;
Rune</description>
    </item>
    <item>
      <pubDate>Tue, 17 Feb 2009 16:25:04 -0500</pubDate>
      <title>Re: singular covariance matrix and svd</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/244691#628904</link>
      <author>Roger Stafford</author>
      <description>&quot;francesco santi&quot; &amp;lt;fpsanti@gmail.com&amp;gt; wrote in message &amp;lt;gne3ot$cs9$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; ......&lt;br&gt;
&amp;gt; The general solution is to analyzie the covariance matrix before passing it to other formulas and modify the values that make it singular.&lt;br&gt;
&amp;gt; ......&lt;br&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;Francesco, it would be more appropriate in my opinion to determine the eigenvalues of S rather than using singular value decomposition.  For covariance matrices the eigenvalues must all be real and non-negative.  They become singular when any of these eigenvalues is zero.  If you artificially alter the singular values from 'svd', you could end up with a matrix that is no longer a valid covariance matrix - that is, no longer positive semi-definite - but if all eigenvalues are kept positive this can't happen.&lt;br&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;However, the idea of artificially altering a covariance matrix simply to make some numerical procedure work seems contrived to me.  Perhaps you should take Rune's advice and consider a change in algorithm for handling singular covariance situations.  As you undoubtedly are aware, such an occurrence indicates some linear relationship strictly holds among the variables you are working with.  At least one of them can be exactly predicted from others.  You really ought to be able to handle such relationships in the way you process your data other than resorting to artifices such as changing covariance matrices.  Otherwise you may draw unwarranted conclusions from your analysis.&lt;br&gt;
&lt;br&gt;
Roger Stafford</description>
    </item>
  </channel>
</rss>

