Announcement

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

  • Wald difference test

    Dear users,

    I want to compare the coefficient of the same variable accross two different models. Does someone know the code to store the coefficients after the regressions, and
    thereafter compare them using a wald difference test. Thanks in advance.

    Best,

    Teun

  • #2
    Teun:
    did you take a look at -sureg- and -sureg postestimation-?
    Kind regards,
    Carlo
    (Stata 19.0)

    Comment


    • #3
      Thanks for the Response Carlo,

      I did check it but not sure how to use it. I want to run two xtpoisson regressions, and compare whether the coefficients for the explanatory variable in the regression are significantly different from each other. So I need to store the coefficients I guess, and then run a wald test, but not sure how to do it in stata.

      Comment


      • #4
        What did you try (exactly, we want to see the code), what did Stata tell you in return, and why do you think that is a problem?
        ---------------------------------
        Maarten L. Buis
        University of Konstanz
        Department of history and sociology
        box 40
        78457 Konstanz
        Germany
        http://www.maartenbuis.nl
        ---------------------------------

        Comment


        • #5
          Originally posted by Maarten Buis View Post
          What did you try (exactly, we want to see the code), what did Stata tell you in return, and why do you think that is a problem?

          Hi Maarten,

          The thing is that I don't know to tell stata. What I know is the folllowing:

          I perform this regression:
          xi: xtpoisson yvar xvar controls, robust i(id) fe ///for group 1
          xi: xtpoisson yvar xvar controls, robust i(id) fe ///for group 2

          The, I want to compare the both coefficients of the x-var using a wald test. (Command is test xvar1 = xvar2 I think)

          But I don't know how I can restore those coefficients and recall them to do the wald test.

          Comment


          • #6
            first, don't use "xi"; instead use factor variable notation (see "help fvvarlist")

            second, if you insist on keep it as two models, use suest ("h suest")

            third, why not just use a single model with an interaction term? e.g.,
            Code:
            xtpoisson yvar i.group##c.xvar controls, robist i(id) fe
            note that the above assumes that xvar is a "continuous" variable (again, see "h fvvarlist")

            Comment


            • #7
              Note that Rich G's code does constrain the controls to have the same effects in both groups. If you want their effects to freely differ across the two groups (as they would if you ran a separate model for each group) change the code to

              xtpoisson yvar i.group##c.xvar controls i.group#c.controls, robust i(id) fe

              or something like that. (NOTE: I am not 100% sure that that is equivalent to running separate models for each groups -- maybe the fe part further complicates things. On the other hand, it would be quite common to run the model as Rich G. has done if you think the effects of the controls will not differ across groups.)
              -------------------------------------------
              Richard Williams, Notre Dame Dept of Sociology
              StataNow Version: 19.5 MP (2 processor)

              EMAIL: [email protected]
              WWW: https://www3.nd.edu/~rwilliam

              Comment


              • #8
                Also see the messages by Jeff Pittblado in this thread: http://www.statalist.org/forums/foru...fe-and-margins

                Basically he warns that in a fixed effects model you should be careful about including the main effect of a time invariant variable -- that is you should include the interaction terms involving the variable but not the main effect of the variable itself. Which sort of goes counter to everything I have ever learned about main effects and interaction terms but he explains what the issue is.
                -------------------------------------------
                Richard Williams, Notre Dame Dept of Sociology
                StataNow Version: 19.5 MP (2 processor)

                EMAIL: [email protected]
                WWW: https://www3.nd.edu/~rwilliam

                Comment


                • #9
                  Thank you all for the comments! The model you sugested is useful. However, I am still in doubt how to do the wald difference test between the two models

                  Comment


                  • #10
                    your comment is unclear - did you go the interaction route (in which case the p-value for the interaction term is what you want) or the suest route (see p. 2521 of the manual for an example; you can get to the manual by opening the help for suest and clicking on the blue "[R] suest" at the top of the help file) - note that this is the page for version 14

                    Comment


                    • #11
                      I never heard before of "Wald difference test", I have heard before of "Wald test" which evaluates the estimate value (random by nature) to a constant (not random by nature). "Test" command in Stata is for linear hypothesis after estimation.

                      The problem exposed here is how to compare two estimated values of a parameter, for that is necessary to have a unique regression that involves both parameters at same time and after to do a test of equality of parameters,


                      https://en.wikipedia.org/wiki/Wald_test

                      Comment

                      Working...
                      X