Panel Regression


In this section, you will learn to carry out the fixed effect and random effect panel regressions in STATA. We will explain in detail about them in the following steps:


Step 1: Upload the MS-Excel datasheet in STATA


Let us assume, the name of the MS-Excel datasheet is "Panel-Data-Representation.xlsx" and it is located in the path "D:\data\". Then the data upload command in STATA is given by:

import excel "D:\data\Panel-Data-Representation.xlsx", sheet("DATA") firstrow

Now click ENTER. Your data is uploaded in STATA.



Step 2: Define the data as panel data in STATA

Once the data is uploaded in STATA, we need to define the data to be panel data. For that purpose, we need to declare the cross-section and time-series ids in the data. Then the data declaration command in STATA is given by:

xtset CODE YEAR

Once you click ENTER, you will get the following:

panel variable: CODE (strongly balanced)
time variable: YEAR, 2001 to 2013
delta: 1 unit


Now your data is declared in STATA.



Step 3: Run the fixed effect panel regression in STATA


Once the data is declared in STATA, you can run the panel regression. The basic command for running a panel regression in STATA is xtreg. It has different options of running fixed effect, random effect, and other tests individually. In the dataset, there are five variables (POP, EC, PT, Y, and N), and for the purpose of analysis, we can assume Y as dependent variable and rest all the variables as independent variables. So, the command in STATA is given by:

xtreg Y POP EC PT N DY,fe

Once you click ENTER, you will get the following:



Now, there are several things to observe in the results. First, please notice the
Prob > F value of F(5,72) is significant 1% level. It indicates that the regression model is significant. Now, look at the individual coefficients. Apart from PT and N, all other regressors are significant at 1% level (look at the p-values of the coefficients). Lastly, the value of R-square for this regression is 0.8651.


Step 4: Run the random effect panel regression in STATA


Like the previous case, for applying random effect panel regression, we can assume Y as dependent variable and rest all the variables as independent variables. So, the command in STATA is given by:

xtreg Y POP EC PT N DY,re

Once you click ENTER, you will get the following:



Now, there are several things to observe in the results. First, please notice the
Prob > chi2 value of Wald chi2(5) is significant 1% level. It indicates that the regression model is significant. Now, look at the individual coefficients. Apart from PT and N, EC and DY are significant at 1% level, and POP is significant at 5% level (look at the p-values of the coefficients). Lastly, the value of R-square for this regression is 0.9948.

Following these steps, you can easily carry out the panel regressions in STATA. For more information on these tests and exploring other options of panel regression, please give the following command in STATA:

help xtreg

If the
xtreg command is not installed in STATA, then you will have to use the following command in STATA to find and install the code:

findit xtreg


Go Backfast_rewind
add