Announcement

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

  • First-difference term in quadratic regression - different results

    Dear all,

    I am trying to run a quadratic regression with the first-difference of the explanatory variable but depending on the syntax, I get very different results;

    Code:
    use http://www.stata-press.com/data/r9/grunfeld.dta
    
    xtset company year
    
    * Attempt 1 - generate first-difference term and the squared first-difference term
    gen d_kstock=D.kstock
    gen kstocksq = kstock^2
    gen d_kstocksq=D.kstocksq
    
    xtreg mvalue i.year d_kstock d_kstocksq, fe
    
    * Attempt 2 - preferred method using interaction operator
    xtreg mvalue i.year c.d_kstock##c.d_kstock, fe
    The regression results are very different - what am I doing wrong?

    I would like to use the second method as my goal is to produce a marginsplot.

    Any help will be greatly appreciated. Thank you.

    Sincerely,

    Chiara

  • #2
    Algebra. Your first regression involves the difference of the square; the second involves the square of the difference. a2 - b2 is not the same as (a-b)2.

    Comment


    • #3
      Dear Clyde Schechter,

      Thank you for your reply and identifying the (now obvious mistake). Sorry for that.

      Is there anyway to replicate the results of the first method to produce marginal effects and marginsplot?

      Thank you again.

      Sincerely,

      Chiara

      Comment


      • #4
        I don't think there is. The problem is that d_kstocksq in that model is not the square of d_kstock. The relationship between d_kstocksq and that of d_kstock is algebraically fairly simple, but not one that is expressible with factor-variable notation as far as I can see. And, of course, just using d_ksotck and d_kstocksq will not cause margins to think of them as being in any way related to each other. If there is some kind of alternate representation of these effects that would work with factor variable notation it isn't apparent to me. If somebody else sees a way, please do chime in.

        Comment

        Working...
        X