Is it possible to extract fixed effects in the fixed effects model in Stata?

I know that in R I can do something like this with fixef command:

withinmodel <- plm(formula=y~x,data=Data, model="within")        

But is it possible in Stata?


3 Answers 3


As an alternative you can also use the areg command which will give you the same estimated fixed effects as xtreg. Taking up the previous example:

webuse nlswork
areg ln_w grade age c.age#c.age ttl_exp c.ttl_exp#c.ttl_exp tenure c.tenure#c.tenure 2.race not_smsa south, a(idcode)
predict fe, d

There is a subtle difference between the two commands in terms of how the standard errors are treated when you cluster them. This might be relevant for the other parts of your analysis. areg adjusts the degrees of freedom according to the number of fixed effects that were absorbed. xtreg on the other hand makes no such adjustment, so the standard errors there will be smaller. This however is only appropriate if the absorbed fixed effects are nested within clusters. So if not all observations for any given group is in the same cluster you will be better off with areg.


The previous answer seems to be confusing fixed effects meta-analysis with a fixed effects panel data regression, which is what is being done in R.

In Stata you can obtain estimates of the fixed effects using the -predict- command

webuse nlswork
xtset idcode
xtreg ln_w grade age c.age#c.age ttl_exp c.ttl_exp#c.ttl_exp tenure c.tenure#c.tenure 2.race not_smsa south, fe
predict fe, u

See -help xtreg postestimation- for details.


Yes it is very simple to extract the summary estimate from a fixed-effects m-a in STATA.

You can put it in a local variable


metan tsample tmean tsd csample cmean csd, fixed nograph // the "fixed" option is important here

local beta=_ES

local sebeta=_seES

Be sure to check out the help function - it has all this in it.

  • $\begingroup$ Could you please explain a little bit more? What is the help function I need to check? Thanks in advance:) $\endgroup$ Jan 10, 2013 at 14:43
  • $\begingroup$ Sure simply type "help metan" into the STATA command line and it will come up with pretty much all the info you need $\endgroup$
    – Michael H
    Jan 13, 2013 at 21:11
  • $\begingroup$ I tried but when I type "help metan" I get the answer "help for metan not found"...But I found this stata.com/statalist/archive/2008-04/msg01015.html $\endgroup$ Jan 15, 2013 at 9:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.