Announcement

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

  • Estimating slopes and intercept using empirical Bayes estimation

    Good evening,

    I am using a multilevel to predict the effect of parent's income on children's reading scores accounting for variations across schools. The children are nested within schools.

    I am using the following syntax: xtmixed reading income || sch:, var

    I also want to obtain the estimates of the slope and intercept for each school using empirical bayes method.

    Please, how can I obtain the empirical bayes estimates using Stata?

    Thank you very much.

  • #2
    The best linear unbiased predictions (BLUPs) can be placed in variable eb after -xtmixed- with
    Code:
    predict eb, reffects
    You asked for the slop and intercept for each school, but what you have is just a random intercept model; the effect of income is modeled to be constant across the schools. You would need something like
    Code:
    xtmixed reading income || sch:income, var
    to allow the slopes to vary.

    Comment


    • #3
      Thanks so much. I have another question.

      The final mode I have is


      xtmixed reading income || sch:income, var
      predict yhat, fitted
      predict ebslope ebint , reffects
      gen bayeint = _b[_cons] + ebint
      gen bayeslope = _b[ses] + ebslope ///http://data.princeton.edu/pop510/lang2.html///


      Please, how can I obtain the standard errors and 95% confidence intervals. I apologize in advance if this is a fundamental question.

      Thank you.

      Comment


      • #4
        For standard errors, use
        Code:
        predict slope_se inter_se, reses
        to store the standard errors separately

        The confidence interval would depend on the value of the predictor(s). For your example, if the intention is to compare/rank the school effects on the reading outcome, a common "naive" approach is to just set the income at zero. Then you can retrieve the lower and upper bounds with
        Code:
        gen lower=ebint-1.96*inter_se
        gen upper=ebint+1.96*inter_se
        Or simply a "caterpillar plot" of the effects at the intercept can be drawn with
        Code:
        serrbar ebint inter_se id, yline(0) scale(1.96)

        Comment


        • #5
          Thanks very much

          Comment

          Working...
          X