Announcement

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

  • Panel data between estimator

    Hello everyone,

    I was preparing a little example to show my students how the between estimator is simply an estimator on the averages of the different variables at the panel level, and curiously enough I found that Stata provides close but different in the example I was preparing. Here is the code:

    Code:
    clear all
    set more off
    
    webuse nlswork, clear
    global x "age race collgrad grade hours"
    keep idcode year ln_wage $x
    
    * xtreg be
    xtset idcode year
    xtreg ln_wage $x, be
    
    * regress estimation
    collapse ln_wage $x, by(idcode)
    regress ln_wage $x
    My question is why is there this difference in the estimation of the coefficients? Is this because the panel is unbalanced and when using xtreg, be Stata weights the observations within the panels differently to estimate the panel average? If so, how does it calculate these weights?

    Thanks,

    Alfonso.
    Alfonso Sanchez-Penalver

  • #2
    Use the casewise deletion option
    Code:
    collapse ln_wage $x , by(idcode) cw

    Comment


    • #3
      Thank you Scott, so yes it was because of missing observations, and thus unbalanced panels. Again thanks.
      Alfonso Sanchez-Penalver

      Comment

      Working...
      X