Announcement

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

  • Errors in the Variables Regression (eivreg): saving fixed effects

    I'm using the eivreg command to control measurement error on some covariates in my model. My data are students achievement test scores and associated covariates. I need to include fixed effects for teachers (N ~ 400) and have accomplished that by generating a dummy for each teacher ("tabulate T6_ID"). Now I need to save the fixed effects (~400 dummies) as a variable in my dataset. This is very easy to do with the xtreg and areg commands (e.g., predict [new var name], d), but I have not been able to figure out how with the eivreg command. Anyone know?

    Thanks!

  • #2
    These commands do the job....

    matrix b1 = e(b) [Creates row vector of eivreg coefficients, N=231. That is, each coefficient in the eivreg model is now a variable.]
    svmat b1, names(matcol) [Saves the row vector]
    collapse b1s1-b1s209 [Where s1-s209 are 209 fixed effects: This deletes coefficients that I do not wish to retain -- those that are not fixed effects. New N = 209]
    xpose, clear varname [Transposes the row vector into a column vector. That is, turns the 209 fixed effects into a single variable]

    Final note: The above command line can be useful when working with dummy variable fixed effects in reg or eivreg. It allows one to save the fixed effects as a variable. Whereas areg and xtreg are especially designed for working with fixed effects and therefore have a single command for saving the fixed effects as a variable, reg or eivreg do not.

    Comment

    Working...
    X