From Wikipedia, we know that $n$, the degrees of freedom, should be larger than $p-1$ where $p$ is the dimension of the scale matrix.
Also, from the bottom part of the same article, we see "Bartlett decomposition" to sample Wishart distribution where the diagonal element is generated from $\chi^{2}(n - i + 1)$.
However, if you type the following commands in Matlab 2011b:
Sigma = eye(2)
nu = 1
wishrnd(Sigma,nu)
It will return something! Here, nu
(degrees of freedom) is no longer greater than the dimension of the scale matrix, right?
Also, if you look close in to the implementation of wishrnd
by issuing type wishrnd
, we see the following line:
a = diag(sqrt(chi2rnd(df-(0:n-1))));
Clearly, the implementation generates $\chi^{2}(n-i)$ instead of $\chi^{2}(n-i+1)$.
Something incompatible here?