Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
From | "Jesper Lindhardsen" <JESLIN01@geh.regionh.dk> |
To | <statalist@hsphsun2.harvard.edu> |
Subject | st: RE: Problem returning the e(V) covariance matrix for looped regression |
Date | Mon, 10 Oct 2011 12:51:45 +0200 |
Hi Sharon I would use a loop and regress with an if statement (eg. reg x y if country=='Norway') and copy e(V) into a matrix within the loop. Something like local name: "Norway Denmark" foreach nation of local name { reg x y if country==`nation' matrix m_`nation'=e(V) } HTH, Jesper -----Original Message----- From: owner-statalist@hsphsun2.harvard.edu [mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of sharoncatherine Sent: 10 October 2011 12:38 To: statalist@hsphsun2.harvard.edu Subject: st: Problem returning the e(V) covariance matrix for looped regression Dear Stata users, 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!! Sharon -- View this message in context: http://statalist.1588530.n2.nabble.com/Problem-returning-the-e-V-covaria nce-matrix-for-looped-regression-tp6876456p6876456.html Sent from the Statalist mailing list archive at Nabble.com. * * 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/