Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: dropping one unit at a time


From   "Eric A. Booth" <ebooth@ppri.tamu.edu>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: dropping one unit at a time
Date   Wed, 17 Jun 2009 21:39:23 -0500

>
>

Assuming your countries are identified by some sequential id number, say 1 to 250, you could run something like:

********************

//full model
regress dv x1 x2
	outreg2 using "test.xls", replace

//models with one country dropped
foreach n of numlist 1/250 {
	regress dv x1 x2 if countryID !=`n'
	outreg2 using "test.xls", append
	}

**********************

Keep in mind that its going to keep appending models to the right of the full model until all units have been dropped once...so you may want to cut down the number being dropped if you have some other decision criteria, or break up the table created in the loop into multiple files.



~ Eric


__
Eric A. Booth
Public Policy Research Institute
Texas A&M University
ebooth@ppri.tamu.edu
Office: +979.845.6754


On Jun 17, 2009, at 9:14 PM, Carola Herrera wrote:

Dear Statalist participants,

I wish to examine whether my OLS results are driven by any particular country in my panel dataset. What is the Stata code to drop one country at the time and re-run the regression? Is there a better way to test for this?

Thanks
Carola





*
*   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/



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