Announcement

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

  • xtreg, re without constant

    Dear All,

    I run a RE model, where I want to include constants, which I constructed. Specifically, I run a piecewise regression model. Below is the code I am using:

    Code:
    generate polc1 = (pc - 6) 
    replace  polc1 = 0 if pc >= 6
    generate polc2 = (pc - 6) 
    replace  polc2 = 0 if pc < 6
    
    generate int1 = 1
    replace  int1 = 0 if pc >= 6
    generate int2 = 1
    replace  int2 = 0 if pc < 6
    
    xtreg y polc1 polc2 int1 int2 i.time, r
    One of the constant (int2) is dropped because of collinearity with the one included by default. My qyestion is whether I can drop _cons somehow. Obviously the option nocons does not work.

    I have tried:

    Code:
    constraint define 1 _cons=int2
    xtreg lnfdipccurr polc1 polc2 int1 i.time, r constraint(1)
    option constraint() not allowed
    Any help would be gratly appreciated.

    Best,

    Dario




  • #2
    I think this is what you want:

    Code:
    g pc2 = (pc - 6)*(pc >= 6)
    xtreg lnfdipccurr pc pc2 i.time, r

    Comment


    • #3
      George Ford Thanks for your reply. I am fine with the construction of the variables, unless you are suggesting an alternative way to address the piecewise regression. My problem is to drop the _cons in the treg, re. Apparently, I did not find any way to do so.

      Comment


      • #4
        I don't think you want to drop the constant. You are trying to fix a problem with collinearity, which is a result of how you created the variables and included them in the regression. You don't need a second intercept in a PW regression (which you have specified by int).

        [Also, you don't need 2 lines of code to make a dummy. g int = pc >= 6 would do).

        A PW regression needs a constant term, which is shared across the groups. In PW regression, you get the same intercept but a kink in the slope (here, at pc = 6).

        In Switching regression, then you get separate slopes and intercepts, but you don't need the Y - Y* term.

        The simplest description of these sorts of models I've found is in Pindyck and Rubenfeld, Econometric Model & Economic Forecasts (3rd), pp. 117 - .

        Comment


        • #5
          George Ford Thanks George, very useful.

          Comment


          • #6
            Code:
            clear all
            set obs 10000
            g x = runiform()
            
            g y = 1 + 1*x - 0.5*(x-0.5)*(x >= 0.5) + rnormal(0,0.01)
            g d = x >= 0.5
            
            twoway lfit y x if !d || lfit y x if d 
            
            g x2 = (x - 0.5)
            reg y x c.x2#c.d
            
            g x3 = (x - 0.5)*(x >= 0.5)   //combine x2 and d
            reg y x x3

            Comment


            • #7
              George Ford Thanks. Very clear now.

              Comment

              Working...
              X