9
$\begingroup$

I want to be able to generate a covariance matrix of dimensions $D$ x $D$, such that certain specified cells of this matrix contain a fixed predetermined values (at least approximately).

For e.g. For matrix, $S$ = $$ \begin{matrix} a_{11} & a_{12} & \ldots & a_{1D}\\ a_{21} & a_{22} & \ldots & a_{2D}\\ \vdots & \vdots & \ddots & \vdots\\ a_{D1} & a_{D2} &\ldots & a_{DD} \end{matrix} $$

I want to make sure that certain $a_{i,j}$ 's have a predetermined value.

(If I were generating a covariance matrix without this constraint, I would just use a Wishart Random Generator. In Matlab, it would be something like - W = wishrnd([1 0.5; 0.5 3],30)/30)

One way I can think of this problem is that different cells of the covariance matrix have different degrees of freedom. So that the cells with fixed values can be assumed to have infinite degrees of freedom and the rest as some finite number.

$\endgroup$
1
  • $\begingroup$ Is there any way to translate the constraint into one on the square root of the covariance? or the square root of the inverse covariance? $\endgroup$
    – shabbychef
    Commented Jul 22, 2013 at 22:02

1 Answer 1

6
$\begingroup$

It should be possible to sample from a Wishart distribution conditional on some of the entries being fixed. It may not be possible out-of-the-box with any of the BUGS-like languages (e.g. JAGS or STAN), but you may be able to rely on the Wishart's distribution with the Gaussian as described on page 5 of this document.

Edited to add: It looks like the STAN manual addresses this issue directly on page 40 (section 8.2, "Partially Known Parameters"). PDF here. Their covariance matrix is small, but it should be possible to do the same thing with a bigger one. Stan's Hamiltonian Monte Carlo should be quite fast, so you can ignore the brute force approach in the next paragraph.

The following advice is probably not useful, but I'll keep it below for posterity:

Alternatively, since you say you just need the values to be similar to their fixed values, you could just keep resampling with wishrnd until you get something that's close enough. See rejection sampling and Approximate Bayesian Computation. The MCMC-type methods from my first paragraph could be overkill.

$\endgroup$
4
  • 1
    $\begingroup$ The first paragraph needs more serious consideration, because rejection sampling is going to be awful when just one value is fixed (within some reasonably narrow range) and impossibly slow for more than one value. $\endgroup$
    – whuber
    Commented Jun 11, 2013 at 19:21
  • $\begingroup$ @whuber you're right probably about the slowness when the number of values increases and the proposal distribution isn't great, but could you clarify the first part? $\endgroup$ Commented Jun 11, 2013 at 19:54
  • $\begingroup$ I meant that I think your suggestions about rejection sampling should be discounted but the idea in the first paragraph looks promising (and I upvoted your reply to reflect that). $\endgroup$
    – whuber
    Commented Jun 11, 2013 at 20:21
  • 1
    $\begingroup$ Thanks David and @whuber I am not very familiar with JAGS, STAN, so it will take me some time to understand your answer. I have upvoted your answer for now. $\endgroup$
    – steadyfish
    Commented Jun 12, 2013 at 18:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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