title: Matlab inverse issue - fmri data - partial correlation algorithm
body: <p>I'm using the following code To get a partial correlation matrix (original code from <a href="http://www.fmrib.ox.ac.uk/analysis/netsim/" rel="nofollow">http://www.fmrib.ox.ac.uk/analysis/netsim/</a>)</p>
  
  <pre><code>ic=-inv(cov(ts1)); % raw negative inverse covariance matrix
  r=(ic ./ repmat(sqrt(diag(ic)),1,Nnodes)) ./ repmat(sqrt(diag(ic))',Nnodes,1); % use diagonal to get normalised coefficients
  r=r+eye(Nnodes); % remove diagonal 
  </code></pre>
  
  <p>My original matrix (ts1) is a brain activity over time course (X variable) in multiple voxels -volumetric pixel 3X3 (Y variable).</p>
  
  <p>The problem is, I have more dependent variables(y -voxels  ) than independent variables(x - time course).
  I get the following Warning- </p>
  
  <p>Warning: Matrix is close to singular or badly scaled.
           Results may be inaccurate. RCOND = 4.998365e-022. </p>
  
  <p>Any thoughts on how to fix the code so I'll get the partial correlation between all of the voxels?</p>