Bookmark and Share

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]

st: estout coefficient not found error


From   James Sams <[email protected]>
To   [email protected]
Subject   st: estout coefficient not found error
Date   Sun, 08 Jan 2012 23:47:02 -0600

I am using areg and several models, one model with month fixed effects. I 
collect 288 models using eststo and output them to 4 separate files depending 
on the dependent variable used using eststo's naming and wildcard expansion, 
e.g. "estout depvar1*". I then try to use indicate(month FE = FE_month*) to 
drop the month fixed effects and replace it with a simple indicator of whether 
the FE's are there. This works several times and then fails.

There are 4 digits in the by_group code for where it is failing, though it 
succeeds 6 times before it fails. with the message "coefficient FE_month* not 
found". -describe- says the variables are there. I do not understand what is 
causing this. I tried to create a sample dataset that caused the error, but 
have failed to do so. Any and all advice is appreciated.

I'm using Stata 12 MP on OS X

. which estout
/Users/jsams/Library/Application Support/Stata/ado/plus/e/estout.ado
*! version 3.13  06aug2009  Ben Jann

I've got a potentially better formatted code sample available at 
https://gist.github.com/1581338, but here it is also pasted below for easier 
access. 



quietly tab month, gen(FE_month_) /* Month fixed effects */
drop FE_month_1 /* First month fixed effect is dropped */
compress

/*
  What I actually do is very very similar to how it is described below.
  It may be worth noting that there is in fact an outer loop that uses only 
enough
  groups to fill but not overflow the storage limit of eststo (300 models). I 
then
  use my data file conditioning on the `by_group' being in a specified range to
  satisfy that requirement. At the bottom of that loop is an "eststo clear" to 
make
  way for the new set of results.

  This works for several loops but then dies eventually, but apparently 
consistently,
  during the 7th write out, for absolutely no obvious reason that I can see 
with the
  error message described below. For a differently selected `by_group', this 
worked
  fine, but only required 3 loops through the data as there were only about 750 
separate
  regressions to run whereas for the group I am working with now requires in 
the
  neighborhood of 16,000 regressions.
*/

local by_group some_group
levelsof `by_group', local(by_group_levels)
foreach by_group_level of local by_group_levels {
    foreach dep_variable in log_expend_real percent_expend_PL 
percent_expend_deal percent_expend_coupon {
        // create local est_pre based on name of dep_var and assign variable 
names to several other locals
        // to create dep_variable dependent models
        local dep_variable_name: variable label `dep_variable'

        #delimit ;
        estout `est_pre'm5uz, title() noesample:
            areg `dep_variable' `key_indep_variable' recession 
`variable_trend'
                if `by_group' == `by_group_level'
                , absorb(id) ;

        estout `est_pre'm5fe, title() noesample:
            areg `dep_variable' `key_indep_variable' FE_month*
                if `by_group' == `by_group_level'
                , absorb(id) ;

        // and 2 more models
     
        #delimit cr
    }
    // we are short on memory, this reduces memory required and speeds things 
up
    drop if `by_group' == `by_group_level'
}

foreach dep_variable in log_expend_real percent_expend_PL percent_expend_deal 
percent_expend_coupon {
    // recreate est_pre based on dep_variable

    /* where drop is, I've tried
       indicate(month FE's = FE_month*)
       as well as a specific enumeration of all the month FEs in a
       local macro month_indicators
       indicate(month FE's = `month_indicators')
    */
   #delimit ;

   estout `est_pre'* using `"some_file-`dep_variable'.tsv"',
       cells(b(nostar fmt(4)) se(nopar fmt(4)))
       stats(r2 N, fmt(%9.4f %9.0g) label(R-squared Obs.))
       label noabbrev nowrap drop(FE_month*)
       numbers title("") nolegend replace ;

   #delimit cr
}

/*
This worked on one specified by_group but is now failing with
    - if `"`drop'"' != "" {
    = if `"FE_month*"' != "" {
    - ExpandEqVarlist `"`drop'"' `B'
    = ExpandEqVarlist `"FE_month*"' __000000
coefficient FE_month* not found
*/



-- 
James Sams
[email protected]
*
*   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–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index