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: RE: perform regression on minimum number of observations stata
From
Nick Cox <[email protected]>
To
"[email protected]" <[email protected]>
Subject
Re: st: RE: perform regression on minimum number of observations stata
Date
Mon, 29 Jul 2013 17:12:31 +0100
My typo, sorry. However, you could have debugged it by realising that
the variable name is -year- and there is no local macro with the same
name.
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'
}
}
Nick
[email protected]
On 29 July 2013 16:46, Nahla Betelmal <[email protected]> wrote:
> 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 <[email protected]> wrote:
>> Sorry for previous incomplete reply.
>>
>> Nick
>> [email protected]
>>
>> On 29 July 2013 16:20, Nick Cox <[email protected]> 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
>> [email protected]
>> *
>> * 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/