Announcement

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

  • Error while using Keep option with esttab

    Hi,

    I am checking if there is heterogeneity in my results based on multiple variables.

    I run the following regressions :

    reg var1 var2 var3 var3#var4 var7 var8

    reg var1 var2 var3 var3#var5 var9 var10

    reg var1 var2 var3 var3#var6 var10 var11

    I only want to keep coefficients of var2 var3 and the interaction terms
    When I use keep ( var2 var3 var3#var4 var3#var5 var3#var6 ) with esttab , the error thrown is coefficient var3#var4 not found.

    Could someone please help in correcting this error. Could it be because var3#var4 doesn't appear in all three regressions.

    Thanks.

  • #2
    Run the regress command as

    Code:
    reg var1 var2 var3 var3#var4 var7 var8, coeflegend
    so to see how Stata labels the coefficient. I suspect you need something like

    Code:
    *var3#*var4

    estout is from the Stata Journal/ SSC, as you are asked to explain (FAQ Advice #12).

    Comment


    • #3
      Thanks a lot, Andrew.

      Comment


      • #4
        I am able to access the variables in keep now. In the regression output though using esttab, I want a single row instead ( to make the regression table compact) with coefficients of all interaction terms ( var3#var4 , var3#var5 , var3#var6 ) instead of three different rows for each of the three interactions.


        How can that be done?

        Thanks.

        Comment


        • #5
          These are 3 separate coefficients, so you cannot include them in one row. You can run

          Code:
          margins, dydx(*) post
          after the regression and report the average marginal effects which will not include the interactions.

          Comment


          • #6
            Hi Andrew,

            Thanks for the reply. The following is how I want the final regression output to look like.

            Variable 4 Variable 5 Variable 6
            var 2 Coefficient Coefficient Coefficient
            var 3 Coefficient Coefficient Coefficient
            var 3*Variable Coefficient Coefficient Coefficient


            The column headings will represent the variable I am interacting variable 3 with. This will allow me to put all the three interaction terms in one row.

            Thanks.

            Comment


            • #7
              I cannot follow this as you are using pseudo-code to describe the model and then presenting some table based on this. Usually, the columns represent results from one model and the rows are the coefficients. 3 columns therefore imply results from 3 estimated models. Take a dataset such as Stata's auto dataset and illustrate what you want after estimating a model.
              Last edited by Andrew Musau; 27 Mar 2022, 14:02.

              Comment

              Working...
              X