1
$\begingroup$

I searched for a similar question but could not find one.

My problem is sampling from an one-dimensional Wishart distribution. The Mathematica specification is

RandomVariate[WishartDistribution[Y,n]] 

where $Y$ is a $p\times p$ matrix and $n$ is degrees of freedom, $n>p-1$ . So I can sample from a 2-dimensional distribution

Needs["MultivariateStatistics`"]

RandomVariate[WishartDistribution[{{1,0},{0,1}},3]]

but when I set $p=1$ (so that $Y$ is just a number/ a $1\times1$ matrix) I get an error message. My problem is not $n$ but Mathematica not identifying $1 \times 1$ matrices as parameters for a Wishart.

Other than switching to a Chi squared distribution, does anyone know of a way around this? Did I make a mistake somewhere?

Thank you very much in advance.

$\endgroup$
  • 2
    $\begingroup$ Additionally, I don't get an error message. Mathematica 10.3. RandomVariate[WishartDistribution[{{1}}, 3]] $\endgroup$ – Patrick Stevens Oct 26 '15 at 9:14
  • $\begingroup$ That was my problem, I was writing {1} instead of {{1}} and I would get an error. It works fine now, thank you very much! $\endgroup$ – Titus Oct 26 '15 at 9:18
  • $\begingroup$ {1} is a vector; {{1}} is a matrix. Very different things indeed. $\endgroup$ – J. M. will be back soon Oct 26 '15 at 9:34