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

  • -areg- with factorial interaction of continuous variable: bugged?

    use, clear
    // Toy dataset from
    reg y, allbaselevels coeflegend // reg;
    predict try1, xb
    reg y, allbaselevels coeflegend // reg;
    predict try2, xb
    areg y, a(group) allbaselevels coeflegend // areg;
    predict try3, xbd
    areg y, a(group) allbaselevels coeflegend // areg;
    predict try4, xbd
    assert try1 == try2 // assertion is true :)
    assert try1 == try3 // assertion is true :)
    assert try1 == try4 // assertion is false :(
    areg y, a(group) warns that omitted because of collinearity, but… I don't think it's collinear.

    Am I being silly here, or is Stata?

  • #2
    Well, I get the same results on my set up (Verson 14.1 MP2, Windows 7). And it looks to me like Stata is being silly. I can't think of an explanation for this behavior.

    If you remove the interaction from the model, then it gives the same results all four times. Weird. If nobody on the list comes up with an explanation for this, I would bring it to Technical Support. It looks like a bug to me.


    • #3
      Yeah, if you fvexpand, you can see that areg y age works until you remove the [redundant]

      Thanks for the sanity check, Clyde. I've escalated to Technical Support, and I'll report back when I hear from them.


      • #4
        Response: "I also passed this report to one of the developers and he will be evaluating the problem. In case he determines that the differences are due to a bug in the program for the command, the fixed code will be included in one of the future updates available from our website."


        • #5
          Stata 14.1, update 19may2016, includes “areg, when the model included an interaction between a single specified level of a factor variable and a continuous variable, omitted the main effect for the factor variable. This has been fixed.

          Hooray. :-)


          • #6
            Thank you, Nils, for bringing this to the attention of the developers.