Announcement

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

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

    Code:
    use http://www.stata-press.com/data/r13/fvex, clear
    // Toy dataset from http://www.stata.com/manuals13/u25.pdf
    
    reg y i.sex##c.age i.group, allbaselevels coeflegend // reg; i.sex
    predict try1, xb
    
    reg y 1.sex##c.age i.group, allbaselevels coeflegend // reg; 1.sex
    predict try2, xb
    
    areg y i.sex##c.age, a(group) allbaselevels coeflegend // areg; i.sex
    predict try3, xbd
    
    areg y 1.sex##c.age, a(group) allbaselevels coeflegend // areg; 1.sex
    predict try4, xbd
    
    assert try1 == try2 // assertion is true :)
    assert try1 == try3 // assertion is true :)
    assert try1 == try4 // assertion is false :(
    areg y 1.sex##c.age, a(group) warns that 1.sex 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.

    Comment


    • #3
      Yeah, if you fvexpand i.sex##c.age, you can see that areg y 0b.sex 1.sex age 1.sex#c.age works until you remove the [redundant] 0b.sex.

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

      Comment


      • #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."

        Comment


        • #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. :-)

          Comment


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

            Comment

            Working...
            X