Announcement

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

  • Chi2/F-stat regression table output after after cmp package using outreg2

    Hi everyone,

    I want to get the chi2/f-stat output on a regression table, preferably using outreg2. It works perfectly using cmp with two equations, but it does not work with three equations.

    Code for two-equation cmp (WORKS):
    Code:
    eststo clear
    
    cmp (y1= l.y2 l.x1 l.x2 l.x3 i.year i.countryname) ( l.y2 = l.y1 x1 x2 z1 z2 z3 i.year i.countryname), indicators($cmp_cont $cmp_cont) cl(countryname) iterate(50) difficult
    
    estimates store est1
    estimates restore est1
    test ([l.y2] l.z1)
    local eq2_p= r(p)
    local eq2_chi = r(chi2)
    
    outreg2 using results_2eq, append dec(3) addtext(Country FE, Yes, Year FE, Yes) drop(i.countryname i.year) addstat(Eq2 Chi2, `eq2_f', Eq2 Chi2 p-value, `eq2_p')


    Code for three-equation cmp (DOES NOT WORK) [Error: invalid syntax]:
    Code:
    eststo clear
    
    cmp (y1= l.y2 l.y3 l.x1 l.x2 l.x3 i.year i.countryname) ( l.y2 = l.y1 x1 x2 z1 z2 z3 i.year i.countryname) (l.y3 = l.y1 x1 x2 z1 z2 z3), indicators($cmp_cont $cmp_cont $cmp_cont) cl(countryname) iterate(50) difficult
    
    estimates store est1
    estimates restore est1
    test ([l.y2] l.z1)
    local eq2_p= r(p)
    local eq2_chi = r(chi2)
    test ([l.y3] l.z2)
    local eq3_p= r(p)
    local eq3_chi = r(chi2)
    test ([l.y2] l.z1 [l.y3] l.z2)
    local joint_p= r(p)
    local joint_chi = r(chi2)
    
    outreg2 using results_3eq, append dec(3) addtext(Country FE, Yes, Year FE, Yes) drop(i.countryname i.year) addstat(Eq2 Chi2, `eq2_f', Eq2 Chi2 p-value, `eq2_p', Eq3 Chi2, `eq3_f', Eq3 Chi2 p-value, `eq3_p', Joint Chi2, `joint_p', Joint Chi2 p-value, `joint_p')


    Any help and suggestions will be greatly appreciated!
    Thank you!

  • #2
    And in what line does the error occur?

    Comment


    • #3
      Thank you for responding, David Roodman!
      The error occurs while running the outreg2; it says invalid syntax while running the three-equation model with cmp.
      The outreg2 with the two-equation cmp model works as intended, and I obtain the desired statistics in the output file.
      Last edited by Ahmed Chaudhry; 27 Jun 2023, 22:03.

      Comment


      • #4
        Then it sounds like this is really a question about outreg2, which I can't help with much.
        The best thing to do is divide and conquer: delete pieces of the outreg2 command line one at a time and keep testing. Once you find the bit that is causing the error, drop other parts of the command line to make the simplest possible example of the error. Hopefully this will lead to insight.

        Comment

        Working...
        X