This document provides a step-by-step guide for analyzing panel data using STATA 16.0, including importing data, declaring it as panel data, and performing various statistical tests and regressions. It covers commands for descriptive statistics, correlations, OLS regression, robustness tests, and panel regression techniques such as Hausman and LM tests. Additionally, it explains how to export results from STATA to MS Word or Excel.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
43 views13 pages
Analysing Panel Data Using STATA
This document provides a step-by-step guide for analyzing panel data using STATA 16.0, including importing data, declaring it as panel data, and performing various statistical tests and regressions. It covers commands for descriptive statistics, correlations, OLS regression, robustness tests, and panel regression techniques such as Hausman and LM tests. Additionally, it explains how to export results from STATA to MS Word or Excel.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 13
Analysing Panel Data
using STATA 16.0
By Amos Ganyam Step 1: Import Data to STATA • Open STATA from Desktop, Start Menu or Task Bar by clicking on the icon. • Import Data from MS Excel either by copying and pasting into the Data editor or by navigating through the file menu. Step 2: Declare Data to be Panel • Convert your grouping variable from strings to numbers if it was not done manually in Excel. • Type this command egen newID = group(oldID)
• Declare data as panel using the follow commands
xtset newID xtset newID year, yearly Step 3: Descriptive Statistics • Type this command summarize y x1 x2…xn, separator(0) • Separator divides the table into sections depending on specification Step 4: Correlations • Type this command pwcorr y x1 x2…xn, star(5) • Star (5) shows an asterisk for significant relationships Step 5: OLS regression • Type this command regress y x1 x2…xn • List all the variables after regress starting with the dependent variable Step 6: Robustness Tests-Normality • After the OLS command, type this command predict residual,r • This saves the residual as a variable for normality estimation. • For Histogram normality test, type this command: histogram residual,normal • For Jarque-Bera normality test, type this command: jb residual • For Shapiro Wilk test, type this command: swilk residual Step 6 Continued • For Skewness and Kurtosis test, type this command: sktest residual • For VIF, type this command: vif • For Heteroscedasticity, type this command: hettest Step 7: Panel Regression-Hausman Test • First perform your fixed effects with this command: xtreg y x1 x2 x3…xn,fe • Store the fixed effects results with this command: estimates store fixed • Then perform the random effects with this command: xtreg y x1 x2 x3…xn,re • Store the random effects results with this command: estimates store random • Now perform Hausman test with the stored results by typing this command: hausman fixed random Step 8: Panel Regression-LM Test • Perform the random effects again with this command: xtreg y x1 x2 x3….xn,re • Now perform LM test by typing this command: xttest0 Step 9: Regression with Robust Standard Errors • For random effects, use this command: xtreg y x1 x2 x3…xn,re robust • For fixed effects, use this command: xtreg y x1 x2 x3…xn,fe robust • For pooled OLS, use this command: regress y x1 x2 x3…xn,robust Exporting Results from STATA • Copying and pasting results from STATA to Ms Word or Ms Excel Highlight the desired result, select copy as picture, go to Ms Word desired document and paste. Highlight the desired result, select copy as HTML, go to Ms Word desired document and paste for easy extraction of desired components Thanks for listening.