BASIC STEPS TO DO A SIMPLE PANEL DATA ANALYSIS IN STATA

Similar documents
set mem 10m we can also decide to have the more separation line on the screen or not when the software displays results: set more on set more off

SOCY7706: Longitudinal Data Analysis Instructor: Natasha Sarkisian. Panel Data Analysis: Fixed Effects Models

Session 2: Fixed and Random Effects Estimation

PANEL DATA REGRESSION MODELS IN EVIEWS: Pooled OLS, Fixed or Random effect model?

INTRODUCTION TO PANEL DATA ANALYSIS

Example 1 of panel data : Data for 6 airlines (groups) over 15 years (time periods) Example 1

Intermediate Stata. Jeremy Craig Green. 1 March /29/2011 1

MODULE THREE, PART FOUR: PANEL DATA ANALYSIS IN ECONOMIC EDUCATION RESEARCH USING SAS

Sacha Kapoor - Masters Metrics

GETTING STARTED WITH STATA. Sébastien Fontenay ECON - IRES

Labor Economics with STATA. Estimating the Human Capital Model Using Artificial Data

An Introduction to Stata Part II: Data Analysis

Seminar Corporate Governance: Topics on Data Analysis with STATA

Migration and the Labour Market: Data and Intro to STATA

Week 4: Simple Linear Regression II

Introduction to Stata: An In-class Tutorial

Lab 07: Multiple Linear Regression: Variable Selection

Panel Data 4: Fixed Effects vs Random Effects Models

STATA TUTORIAL B. Rabin with modifications by T. Marsh

Can double click the data file and it should open STATA

Resources for statistical assistance. Quantitative covariates and regression analysis. Methods for predicting continuous outcomes.

An Introductory Guide to Stata

GRETL FOR TODDLERS!! CONTENTS. 1. Access to the econometric software A new data set: An existent data set: 3

Stata For Dummies. Table of Contents

A quick introduction to STATA

Applied Statistics and Econometrics Lecture 6

GETTING DATA INTO THE PROGRAM

A quick introduction to STATA:

Dr. Barbara Morgan Quantitative Methods

A First Tutorial in Stata

ECON Stata course, 3rd session

INTRODUCTION to. Program in Statistics and Methodology (PRISM) Daniel Blake & Benjamin Jones January 15, 2010

Detecting and Circumventing Collinearity or Ill-Conditioning Problems

Econometrics I: OLS. Dean Fantazzini. Dipartimento di Economia Politica e Metodi Quantitativi. University of Pavia

/23/2004 TA : Jiyoon Kim. Recitation Note 1

Saving Time with Prudent Data Management. Basic Principles To Save Time. Introducing Our Data. Yearly Directed Dyads (Multiple Panel Data)

Analysis of Panel Data. Third Edition. Cheng Hsiao University of Southern California CAMBRIDGE UNIVERSITY PRESS

Outline. Topic 16 - Other Remedies. Ridge Regression. Ridge Regression. Ridge Regression. Robust Regression. Regression Trees. Piecewise Linear Model

Introduction to Stata - Session 1

Economics 145 Fall 2009 Howell Getting Started with Stata

STATA Tutorial. Introduction to Econometrics. by James H. Stock and Mark W. Watson. to Accompany

Getting started with Stata 2017: Cheat-sheet

Introduction to SAS. I. Understanding the basics In this section, we introduce a few basic but very helpful commands.

A Short Introduction to STATA

A quick introduction to STATA:

Introduction to Stata - Session 2

Missing Data Analysis for the Employee Dataset

Economics 561: Economics of Labour (Industrial Relations) Empirical Assignment #2 Due Date: March 7th

Week 11: Interpretation plus

MPhil computer package lesson: getting started with Eviews

Gov Troubleshooting the Linear Model II: Heteroskedasticity

Applied Regression Modeling: A Business Approach

From the help desk. Allen McDowell Stata Corporation

Section 4.1: Time Series I. Jared S. Murray The University of Texas at Austin McCombs School of Business

Model Diagnostic tests

Introduction to Stata Session 3

Basic Calculator Functions

Week 10: Heteroskedasticity II

Serial Correlation and Heteroscedasticity in Time series Regressions. Econometric (EC3090) - Week 11 Agustín Bénétrix

Revision of Stata basics in STATA 11:

Stat 5100 Handout #14.a SAS: Logistic Regression

May 24, Emil Coman 1 Yinghui Duan 2 Daren Anderson 3

Week 1: Introduction to Stata

Department of Economics Spring 2018 University of California Economics 154 Professor Martha Olney Stata Lesson Thursday February 15, 2018

STATA 13 INTRODUCTION

Coding Categorical Variables in Regression: Indicator or Dummy Variables. Professor George S. Easton

An Introduction to Stata Part I: Data Management

Two-Stage Least Squares

Economists. Melissa Dell Matt Notowidigdo Paul Schrimpf

I Launching and Exiting Stata. Stata will ask you if you would like to check for updates. Update now or later, your choice.

Introduction to Eviews Updated by Jianguo Wang CSSCR September 2009

Ninth ARTNeT Capacity Building Workshop for Trade Research "Trade Flows and Trade Policy Analysis"

Use data on individual respondents from the first 17 waves of the British Household

Empirical Asset Pricing

An Introduction to Stata By Mike Anderson

PRI Workshop Introduction to AMOS

First-level fmri modeling

Exploring Econometric Model Selection Using Sensitivity Analysis

Depending on the computer you find yourself in front of, here s what you ll need to do to open SPSS.

Introduction to Stata Toy Program #1 Basic Descriptives

Advanced Regression Analysis Autumn Stata 6.0 For Dummies

Birkbeck College Department of Economics, Mathematics and Statistics.

Stat 5100 Handout #11.a SAS: Variations on Ordinary Least Squares

ST Lab 1 - The basics of SAS

INSTRUCTOR: KLAUS MOELTNER

Standard Errors in OLS Luke Sonnet

StatCalc User Manual. Version 9 for Mac and Windows. Copyright 2018, AcaStat Software. All rights Reserved.

Minitab 17 commands Prepared by Jeffrey S. Simonoff

Heteroskedasticity and Homoskedasticity, and Homoskedasticity-Only Standard Errors

Independent Variables

Exercise 1: Introduction to Stata

AUTHOR SUBMITTED MANUSCRIPT ERL R2. A Appendix for Online Supplement

UNSD - OECD Joint System Web Browser Client - UN Comtrade Version

Problem set for Week 7 Linear models: Linear regression, multiple linear regression, ANOVA, ANCOVA

Data Management 2. 1 Introduction. 2 Do-files. 2.1 Ado-files and Do-files

Missing Data and Imputation

Data-Analysis Exercise Fitting and Extending the Discrete-Time Survival Analysis Model (ALDA, Chapters 11 & 12, pp )

EXAMPLE 10: PART I OFFICIAL GEOGRAPHICAL IDENTIFIERS IN THE UNDERSTANDING SOCIETY PART II LINKING MACRO-LEVEL DATA AT THE LSOA LEVEL

Intro to E-Views. E-views is a statistical package useful for cross sectional, time series and panel data statistical analysis.

Title stata.com import haver Syntax

Transcription:

BASIC STEPS TO DO A SIMPLE PANEL DATA ANALYSIS IN STATA By: Mahyudin Ahmad @ 2017 Basic steps to do a panel data analysis in STATA Page 1

Outline Outline: 1. Setting up commands 2. Importing data to Stata 3. Panel data basic commands 4. xtreg command 5. Exploring panel data 6. Panel data models: Pooled OLS, Fixed effects, Random effects 7. Testing procedure 8. Hausman test 9. BP-LM test 10. Is time dummy important? 11. Which model is the best? 12. Summary: steps in panel data analysis IMPORTANT! Basic steps to do a panel data analysis in STATA Page 2

1. Setting up commands Basic setting up steps: set mem 1000m set more off cd "D:\<your working directory name>" log using <log file name>.log It is advisable to do these steps before embarking on any regression. The log file keeps the whole works you did including the regression results/outputs. Note: see also videos about basic introduction to STATA here Basic steps to do a panel data analysis in STATA Page 3

2. Importing data to Stata To load data from Excel for the first time, copy from Excel and paste into STATA: REMEMBER: Sort your data vertically according to panel group (column1), time (column2), followed by the variables country year gdp sav pop Albania First crosssectional 1990 6.75179343 20.9783993 1.6 unit Albania 1991-11.4142038-13.0284996-0.2 Albania 1992-27.5896031-75.4131012-1.6 Albania 1993-5.69153612-33.6716003-1.4 Albania 1994 11.1974627-9.88263035 0.2 Albania 1995 9.1941036-3.94799995 1.2 Albania 1996 7.55757392-11.8118 1.3 Albania 1997 7.73893405-9.25912952 1.2 Albania 1998-8.06352119-6.69585991 1.1 Albania 1999 missing -1.66910005 1.1 Algeria 1990 2.29575915 27.4666996 2.5 Algeria Time 1991-3.72084675 36.6562004 2.4 Algeria 1992-3.55414336 32.3755989 2.4 dimension Algeria 1993-0.79384221 27.8384991 2.3 Algeria 1994-4.35723136 27.0359993 2.2 Algeria 1995-3.31007521 28.4333992 2.2 Algeria 1996 1.59040861 31.4230003 2.2 Algeria 1997 1.58921549 32.1985016 2.2 Algeria 1998-1.03429441 27.0669003 2.1 Algeria 1999 1.44857954 31.6912003 2.1 Basic steps to do a panel data analysis in STATA Page 4

3. Panel data basic commands Commands normally used in panel data analysis. Panel data commands start with xt help xt : to obtain help files on xt command xtset id year : to inform Stata that our data is panel xtsum: to summarize data, will give overall, between and within stats and obs xtdes <var id> : to describe a variable xtreg : to start panel regression. We ll look more at this command after this. Basic steps to do a panel data analysis in STATA Page 5

4. xtreg command Basic steps to do a panel data analysis in STATA Page 6

5. Exploring panel data Basic steps to do a panel data analysis in STATA Page 7

6. Pooled OLS POLS assumes the data have common intercept! Basic steps to do a panel data analysis in STATA Page 8

6. Fixed effects The difference between FE and RE!! FE allows for many intercepts Basic steps to do a panel data analysis in STATA Page 9

6. Random effects The difference between FE and RE!! Basic steps to do a panel data analysis in STATA Page 10

7. Testing procedure Basic steps to do a panel data analysis in STATA Page 11

8. Hausman test Basic steps to do a panel data analysis in STATA Page 12

9. BP-LM test Basic steps to do a panel data analysis in STATA Page 13

10. Is time dummy important? Basic steps to do a panel data analysis in STATA Page 14

11. Which model is the best? Fixed effect estimator of β remains consistent even if the true model is not fixed effect Basic steps to do a panel data analysis in STATA Page 15

12. Summary: steps in panel analysis Steps: 1. Load panel data into stata, make sure your data have N>T 2. xtreg nvar tvar (nvar= cross section variable, tvar= time variable) 3. Do Hausman test FE against RE (to test the error tem that is assumed to have unobserved parameters correlating with regressors) 4. Do Hausman test: Significant choose FE, insignificant choose RE 5. If choose RE, the presence of unobserved parameters in error term is assumed but they happened at random, not correlated with regressors. 6. Do BP-LM test to check whether the unobserved parameters are actually present? Significant choose RE, insignificant choose POLS 7. POLS means the error term is iid and doesn t have unobserved parameters at all. 8. Finally, do the common diagnostic tests to your model (multicollinearity (vif), heterokedasticity (xttest3), serial correlation (xtserial). 9. Remember, always run your final model with robust standard error. Basic steps to do a panel data analysis in STATA Page 16

THE END Thank you Basic steps to do a panel data analysis in STATA Page 17