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: Problem returning the e(V) covariance matrix for looped regression
From
Sharon Walsh <[email protected]>
To
"'[email protected]'" <[email protected]>
Subject
RE: st: Problem returning the e(V) covariance matrix for looped regression
Date
Tue, 11 Oct 2011 15:39:09 +0000
Hi Nick and Jesper,
Thank you so much for your help! I really appreciate it!!
Kind regards,
Sharon
______________________________
Sharon Walsh
Research Assistant
The Economic and Social Research Institute,
Whitaker Square,
Sir John Rogerson's Quay,
Dublin 2, Ireland
Tel: (+353) 1-863-2045
-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Nick Cox
Sent: 10 October 2011 12:16
To: [email protected]
Subject: Re: st: Problem returning the e(V) covariance matrix for looped regression
You evidently have missing values for at least one country that make
your regression impossible in that case.
You can solve this in various ways, e.g. by putting -noisily capture
regress- not -regress-.
Nick
On Mon, Oct 10, 2011 at 12:08 PM, Sharon Walsh <[email protected]> wrote:
> Hi Nick,
>
> Many thanks for your help!! I tried this method and it seems to work perfectly except that it only runs for the first 20 or so countries (out of a total of 246) and then I get the following error:
>
> no observations
> r(2000);
>
> end of do-file
>
> r(2000);
>
> Do you have any thoughts?
>
> Many thanks again for your help so far,
> Kind regards,
> Sharon
>
>
> -----Original Message-----
> From: [email protected] [mailto:[email protected]] On Behalf Of Nick Cox
> Sent: 10 October 2011 11:46
> To: [email protected]
> Subject: Re: st: Problem returning the e(V) covariance matrix for looped regression
>
> 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 <[email protected]> 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/
>
> *
> * 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/
>
*
* 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/
*
* 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/