Announcement

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

  • Obtain regression residual for panel data

    Dear Statalist,

    I am new to the Stata and am dealing with the panel data for a sample of firms over different sample periods. Specifically, I would like to obtain the residual (ei,t) for the following regrssion for each firm i in each year t:

    Yi,t=Alpha+Beta1*Xi,t+Beta2*Zi,t+Beta*Ki,t+ei,t

    variables are shown as follows:
    firmid (i) year (t) Y X1 X2 X3
    1 1996 0.0576 0 1.3721 0.0478
    1 1997 0.0433 0 1.9781 0.0371
    1 1998 -0.0345 1 1.9777 0.0577
    1 1999 -0.0111 1 2.2777 0.0142
    1 2000 0.0344 1 1.6777 0.0239
    2 1998 0.0988 1 1.1123 -0.0411
    2 1999 0.1122 1 1.3784 -0.0361
    2 2000 -0.0431 1 2.9033 0.0023
    2 2001 -0.0019 0 3.2101 0.0089
    3 1997 0.0177 1 4.1011 1.0123
    3 1998 0.0498 1 2.3891 1.0981
    3 1999 0.0321 0 2.9871 1.0345
    3 2000 0.0077 1 2.3011 1.0874
    Could you please kindly show me the code for such loop?

    Many thanks.


  • #2
    Code:
    predict [resid_name], resid
    Do this postestimation.

    Comment


    • #3
      Originally posted by Maxence Morlet View Post
      Code:
      predict [resid_name], resid
      Do this postestimation.
      Thanks Maxence!

      Comment

      Working...
      X