Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: Putting a multivariate normal draw into a matrix?


From   Maarten Buis <[email protected]>
To   [email protected]
Subject   Re: st: Putting a multivariate normal draw into a matrix?
Date   Tue, 7 May 2013 09:29:01 +0200

On Tue, May 7, 2013 at 8:33 AM, Nick Chandler-Klein wrote:
> I'm trying to make a draw from a non-orthogonal multivariate normal
> distribution and use that draw as starting values for a ml routine,
> which means I need the draw to be in matrix form. Is there a way to do
> this?

What about this:

*------------------ begin example ------------------
mata:

V = 1, .2 \ .2, 1

A = cholesky(V)
draw= rnormal(10000,2,0,1)
draw = (A*draw')'

end

*------------------- end example -------------------
* (For more on examples I sent to the Statalist see:
* http://www.maartenbuis.nl/example_faq )

Hope this helps,
Maarten

---------------------------------
Maarten L. Buis
WZB
Reichpietschufer 50
10785 Berlin
Germany

http://www.maartenbuis.nl
---------------------------------
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index