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: st: Problem returning the e(V) covariance matrix for looped regression


From   Nick Cox <njcoxstata@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: Problem returning the e(V) covariance matrix for looped regression
Date   Mon, 10 Oct 2011 11:46:13 +0100

You need to loop over your countries saving the matrix each time. Here
is some technique:

sysuse auto
egen group = group(rep78)
su group

forval i = 1/`r(max)' {
      regress mpg weight if group == `i'
      mat V`i' = e(V)
      mat li V`i'
}

Also -search levelsof-.

Nick


On Mon, Oct 10, 2011 at 11:37 AM, sharoncatherine <sharon.walsh@esri.ie> wrote:

> I have StataSE 11 for Windows. I have sorted my data by country of origin
> and I ran an OLS regression *by* country. I now need to get the covariance
> matrix for each country, however, when I enter the command matrix list e(V)
> it only returns the most recently run regression which in this instance is
> the last country in the list. I would really appreciate if someone could
> guide me as to how to get the covariance matrix for each country run.
>
> Any help would be greatly appreciated!!
>
>
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index