Page 1 of 1

%ranmvkron(S,X) fn compared to similar fn in R

Posted: Wed Jun 14, 2017 5:11 pm
by lali62
Hi,
In the %ranmvkron(S,X) fn, the dimensions of S are n*n and X is k*k and returns a draw of dimension n*k.

When I compare this with functions used for drawing from mv normal distribution in R. I find the row dimension needs to be same for mu and sigma. Like for the below fn in R:
https://stat.ethz.ch/R-manual/R-devel/l ... rnorm.html
mu will be a k*1 vector and sigma will be a square covariance matrix of dimesion k.

Re: %ranmvkron(S,X) fn compared to similar fn in R

Posted: Wed Jun 14, 2017 7:12 pm
by TomDoan
I'm assuming that there's no similar function in R. What you're looking at in R is going to be similar to the %RANMVNORMAL (which draws a mean zero vector, so you add the mean vector separately). %RANMVKRON is a specialized routine which takes advantage of the structure of Kroneker products to substantially speed up draws for VAR's. See

https://estima.com/docs/RATS%209%20User ... f#page=533

Note that neither of the two components is the mean---their Kroneker product forms a factor of the covariance matrix of the random variable.

Re: %ranmvkron(S,X) fn compared to similar fn in R

Posted: Thu Jun 15, 2017 9:11 am
by lali62
Is there a way to see the routine behind this.
I believe its not similar to kronecker fn in R
https://stat.ethz.ch/R-manual/R-devel/l ... ecker.html

Re: %ranmvkron(S,X) fn compared to similar fn in R

Posted: Thu Jun 15, 2017 9:28 am
by TomDoan
Needless to say, we don't support R and it's not clear how the C code could help anyway. Just work out the matrix algebra for (A (x) B)u; there's a lot of reusable calculations.