Announcement

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

  • Using "IF" command with xtreg fixed effects

    Hi,

    I wanted to restrict by regression using the "if" command in a fixed effect regression with xtreg, fe on it. Can anyone suggest?

    Thanks in advance.

  • #2
    Murphy:
    yes, of course.
    Here you are:
    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 age if idcode<=4, fe
    
    Fixed-effects (within) regression               Number of obs     =         50
    Group variable: idcode                          Number of groups  =          4
    
    R-sq:                                           Obs per group:
         within  = 0.0912                                         min =         11
         between = 0.0122                                         avg =       12.5
         overall = 0.0412                                         max =         15
    
                                                    F(1,45)           =       4.52
    corr(u_i, Xb)  = -0.1407                        Prob > F          =     0.0391
    
    ------------------------------------------------------------------------------
         ln_wage |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
    -------------+----------------------------------------------------------------
             age |   .0157496   .0074109     2.13   0.039     .0008233    .0306758
           _cons |   1.345101   .2231985     6.03   0.000     .8955561    1.794646
    -------------+----------------------------------------------------------------
         sigma_u |  .23522653
         sigma_e |  .32804009
             rho |  .33957838   (fraction of variance due to u_i)
    ------------------------------------------------------------------------------
    F test that all u_i=0: F(3, 45) = 6.62                       Prob > F = 0.0008
    
    .
    Kind regards,
    Carlo
    (Stata 19.0)

    Comment


    • #3
      Thanks so much for the quick help. I had another question, I didn't get any response unfortunately. Should I post it again?

      Comment


      • #4
        https://www.statalist.org/forums/help#adviceextras #1 explains about reposts (please don't). Try to improve the question by making it clearer but in the same thread. For example, you may need to edit a copy of the post to put "more than" in key places.

        Comment

        Working...
        X