1
$\begingroup$

I'm trying to compute the pdf of a wishart distribution.

Why does

PDF[WishartMatrixDistribution[10, IdentityMatrix[4]], 
 2*IdentityMatrix[4]]

not return a number? The output I get is exactly the same line of code... There are no error warnings, nothing.

$\endgroup$
  • 1
    $\begingroup$ I just changed the title to reflect the fact that the problem pertains to WishartMatrixDistribution and not to WishartDistribution - this may be misleading. Change it back if you are not comfortable with that. $\endgroup$ – gwr Nov 23 '18 at 11:30
  • $\begingroup$ I believe the matrix distributions do not work with PDF. $\endgroup$ – Szabolcs Nov 23 '18 at 18:31
4
$\begingroup$

Unfortunately, it seems that WishartMatrixDistribution cannot be used with PDF. But you can use the MultivariateStatistics package:

Needs[ "MultivariateStatistics`"];
PDF[ WishartDistribution[ IdentityMatrix[4], 10], 2*IdentityMatrix[4] ]

$\frac{1}{1\,814\,400\,e^4\,\pi^4}$

The definition for WishartDistribution is exactly the same as that for the WishartMatrixDistribution as far as I can see - but the parameterization is reverted.

$\endgroup$
  • $\begingroup$ As a further comment, PDF does not work with WishartMatrix not even when you sample from it and then plug the values into PDF[dist, x]. The documentation suggests a Series expansion, but for distributions without known functional forms - which Wishart and Inverse Wishart have. Also, the parametrisation is indeed reversed. $\endgroup$ – Titus Nov 23 '18 at 11:17
  • $\begingroup$ gwr, thanks for the answer. It seems to work now, but something seems off. Now, in the programme, when I use MultinormalDistribution or the MultivariateTDistribution, their names show in a different colour, as if they were spelled wrong... Do you have an idea of what's happening? $\endgroup$ – An old man in the sea. Nov 23 '18 at 11:20
  • $\begingroup$ @Anoldmaninthesea. That is called shadowing and you can read up on it here. Once you start with a fresh kernel and load the package first everything should be fine again. $\endgroup$ – gwr Nov 23 '18 at 11:22
  • $\begingroup$ That's the thing... I quit the kernel, and rebooted it, and I still get the same red colour... $\endgroup$ – An old man in the sea. Nov 23 '18 at 11:23
  • $\begingroup$ @Anoldmaninthesea. You need to load the package first before you use the symbol. There is more explanation in the link I sent you and has to do with Contexts. $\endgroup$ – gwr Nov 23 '18 at 11:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.