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

Econometrics questions and discussions
lali62
Posts: 21
Joined: Wed Mar 22, 2017 7:04 pm

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

Unread post 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.
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

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

Unread post 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.
lali62
Posts: 21
Joined: Wed Mar 22, 2017 7:04 pm

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

Unread post 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
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

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

Unread post 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.
Post Reply