Let's say your panel data is composed of observations (time points) nested within people. So for each person, there are some number of observations corresponding to different time points. There is some variable (call it "ID" or "name") that tells you which person each observation corresponds to. You run a model with xtreg
predicting some time-varying dependent variable as a function of some number of time-varying or time-invariant variables. In stata
, adding "fe" to the end of a model like this is the same thing as adding a separate dummy variable for each person identifier. In other words, if the id variable is called "id" then these two models will produce (basically) identical results
xtreg depvar iv1 iv2 iv3, fe
xtreg depvar iv1 iv2 iv3 i.id
The only difference is that the "fe" model won't actually bother to show you the coefficients for the various dummy variables - which you probably don't care about anyways.
In both cases, what you are doing is using dummy variables to control for all between-person differences, allowing you to only focus on changes WITHIN a person (hence fixed effects models are sometimes called "within effects" models). In a sense, it estimates a separate intercept for each person. This is why, however, you specify it, time-invariant variables will drop out of the model because they are colinear with the dummy variables.
The alternative way to run a panel analysis is a "random effects" mode, which is the default with xtreg
. Instead of estimating each person's intercept separately, this approach assumes that these intercepts vary randomly around the overall intercept. The benefit of this approach is that it allows you to include time-invariant variables in your model, but on the other hand, this approach does NOT fully control for between-person differences, like the fixed effects approach.
Multilevel modelling - which is what all of this is - is a really complex topic with lots of complexities that I have glossed over here. Stata Press has a really good textbook that walks through a lot of these issues though.