In this chapter, I want to discuss the Fixed effect estimator in Panel data regression.

Fixed Effect Estimator


Meaning of Fixed Effect based on the researcher in Econometrics (Torres- Reyna 2010, Princeton Press)

  • Use fixed-effects (FE) whenever you are only interested in analyzing the impact of variables that vary over time.
  • FE explore the relationship between predictor and outcome variables within an entity (country, person, company, etc.).
  • Each entity has its own individual characteristics that may or may not influence the predictor variables (for example, being a male or female could influence the opinion toward certain issue; or the political system of a particular country could have some effect on trade or GDP; or the business practices of a company may influence its stock price).
  • When using FE we assume that something within the individual may impact or bias the predictor or outcome variables and we need to control for this. This is the rationale behind the assumption of the correlation between entity’s error term and predictor variables. FE remove the effect of those time-invariant characteristics so we can assess the net effect of the predictors on the outcome variable.
  • Another important assumption of the FE model is that those time-invariant characteristics are unique to the individual and should not be correlated with other individual characteristics. Each entity is different therefore the entity’s error term and the constant (which captures individual characteristics) should not be correlated with the others. If the error terms are correlated, then FE is no suitable since inferences may not be correct and you need to model that relationship (probably using random-effects), this is the main rationale for the Hausman test (presented later on in this document).

Mathematics Formula

This calculation is important in the process of calculating a panel data result from the unobserved heterogeneity.

Let say we have the mathematical formula that counts the number of Accident in the states

lets say 

Basically fixed estimator will treat that all the data is having a time constant. Therefore we will delete the covariance or relation from unobserved heterogeneity with one of the variables in the model.

  1. First let say we have the fatality formula, where yit is the fatalities  

  2. The fixed effect is used because we believe that

  3. Because we want to exclude any time constant, we try to demean the variable that has variance in time such as y 

  4. And x 

  5. And the error 

  6. It gave us the simple algebra of 

  7. It gave us the formula  

Stata command 

So we will use the data from Baum. And we also will use the do-files instead of typing the command. 

To use the data for the experiment. You can use from here.

If you are wondering how to use the do-files in STATA please take a look on the video below. 

One way Fixed effect estimator

To work on the do files for this state, please take a look at this video that shows how to use do-file in Stata

The data that we will use is the traffic and fatality rate in the US. 

You can get the data from this link 


Note: If you want to use your own data and you are confused about how to prepare the data from excel or any other spreadsheet into STATA panel data format. Then click this link or check out this video. 

The command is very simple 

xtreg depvar [independent variable], fe 

#we will use this as the example

xtreg fatal beertax spircons unrate perincK, fe

Two way Fixed effect estimator

If you believe that there is a difference in terms of time, then its worth to put also the time as a variable. How to do that

Use this code 

If you do not know how to use them do file in STATA  check this video. 

quietly tabulate year, generate(yr)
local j 0
forvalues i=82/87 {
    local ++j
    rename yr`j' yr`i'
    quietly replace yr`i' = yr`i' - yr7
drop yr7
xtreg fatal beertax spircons unrate perincK yr*, fe
test yr82 yr83 yr84 yr85 yr86 yr87

How to read the result

I borrow the guidance from Princeton Press about how to read the result in STATA

There are couple of things that are important to be seen. 

The thumb rules are

  1. The rho = rho show the intraclass correlation, it shows how the correlation inside the group of the variable. 
  2. The t constant = if you want your hypothesis alternative to be accepted then the number should be above 1.96.
  3. The P>[t] = If you want your hypothesis alternative to be accepted then two tail P values should be below 0.1, 0,05, or 0.01.
  4. The Prob > F = If the F value less than 0.05 then the model is ok.
Current rating: 5


Most Recent

Recent Posts

The code for manipulate unbalance panel data

1 day, 16 hours ago

Great book to learn machine Learning

3 weeks, 3 days ago

All latex symbol

3 weeks, 6 days ago

Having your own latex library can be quite handy if you work on a lot of data. Therefore I migrate them here. 

read more

Fixed effect estimator

3 weeks, 6 days ago

Prepare your panel data in Stata

4 weeks ago

Adobe after effects tutorial - Motion tracking

1 month, 1 week ago

17 freelance website design to attract your potential customer

1 month, 1 week ago

17 inspiring examples of freelance business websites

read more