MvNormal Error with Symmetric & Positive Semi-Definite Matrix
<p>The summary of my problem is that I am trying to replicate the Matlab function:</p>

<pre><code>mvnrnd(mu', sigma, 200)
</code></pre>

<p>into Julia using:</p>

<pre><code>rand( MvNormal(mu, sigma), 200)'
</code></pre>

<p>and the result is a 200 x 7 matrix, essentially generating 200 random return time series data. </p>

<p>Matlab works, Julia doesn't.</p>

<p>My input matrices are:</p>

<pre><code>mu = [0.15; 0.03; 0.06; 0.04; 0.1; 0.02; 0.12]

sigma = [0.0035   -0.0038   0.0020    0.0017    -0.0006   -0.0028  0.0009;
    -0.0038    0.0046   -0.0011    0.0001    0.0003    0.0054   -0.0024;
    0.0020   -0.0011    0.0041    0.0068   -0.0004    0.0047   -0.0036;
    0.0017    0.0001    0.0068    0.0125    0.0002    0.0109   -0.0078;
    -0.0006    0.0003   -0.0004    0.0002    0.0025   -0.0004   -0.0007;
    -0.0028    0.0054    0.0047    0.0109   -0.0004    0.0159   -0.0093;
    0.0009   -0.0024   -0.0036   -0.0078   -0.0007   -0.0093    0.0061]
</code></pre>

<p>Using Distributions.jl, running the line:</p>

<pre><code>MvNormal(sigma)
</code></pre>

<p>Produces the error: </p>

<pre><code>ERROR: LoadError: Base.LinAlg.PosDefException(4)
</code></pre>

<p>The matrix sigma is symmetrical but only positive semi-definite:</p>

<pre><code>issym(sigma) #symmetrical
&gt; true
isposdef(sigma) #positive definite
&gt; false

using LinearOperators
check_positive_definite(sigma) #check for positive (semi-)definite
&gt; true
</code></pre>

<p>Matlab produces the same results for these tests however Matlab is able to generate the 200x7 random return sample matrix.</p>

<p>Could someone advise as to what I could do to get it working in Julia? Or where the issue lies? </p>

<p>Thanks.</p>