Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • outreg2 with e(jp)

    Hi, I have a wierd problem.

    Previously, when I define the path as:

    cd "F:\360CloudUp\Research\Projects\Research_Projects \!Accept -- SC\Empirical"

    global dofiles= "/dofiles"
    global rawdata= "/rawdata"
    global workingdata= "/workingdata"
    global tables= "/tables"

    And I run IV regression as:

    xi: xtivreg2 capreturn (ln_mean_4_total = ln_spend_popu ln_admin_income_popu) L6.ln_mean_4_total $xlist i.year, fe first cluster(id)
    outreg2 using tables/Table_8.xls, replace label addstat(First stage F-stat, e(widstat), Hansen, e(j), Hansen p value, e(jp))

    Hansen test and its p value can be reported in the excel file.


    Afterwards, when I run another project with definition of the path:

    global dofiles="F:\360CloudUp\Research\Projects\Research_ Projects\!!_Data_and_Empirics\CFPS\DFC\dofiles"
    global rawdata="F:\360CloudUp\Research\Projects\Research_ Projects\!!_Data_and_Empirics\CFPS\rawdata"
    global workingdata="F:\!!_Data_and_Empirics\CFPS\DFC\work ingdata"
    global tables="F:\360CloudUp\Research\Projects\Research_P rojects\!!_Data_and_Empirics\CFPS\DFC\tables"

    and run the regression:

    xi: xtivreg2 lnconsumer_exp (cpre_total_index=IV_city_Hangzhou1 IV_city_Hangzhou2 IV_city_Hangzhou3) i.year, fe first cluster(city)
    outreg2 using $tables/Table_7_cpre_Hangzhou_IV.xls, replace addstat(First stage F-stat, e(widstat), Hansen, e(j), Hansen p value, e(jp))

    it says:

    check eret list for the existence of e(jp)
    invalid syntax
    r(198);


    I don't know why the error has appeared. It seems that the two codes are the same.

    Thank you.

  • #2
    You'll increase your chances of a useful answer by following the FAQ on asking questions - provide Stata code in code delimiters, readable Stata output, and sample data using dataex. Being able to replicate your problem is a great help in diagnosing it.

    I wonder if xtivreg2 is not calculating the Hansen values in the second estimate. One general strategy in diagnosing things is to simplify everything, run it and see if it works. Then build up.

    Comment


    • #3
      You might also follow the advice given by Stata in the error message, which suggests that although your commands may be similar, the differences in your data and model are producing a different result. Run
      Code:
      xi: xtivreg2 lnconsumer_exp (cpre_total_index=IV_city_Hangzhou1 IV_city_Hangzhou2 IV_city_Hangzhou3) i.year, fe first cluster(city)
      ereturn list
      outreg2 using $tables/Table_7_cpre_Hangzhou_IV.xls, replace addstat(First stage F-stat, e(widstat), Hansen, e(j), Hansen p value, e(jp))
      and then inspect the output of the ereturn command to see if e(jp) is included in the estimations returned. If not, look at the output of your xtivreg2 command in Stata's Results window and see if it is displayed in the output. If not, perhaps if you copy the command and its output from Stata's Results window and paste it into a Statalist reply in this topic, someone will be able to explain why it was not calculated.

      To assure maximum readability of results that you post, please copy them from the Results window or your log file into a code block in the Forum editor using code delimiters [CODE] and [/CODE], as explained in section 12 of the Statalist FAQ linked to at the top of the page. For example, the following:

      [CODE]
      . sysuse auto, clear
      (1978 Automobile Data)

      . describe make price

      storage display value
      variable name type format label variable label
      -----------------------------------------------------------------
      make str18 %-18s Make and Model
      price int %8.0gc Price
      [/CODE]

      will be presented in the post as the following:
      Code:
      . sysuse auto, clear
      (1978 Automobile Data)
      
      . describe make price
      
                    storage   display    value
      variable name   type    format     label      variable label
      -----------------------------------------------------------------
      make            str18   %-18s                 Make and Model
      price           int     %8.0gc                Price

      Comment

      Working...
      X