Announcement

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

  • Test for moderation effect in FE panel regression

    Hello Stata experts.
    I am beginner to Stata. I need help regarding testing for moderation effect
    Code:
    Size X Returns
    in Stata. additionally, I want to test of the coefficient either two interactions coefficients are same or different? The two moderating variables are in the same model.
    Code:
    Small Size X Returns
    and
    Code:
    Large Size x Returns
    in the below sample models.
    Code:
    Y = B1.Returns + B2.Size+ B3.SizeXReturns, fe vce( cluster panel ID)
    Code:
    Y= B1.Small Size + B2.Large Size + B3.Small Size X Returns + B4.Large Size x Returns, fe vce(cluster ID)

  • #2
    Zulfiqar:
    1) I'm not clear why small and large sizes cannot be gathered together in an unique two-level categorical variable, so that your code becomes more efficient;
    2) that said, the following toy-example might be helpful (BTW: whendealing with a real research topic I would plug -i-timevar- in the right-hand side of the -xtreg.fe- equation):
    Code:
    . use "https://www.stata-press.com/data/r16/nlswork.dta"
    (National Longitudinal Survey.  Young Women 14-26 years of age in 1968)
    
    . xtreg ln_wage i.not_smsa##c.tenure, fe vce(cluster idcode)
    
    Fixed-effects (within) regression               Number of obs     =     28,093
    Group variable: idcode                          Number of groups  =      4,699
    
    R-sq:                                           Obs per group:
         within  = 0.1024                                         min =          1
         between = 0.2507                                         avg =        6.0
         overall = 0.1781                                         max =         15
    
                                                    F(3,4698)         =     440.94
    corr(u_i, Xb)  = 0.1891                         Prob > F          =     0.0000
    
                                      (Std. Err. adjusted for 4,699 clusters in idcode)
    -----------------------------------------------------------------------------------
                      |               Robust
              ln_wage |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
    ------------------+----------------------------------------------------------------
           1.not_smsa |  -.0682325   .0156008    -4.37   0.000    -.0988173   -.0376477
               tenure |   .0373424   .0011226    33.26   0.000     .0351416    .0395432
                      |
    not_smsa#c.tenure |
                   1  |  -.0108808    .002068    -5.26   0.000    -.0149351   -.0068266
                      |
                _cons |   1.589381   .0052665   301.79   0.000     1.579057    1.599706
    ------------------+----------------------------------------------------------------
              sigma_u |  .38309987
              sigma_e |  .30274651
                  rho |  .61557302   (fraction of variance due to u_i)
    -----------------------------------------------------------------------------------
    
    . mat list e(b)
    
    e(b)[1,6]
                  0b.            1.                0b.not_smsa#   1.not_smsa#             
            not_smsa      not_smsa        tenure     co.tenure      c.tenure         _cons
    y1             0    -.06823252     .03734239             0    -.01088083     1.5893814
    
    . test 0b.not_smsa#co.tenure=1.not_smsa#co.tenure
    
     ( 1)  0b.not_smsa#co.tenure - 1.not_smsa#c.tenure = 0
    
           F(  1,  4698) =   27.68
                Prob > F =    0.0000
    
    .
    Kind regards,
    Carlo
    (Stata 19.0)

    Comment

    Working...
    X