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

# Re: st: defining a covariance matrix

 From Austin Nichols To statalist@hsphsun2.harvard.edu Subject Re: st: defining a covariance matrix Date Wed, 1 May 2013 14:29:37 -0400

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