Is MultinormalDistribution[]
efficient and easy to use for high dimensions?
I have a variable $n$ representing the dimension of a Monte Carlo integration I do on a multivariate Gaussian copula, where typical values of $n$ are near 100. I am using a simple correlation matrix made from ConstantArray[ρ, {n,m}]
(except on the diagonal).
For now I simply wrote a function that calls RandomVariate[NormalDistribution[0,1], {n,m}]
, generates the correlation matrix, calculates its Cholesky decomposition, and then multiplies to obtain the correlated multivariate normal samples. It works fine and was easy to code and understand.
However, generating correlated multivariate $t$ samples is more involved, so it would be convenient to just drop in a call to MultivariateTDistribution[]
. That leaves me with two issues:
- Setting up
MultinormalDistribution[]
with an arbitrary variable count is hard because it seems to want variable names, which I am having trouble generating programmatically. - I am not sure that the internals of
RandomVariate
onMultinormalDistribution[]
andMultivariateTDistribution[]
are set up to efficiently obtain high-dimensional sample sets.
If the efficiency is not expected to be that great I will stick with my current approach. Otherwise I would appreciate advice on using MultinormalDistribution
in this high-dimensional context, since it would be worth investing the time in this more elegant and Mathematica-like approach.
MultinormalDistribution
"seeming to want variable names." TryRandomVariate[ MultinormalDistribution[ConstantArray[1, 100], IdentityMatrix[100]], 1]
for instance. $\endgroup$Parallelize
may be a smart thing to use here as well. $\endgroup$SeedRandom[Method->"MKL"]
) for better performance if you're on Win/Linux.Parallelize
can be tricky---it'll generally only parallelize certain functional constructs (Map
,Table
, etc.), and the evaluations will run in separate processes (not threads), so communication overhead can be significant. It is very nice and easy to use though when the evaluations that run in parallel each take a long time and are independent of each other. $\endgroup$Parallelize
worked well if and only if I specifiedMethod -> "CoarsestGrained"
. But in that case it was brilliant. $\endgroup$