Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
From | Nick Cox <njcoxstata@gmail.com> |
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:20:15 +0100 |
Gregorio's loop can be modified something like this forval y=1989/2012 { forval i= 1/57 { di "year = `y' and industry = `i'" reg DV IV_1 IN_2 IN_3 if Industry== `i' & year==`y' & nobs>15 } Nick njcoxstata@gmail.com On 29 July 2013 16:15, Nahla Betelmal <nahlaib@gmail.com> wrote: > Thanks Gregorio, but how can I exclude the regression with less than > 15 observation due to missing data rather than no observation? any > idea! > > many thanks again for the great help. from what I have read in the > field the magic number is 15, one or two papers uses 20. Maybe due to > the nature of the data availability from the population dataset. > > Thanks again for the kind help > > Nahla > > On 29 July 2013 15:57, Impavido, Gregorio <GImpavido@imf.org> wrote: >> You could modify your loop as follows: >> >> bysort year industry: gen nobs = _N >> forval y=1989/2012 { >> forval i= 1/57 { >> di "year = `y' and industry = `i'" >> reg DV IV_1 IN_2 IN_3 if Industry== `i' & year==`y' & nobs>15 >> } >> >> However, I thought that the "magic number" for the central limit theorem to apply was 30. >> >> -----Original Message----- >> From: owner-statalist@hsphsun2.harvard.edu [mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Nahla Betelmal >> Sent: Monday, July 29, 2013 10:32 AM >> To: statalist@hsphsun2.harvard.edu >> Subject: st: perform regression on minimum number of observations stata >> >> Hi Statalist, >> >> my data consists of several years and several industries (each industry contain several firms). I run cross-sectional regressions as follow : >> >> forval y=1989/2012 { >> forval i= 1/57 { >> reg DV IV_1 IN_2 IN_3 if Industry== `i' & year==`y' >> } >> >> I have two questions please: >> >> 1- According to literature, any industry-year regression with less than 15 observations (i.e. 15 firms) should be disregarded. the tricky thing is that almost every industry-year group has more than 15 firms but some are with missing values to perform the regression. Therefore, the regression could be done with less than 15 observation. How can I account for this in the above loop, so regression with less than 15 complete observations produce missing values instead of actual values! >> >> 2- the output does not provide information about the matched year and industry. Is there a way to do it? I only need that for reporting purpose. >> >> Thank you >> >> Nahla Betelmal >> * >> * 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/ * * 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/