Announcement

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

  • How to export the results of Wald-test/F-test to excel using outreg2 or any other alternative?

    Hi every one,
    I am using the following code

    Code:
    reg CAR01  NU_SUE NUE_D1 NUE_D2  logmcap  lag_price  i.fyearq
    test   NU_SUE NU_SUE 
    test   (NU_SUE+NUE_D1) = 0 
    test   (NU_SUE + NUE_D2) = 0 
    test   (NU_SUE + NUE_D1 + NUE_D2) =0 
    
    outreg2 using ABC, append excel  tstat dec(5)
    after running this code, I get the normal regression results on stata and the results of regression are also exported to the excel file.

    However, the results of the F-test are not exported to the excel file.

    My question is, how can I export the results of F-Test to the excel file?

    For example
    I want to export the following result to excel ( which is basically the second test)... I want to export the F value of 191.43 and the significance of this value as well to excel the file ABC. Like in the exported file, I should get the value as 191.43***.


    test (NU_SUE+NUE_D1) = 0
    ( 1) NU_SUE + NUE_D1 = 0

    F( 1, 51715) = 191.43
    Prob > F = 0.0000


    P.S: I didn't paste the regression results and data, as they were not required I guess. Please let me know if I am missing anything is explaining my question, I'll explain it.

    Any help would be much appreciated, as I have to run these tests a number of times, and copy-pasting the results manually in excel to send to my supervisor takes a lot of time.

    Thanks in advance.


  • #2

    Code:
     outreg2 using ABC, append excel tstat addstat(F test: , e(F))
    You can add anything from the stored results using addstat. However, after regress it looks like Stata stores the F-statistic (191.43), but not Prob > F = 0.0000. I don't believe it can add the asterisks to the F-stat either. estab can probably do that. I just add them manually.
    Last edited by David Benson; 26 Nov 2018, 03:09.

    Comment


    • #3
      Thank you David for the quick response.

      The code which you have provided, adds the F-stat of only the last test. I need to add the F-stat of all four tests.

      Can you think of a possible solution?

      Comment


      • #4
        I don't know if you can do that using outreg2. However, I would try putting the outreg2 command after every line (that might at least get the F-test for each test into Excel).

        The following answer I gave to another post might you in a useful direction

        Originally posted by David Benson View Post
        So, you might try logout (SSC) or frmttable (STJ, so use findit frmttable; it's sg97_5). You might also be able to do it with asdoc or tabout (both on SSC).

        Code:
        ssc install logout
        reg CAR01  NU_SUE NUE_D1 NUE_D2  logmcap  lag_price  i.fyearq
        logout, save(mytable1) excel replace : test   NU_SUE NU_SUE 
        logout, save(mytable2) excel replace : test   (NU_SUE+NUE_D1) = 0 
         
        ...and so on
        The above gets it into Excel, but I don't know how to append tables to the same Excel file (like outreg2 would). Also, I don't know how to change the format of it.


        The 2nd way would be to use frmttable (this is probably the way I would go).

        Comment

        Working...
        X