Announcement

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

  • F-test including interaction term

    Dear reader,

    I have some trouble running the F-test including an interaction term. I have to run an F-test on the ESG score and the interaction term of the following regression:

    Code:
    reg ROA i.Law##c.ESG Size Leverage sales_growth PPE i.Industry_n i.year, robust
    When I try to run the following command:
    Code:
    test ESG=i.Law##c.ESG=0
    I get the following error: i: operator invalid

    Thought I did not have to include ESG as a variable in the main regression since when running i.Law##c.ESG, stata automatically adds the ESG, and the Law variable as well as the interaction term ESG*Law.

    Is there anyone who knows how I can perform the F-test?

    Thanks in advance!
    Last edited by Jord Sluis; 30 May 2023, 05:18.

  • #2
    Made a small edit to the question above.
    Last edited by Jord Sluis; 30 May 2023, 05:19.

    Comment


    • #3
      you need the testparm command; here is an example:
      Code:
      sysuse auto
      regress price i.for##c.weight
      testparm i.for##c.weight
      also, you might want to see
      Code:
      h testparm

      Comment


      • #4
        Your question is somewhat unclear. Which F-test are you looking for (there's more than one). I will assume you want a test for the entirety of the interaction terms between Law and ESG -- a test which will tell you if there are any differences beyond their additive effects.

        if this is your estimation command:
        Code:
        reg ROA i.Law##c.ESG Size Leverage sales_growth PPE i.Industry_n i.year, robust
        Then you can use -testparm- to perform the multiple testing for you automatically (or else you will need to spell out each interaction level with i.Law using -test-):

        Code:
        testparm i.Law#c.ESG
        Note: there is only one hash mark (#) in the -testparm- statement because Stata will interpret this to mean just the interaction terms (e.g., 1.Law#c.ESG, 2.Law#c.ESG, etc). The use of two hash marks (##) in you estimation command does the same, and also adds the individual effects involved in the interaction (i.Law and c.ESG). This is explained in -help fvvarlist-.

        Comment


        • #5
          Thanks for the quick responses, Rich and Leonardo.

          Indeed, I want to test for the interaction terms between Law and ESG.
          Thanks for your help!

          Comment

          Working...
          X