Announcement

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

  • xtrc group coefficients

    Hello,

    I am interested in running a random-coefficients model via xtrc and then saving the group-specific coefficients and standard errors as new variables in the existing dataset. For example, consider a dataset consisting of variables GROUPID, Y, and X.

    After setting GROUPID as the panel variable, I would run xtrc Y X, beta, which will allow me to view the group-specific coefficients and standard errors for X.

    I am looking for the best way to save those group-specific coefficients as one new variable (e.g., XHAT) that will differ by group.

    If I run gen XHAT = _b[X] after the regression, I only get the overall coefficient, not the group-specific ones. I see that I can save the matrices of group coefficients and variances that are saved in e(beta_ps) and e(V_ps), but I am wondering if there is a more straightforward way to save these as a new variable in the dataset instead of extracting specific cells from those matrices and ensuring that the extracted data corresponds to the proper group.

    Any advice would be greatly appreciated.
Working...
X