2
$\begingroup$

I am trying to compare the coefficients of two panel data regressions with the same dependent variable. What I am aiming at is the following:

    y1 = c + β x
    y2 = c + β x

In Stata

    xtreg y1 x i.z
    xtreg y2 x i.z

I want to check whether the βs are significantly different.

With two regular regressions I would use something like the following code in Stata to test a cross-equation restriction:

    sureg (y1 x ) (y2 x )
    lincom [y1]x - [y2]x

However Stata is explaining that this is not possible when I try to use xtreg.

I have searched a lot of different sites. However I do not have a clue, it only made me more confused. Hopefully you guys can help.

edit

I am using a Fixed effect models

$\endgroup$
1
  • $\begingroup$ You should probably amend your xtreg code with the , fe option. $\endgroup$
    – dimitriy
    Jul 24, 2014 at 17:59

1 Answer 1

5
$\begingroup$

There's a user-written panel version of the random effects SUR estimator that you can obtain with ssc install xtsur. I am assuming you are using a RE estimator since that is the default with xtreg. The "add a constant" part is a bit of a hack, and I can't quite tell if it is in fact a bad idea.

Here's an toy example of what this would look like:

. webuse nlswork
(National Longitudinal Survey.  Young Women 14-26 years of age in 1968)

. gen constant=1

. xtsur (ln_wage constant age) (hours constant age)
(running multi-step estimates...)

Calculating multi-step estimates...
Iteration   1 : relative difference =  .00761817
Iteration   2 : relative difference =  6.278e-11


Seemingly unrelated regression (SUR) in panel data set

One-way random effect estimation:
------------------------------------------------------------------------------
Number of Group variable:   15                  Number of obs      =     28443
Panel variable: idcode                          Number of eqn      =         2
Time variable : year                            Number of panels   =        15

Random effects u_i ~ Gaussian
corr(u_i, e_it)    = 0 (assumed)
Panel type         : unbalanced

------------------------------------------------------------------------------
             |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
ln_wage      |
    constant |   1.091836   .0125271    87.16   0.000     1.067283    1.116388
         age |   .0192946   .0002957    65.26   0.000     .0187151     .019874
-------------+----------------------------------------------------------------
hours        |
    constant |   37.04146   .2495206   148.45   0.000     36.55241    37.53052
         age |  -.0271416   .0071549    -3.79   0.000    -.0411649   -.0131183
-------------+----------------------------------------------------------------
     sigma_u |   see e(sigma_u)
     sigma_e |   see e(sigma_e)
------------------------------------------------------------------------------
Dependent variables:   ln_wage hours 
Independent variables: age 
------------------------------------------------------------------------------

. test [ln_wage]age=[hours]age

 ( 1)  [ln_wage]age - [hours]age = 0

           chi2(  1) =   42.51
         Prob > chi2 =    0.0000

lincom would also work here:

. lincom [ln_wage]age - [hours]age

 ( 1)  [ln_wage]age - [hours]age = 0

------------------------------------------------------------------------------
             |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
         (1) |   .0464362   .0071221     6.52   0.000     .0324772    .0603951
------------------------------------------------------------------------------

The coefficients match the output of xtreg pretty closely in this case, though they won't be identical:

. xtreg ln_wage age, re

Random-effects GLS regression                   Number of obs      =     28510
Group variable: idcode                          Number of groups   =      4710

R-sq:  within  = 0.1026                         Obs per group: min =         1
       between = 0.0877                                        avg =       6.1
       overall = 0.0774                                        max =        15

                                                Wald chi2(1)       =   3140.35
corr(u_i, X)   = 0 (assumed)                    Prob > chi2        =    0.0000

------------------------------------------------------------------------------
     ln_wage |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
         age |   .0185667   .0003313    56.04   0.000     .0179174    .0192161
       _cons |   1.120439   .0112038   100.01   0.000      1.09848    1.142398
-------------+----------------------------------------------------------------
     sigma_u |  .36972456
     sigma_e |  .30349389
         rho |  .59743613   (fraction of variance due to u_i)
------------------------------------------------------------------------------

. xtreg hours age, re

Random-effects GLS regression                   Number of obs      =     28443
Group variable: idcode                          Number of groups   =      4709

R-sq:  within  = 0.0005                         Obs per group: min =         1
       between = 0.0007                                        avg =       6.0
       overall = 0.0002                                        max =        15

                                                Wald chi2(1)       =      7.81
corr(u_i, X)   = 0 (assumed)                    Prob > chi2        =    0.0052

------------------------------------------------------------------------------
       hours |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
         age |  -.0240426   .0086031    -2.79   0.005    -.0409043   -.0071809
       _cons |   36.97867   .2717048   136.10   0.000     36.44613     37.5112
-------------+----------------------------------------------------------------
     sigma_u |  6.4129132
     sigma_e |  8.2312259
         rho |  .37771867   (fraction of variance due to u_i)
------------------------------------------------------------------------------
$\endgroup$
5
  • $\begingroup$ Hi Dimitriy, thank you for you answer. I am using a Fixed effect model it this answer this applicable? $\endgroup$
    – vincent
    Jul 24, 2014 at 15:43
  • $\begingroup$ @vincent I don't believe this will work. $\endgroup$
    – dimitriy
    Jul 24, 2014 at 17:58
  • $\begingroup$ For fixed effects, I believe you can maybe use the approach in this SJ paper by J. Lloyd Blackwell. It's a bit more involved since it involves reshapeing your data extensively. $\endgroup$
    – dimitriy
    Jul 24, 2014 at 18:10
  • $\begingroup$ @Dimitry, thank you for the trouble but unfortunately this does not work for my data. $\endgroup$
    – vincent
    Jul 27, 2014 at 20:36
  • $\begingroup$ @vincent You might try this question on Statalist. $\endgroup$
    – dimitriy
    Jul 28, 2014 at 18:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.