Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down at the end of May, and its replacement, statalist.org is already up and running.


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

re: Re: st: defining a covariance matrix


From   "Ariel Linden, DrPH" <ariel.linden@gmail.com>
To   <statalist@hsphsun2.harvard.edu>
Subject   re: Re: st: defining a covariance matrix
Date   Thu, 2 May 2013 09:38:35 -0400

Thank you Austin and John!

I realized that neither -drawnorm- or -corr2data- allow the user to specify
both sd() and cov() at the same time, whereas R apparently does (the author
used R for his simulations). In any case, when specifying the covariance
matrix as you provided, the std devs turn out as planned...

Thanks again!

Ariel

Date: Wed, 1 May 2013 14:29:37 -0400
From: Austin Nichols <austinnichols@gmail.com>
Subject: Re: st: defining a covariance matrix

Ariel Linden, DrPH <ariel.linden@gmail.com>:
Poorly written description IMHO, but perhaps like so?

matrix C = (2,1,-1\1,1,-.5\-1,-.5,1)
drawnorm X1 X2 X3, n(1000) cov(C) clear
corr X?, cov


On Wed, May 1, 2013 at 2:21 PM, Ariel Linden, DrPH
<ariel.linden@gmail.com> wrote:
> Hi All,
>
> I am trying to replicate some analyses from a paper, and I came across the
following sentence:
>
> "X1, X2, and X3 are multivariate normal with means zero, variances of (2,
1, 1) and covariances of (1,-1,-0.5) respectively."
>
> Can someone tell me how to define the covariance matrix  as described
above? This rest is easy enough:
>
> *** code****
> matrix m = (0,0,0)
> matrix sd = (sqrt(2),1,1)
> matrix C = ?
> drawnorm X1 X2 X3, n(1000) means(m) sds(sd) cov(C)
>
> Thanks in advance
>
> Ariel
>
>
>
> *
> *   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/

------------------------------

Date: Wed, 01 May 2013 22:32:19 +0200
From: John Antonakis <John.Antonakis@unil.ch>
Subject: Re: st: defining a covariance matrix

Hi Ariel:

Try:

matrix C = (2,1,-1\1,1,-.5\-1,-.5,1)
corr2data x1 x2 x3, cov(C) n(1000)

You can also do this with -ssd-, but only if you estimate the model with 
- -sem-:

ssd init x1 x2 x3
ssd set obs 1000
ssd set cov 2 \ 1 1 \ -1 -.5 1

Best,
J.

__________________________________________

John Antonakis
Professor of Organizational Behavior
Director, Ph.D. Program in Management

Faculty of Business and Economics
University of Lausanne
Internef #618
CH-1015 Lausanne-Dorigny
Switzerland
Tel ++41 (0)21 692-3438
Fax ++41 (0)21 692-3305
http://www.hec.unil.ch/people/jantonakis

Associate Editor
The Leadership Quarterly


*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index