Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
From | "Impavido, Gregorio" <GImpavido@imf.org> |
To | "statalist@hsphsun2.harvard.edu" <statalist@hsphsun2.harvard.edu> |
Subject | RE: st: RE: perform regression on minimum number of observations stata |
Date | Mon, 29 Jul 2013 16:12:42 +0000 |
Try changing count if industry == `i' & `year' == `y' with count if industry == `i' & year == `y' -----Original Message----- From: owner-statalist@hsphsun2.harvard.edu [mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Nahla Betelmal Sent: Monday, July 29, 2013 11:46 AM To: statalist@hsphsun2.harvard.edu Subject: Re: st: RE: perform regression on minimum number of observations stata Thanks Nick, but I got an error with the loop year = 1989 and industry= 1 ==1989 invalid name r(198); I added ` ' for industry in the line: count if industry == `i' & `year' == `y'. I still get the same error but with alteration year = 1989 and industry= 1 ==1 invalid name r(198); Could it be that I do not have enough observations at year 1989 and industry 1 Thanks again, I highly appreciate your time. Also thanks for the advice about the magic number and regression model. Nahla On 29 July 2013 16:24, Nick Cox <njcoxstata@gmail.com> wrote: > Sorry for previous incomplete reply. > > Nick > njcoxstata@gmail.com > > On 29 July 2013 16:20, Nick Cox <njcoxstata@gmail.com> wrote: > > Gregorio's loop can be modified something like this > > forval y=1989/2012 { > forval i= 1/57 { > di "year = `y' and industry = `i'" > count if industry == `i' & `year' == `y' > if r(N) > 15 { > reg DV IV_1 IN_2 IN_3 if Industry== `i' & year==`y' > } > } > > Whatever magic numbers or rules of thumb you read about, > > 1. Don't take them too literally. > > 2. Increase the desirable number according to how many parameters you > are estimating. > > 3. Use sensible models. I don't usually expect pure linear regressions > to work well with firm-year data. > > Nick > njcoxstata@gmail.com > * > * 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/ * * 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/