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]

st: 答复: st: generate random data referring to given covariance matrix


From   "Rubi Lam" <[email protected]>
To   <[email protected]>
Subject   st: 答复: st: generate random data referring to given covariance matrix
Date   Tue, 27 Aug 2013 18:32:23 +0800

Thank you for your help Maarten.

Assuming that all the variables follow normal distribution with means at 1
and standard deviations at 0, I attempt to a simulation of PCA or Factor
Analysis with the precondition that some of them have strong correlation
while others do not. Also, I have to predict several main factors within the
variables.
That why I need to pre-set a variance matrix.

The simulation is about to do a Factor Analysis using the random data with
the given covariance, and see whether the result match what I predicted.

So, here is my plan and why I need to pre-set a covariance and save it in
Stata then generate random data from it.

Thank you again Maarten.

Regards,
Rubi

-----邮件原件-----
发件人: [email protected]
[mailto:[email protected]] 代表 Maarten Buis
发送时间: 2013年8月27日 15:41
收件人: [email protected]
主题: Re: st: generate random data referring to given covariance matrix

On Tue, Aug 27, 2013 at 5:42 AM, Rubi Lam wrote:
> - how to save the covariance matrix or the covariance data in Stata?
>
> - how to generate random data for the variables referring to the saved 
> covariance matrix?

The covariance matrix alone does not uniquely identify the distribution from
which you want to draw your data, and without such a distribution you cannot
do what you want to do. I will assume you want to draw from a multivariate
normal distribution and that you also have a vector of means (or that you
are OK with arbitrarily fixing them at 0). In that case, you can use the
-drawnorm- command, see: -help drawnorm-.

-- 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/


*
*   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