Announcement

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

  • Performing Wald test with interaction term

    I want to perform a Wald test using a regression that looks like this one from a paper of Toolsema and Jacobs (2007):


    Click image for larger version

Name:	Regression.png
Views:	1
Size:	3.8 KB
ID:	1346863


    My problem is that I do not exactly know how to format the regression in such a way that Stata can perform the Wald test. What I am doing is using a dummy to separate the positive from the negative values. However, in that case you get output that looks something like this:

    Click image for larger version

Name:	Stata regression.png
Views:	1
Size:	5.6 KB
ID:	1346864


    With this output it does not seem possible to perform the Wald test to compare the cases that the dummy is 0 or 1. Does any of you have an idea to do the regression in such a way that the Wald test can be performed (testing that + (a4) is different from - (a5)).

    Thank you in advance,

    Danny

















    Attached Files

  • #2
    I think what you want is like
    Code:
    test 1.pos_mean#cD.mean = 0.pos_mean#cD.mean
    You'll have to adjust this to use your actual variable names.

    Comment


    • #3
      Thank you Clyde. Doing the test your way works out.You were also right about the duplicate post. My computer froze and uploaded the thread twice.

      I also apply to test to double interaction terms.

      Code:
      ​test c.dr2_lmean_obv#0.i.tpos_mean_obv#0.i.dummy_plb_1 = c.dr2_lmean_obv#0.i.tpos_mean_obv#1.i.dummy_plb_1
      Do you think this is a potential way to do a Wald test if two interaction apply?

      Comment


      • #4
        If that is a meaningful hypothesis to test in the context of your research, that is the correct syntax for doing it. It's a bit unusual to test the equality of two interactions, but if it makes sense in your context, then that is how to proceed.

        Comment


        • #5
          Hi Clyde Schechter , thank you for your insightful answer.

          I am having a similar case but in this case I want to check the significance of an interaction between subcategories of variables. Suppose I have a variable for age group with 3 categories and a variable for sex with 2 categories. I want to do an interaction term test for both categories. I believe I can use this

          Code:
           testparm i.age#i.sex
          or

          Code:
           test 1.age#1.sex 1.age#2.sex 2.age#1.sex 2.age#3.sex 3.age#1.sex
          However, I also want to do a `post-hoc` test to compare the significant difference between sex in each age group, so I would like to compare how 1.age#1.sex and 1.age#2.sex differs, and so on and so forth for 2.age and 3.age. Can I use this?

          Code:
           
           test 1.age#1.sex 2.age#1.sex test 1.age#1.sex 3.age#1.sex test 2.age#1.sex 3.age#1.sex
          I have also posted my question in this thread but it doesn't seem to be getting attention: https://www.statalist.org/forums/for...-for-wald-test

          Thanks in advance

          Comment


          • #6
            The -testparm- command has an -equal- option which permits you to test the equality of the coefficients listed.

            Comment


            • #7
              Thanks Clyde Schechter ! So should I use this:
              Code:
              test 1.age#1.sex 2.age#1.sex
              or this?
              Code:
              test 1.age#1.sex = 2.age#1.sex
              I am using test instead of testparm because I am using this command in multiply imputed dataset so -testparm- won't work... Thanks again in advance.

              Comment


              • #8
                To test for equality, use the second.

                Correction: After multiple imputation you cannot use -test-. You must use -mi test-, and that does not support testing for equality. You must instead, when you do your regression, calculate the difference between the coefficients. Then you can use -mi testtransform- to test whether the difference equals zero. See -help mi_test- and go to the examples to see an illustration of how this is done.
                Last edited by Clyde Schechter; 09 Apr 2023, 11:40.

                Comment


                • #9
                  Thank you so much!

                  Comment

                  Working...
                  X