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: Re: Variance-Covariance Matrix


From   Adrian Stork <[email protected]>
To   [email protected]
Subject   Re: st: Re: Variance-Covariance Matrix
Date   Mon, 6 Jan 2014 11:11:40 +0100

Hi Chrisopher

Thanks for that. Very elegant, I think it might be a bit more
efficient, altough I finally can say I used mata :-)

Best,
A.

2014/1/5 Christopher Baum <[email protected]>:
> <>
> On Jan 5, 2014, at 2:33 AM, Adrian wrote:
>
>> I'm sorry for asking such a simple question but unfortunately I
>> couldn't find an answer. How do you get the variance-covariance matrix
>> in Stata?
>> I know it's available in postestimations using e(V) but in my case
>> there is no estimation. Specifically  I got two variables each with
>> length of 306 that I transformed into a matrix
>>
>> .mkmat x1 x2, matrix(test1)
>>
>> Now there must be some way to calculate the variance-covariance matrix
>> in an efficient way as in other known mathematical software.
>>
>> Something like:
>> .matrix cov test1
>>
>> Am I missing something?
>> Does anyone have an idea to get the v-cov matrix in some way? Help is
>> very much appreciated. Thanks.
>
> There is no need for matrix commands, Mata, or regression formulae.
>
> . sysuse auto
> (1978 Automobile Data)
>
> . corr price mpg,cov
> (obs=74)
>
>              |    price      mpg
> -------------+------------------
>        price |  8.7e+06
>          mpg | -7996.28   33.472
>
> . ret li
>
> scalars:
>                   r(N) =  74
>              r(cov_12) =  -7996.282858200665
>               r(Var_2) =  33.47204738985561
>               r(Var_1) =  8699525.97426879
>
> matrices:
>                   r(C) :  2 x 2
>
> . mat li r(C)
>
> symmetric r(C)[2,2]
>             price         mpg
> price     8699526
>   mpg  -7996.2829   33.472047
>
>
>
>
> Kit Baum
> Professor of Economics and Social Work, Boston College, Chestnut Hill MA, USA
> DIW Research Professor, Department of Macroeconomics, DIW Berlin, Berlin, Germany
> [email protected]  |  http://ideas.repec.org/e/pba1.html
>
>
>
>
>
>
>
>
>
>
>
>
> *
> *   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