ebook img

Using SAS for Econometrics PDF

592 Pages·2011·6.986 MB·English
Save to my drive
Quick download
Download
Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.

Preview Using SAS for Econometrics

WILLIAM E. GRIFFITHS R. CARTER HILL GUAY C. LIM USING SAS FOR ECONOMETRICS FOURTH EDITION This page intentionally left blank Using SAS for Econometrics Using SAS for Econometrics R. CARTER HILL Louisiana State University RANDALL C. CAMPBELL Mississippi State University JOHN WILEY & SONS, INC New York / Chichester / Weinheim / Brisbane / Singapore / Toronto ii Carter Hill dedicates this work to Melissa Waters, his loving and very patient wife. Randy Campbell dedicates this work to his wonderful wife Angie. VICE PRESIDENT AND EXECUTIVE PUBLISHER George Hoffman PROJECT EDITOR Jennifer Manias ASSISTANT EDITOR Emily McGee PRODUCTION MANAGER Micheline Frederick This book was set in Times New Roman by the authors. (cid:2) This book is printed on acid-free paper. The paper in this book was manufactured by a mill whose forest management programs include sustained yield harvesting of its timberlands. Sustained yield harvesting principles ensure that the numbers of trees cut each year does not exceed the amount of new growth. Copyright (cid:2) 2012, 2008, 2004 John Wiley & Sons, Inc. All rights reserved. No part of this publication may be reproduced, stored in a retrieval system or transmitted in any form or by any means, electronic, mechanical, photocopying, recording, scanning or otherwise, except as permitted under Sections 107 or 108 of the 1976 United States Copyright Act, without either the prior written permission of the Publisher, or authorization through payment of the appropriate per-copy fee to the Copyright Clearance Center, 222 Rosewood Drive, Danvers, MA 01923, (508) 750-8400, fax (508) 750- 4470. Requests to the Publisher for permission should be addressed to the Permissions Department, John Wiley & Sons, Inc., 605 Third Avenue, New York, NY 10158-0012, (212) 850-6011, fax (212) 850-6008, E- Mail: [email protected]. ISBN 0-471-111-803209-1 Printed in the United States of America 10 9 8 7 6 5 4 3 2 1 iii PREFACE SAS (www.sas.com) describes itself as “…the leader in business intelligence and predictive analytics software.” Its users • Include 96 of the top 100 companies on the 2006 Fortune Global 500 List. • More than 43,000 business, government and university sites rely on SAS. • Organizations in 113 different countries use SAS. The wide use of SAS in business, government and education means that by learning to use SAS for econometrics, you will be adding a valuable skill whether your goal is a graduate degree or work in the private or public sector. From the point of view of learning econometrics, SAS is very useful as it has powerful built- in commands for many types of analyses, superb graphics, and is a language in which users can construct specialized programs of their own. Our goal is to provide the basics of using SAS for standard econometric analyses. Using SAS for Econometrics provides a relatively concise and easy to use reference. We provide clear and commented code, with the SAS output, which we have edited to as leave it recognizable, but including less spacing few headers than the actual output. The SAS data sets and complete program files used in this book can be found at http://www.principlesofeconometrics.com/poe4/usingsas.htm The programs in this book assume that the default SAS directory contains all the SAS files for data in Principles of Econometrics, 4e (Hill, Griffiths and Lim, 2011, John Wiley and Sons, Inc.) There are a tremendous number of other resources available for learning SAS. Google “Learning SAS” and you will find more than one-half million hits. Appendix 1A is “A Guide to Using SAS Help and Online Documentation,” which gives perspectives on SAS Help systems. A supplement such as this is actually quite essential for use in a classroom environment, for those attempting to learn SAS, and for quick and useful reference. The SAS documentation comes in many volumes, and several are thousands of pages long. This makes for a very difficult challenge when getting started with SAS. The previously published Learning SAS: A Computer Handbook for Econometrics (Hill, John Wiley & Sons, 1993) is now difficult to obtain, and out of date. The design of the book will be such that it is not tied exclusively to Principles of Econometrics, 4e (Hill, Griffiths and Lim, 2011, John Wiley and Sons, Inc.). It will follow the outline of Principles of Econometrics, 4e, and will use Principles of Econometrics, 4e data and empirical examples from the book, but we have included enough background material on econometrics so that instructors using other texts could easily use this manual as a supplement. The volume spans several levels of econometrics. It will be suitable for undergraduate students who will use “canned” SAS statistical procedures, and for graduate students who will use advanced procedures as well as direct programming in SAS’s matrix language, discussed in chapter appendices. Our general strategy has been to include material within the chapters that is accessible to undergraduate and or Masters students, with appendices to chapters devoted to more advanced materials and matrix programming. iv Chapter 1 introduces elements of SAS. Chapters 2-4 discuss estimation and use of the simple linear regression model. Chapter 3’s appendix introduces the concept of Monte Carlo experiments, and Monte Carlo experiments are used to study the properties of the least squares estimators and tests based on them in data generation processes with both normal and non-normal errors. Chapters 5 and 6 discuss the multiple linear regression model: the estimators, tests and predictions. Chapter 5 appendices cover (A) a Monte Carlo experiment demonstrating the properties of the delta method; (B) an introduction to matrix and vector operations using SAS/IML and (C) SAS/IML code for the linear regression model and hypothesis testing. Chapter 7 deals with indicator variables, introduces the Chow test, the idea of a fixed effect and also treatment effect models. Chapter 8 discusses heteroskedasticity, its effects on the least squares estimator, robust estimation of standard errors, testing for heteroskedasticity, modeling heteroskedasticity and the implementation of generalized least squares. There are four appendices to Chapter 8: (A) Monte Carlo experiments with heteroskedastic data, (B) two-step feasible GLS, (C) multiplicative heteroskedasticity and (D) maximum likelihood estimation of the multiplicative heteroskedasticity model. The last appendix covers aspects of numerical optimization calls from PROC IML. Chapter 9 discusses dynamic models including finite distributed lags, autocorrelation and autoregressive distributed lag models. This is the introduction to time-series data and the focus is on stationary series, with an emphasis on testing, estimating and forecasting. Appendices to Chapter 9 include estimation using PROC ARIMA in 9A. Appendix 9B includes PROC IML code for generalized least squares estimation of an AR(1) error model. Chapters 10 and 11 deal with random regressors and the failure of least squares estimation. Chapter 10 first introduces the use of instrumental variables with simulated data. The method for simulating the data is explained in Appendix 10A. The first section of Chapter 10 discusses tests of endogeneity and the validity of over identifying restrictions and the consequences of weak instruments. A second example uses Mroz’s wage data for married women. Appendix 10B includes SAS/IML code for 2SLS including the Cragg-Donald statistic used for testing weak instruments, Appendix 10C uses a Monte Carlo experiment to examine the consequences of weak instruments, and Appendix 10D introduces robust 2SLS and the generalized method of moments. Chapter 11 introduces 2SLS and LIML estimation of simultaneous equations models, and only briefly mentions systems estimation methods. The appendix to Chapter 11 uses Monte Carlo experiments to study the properties of LIML and Fuller’s modifications. SAS/IML code for the LIML estimator are included in this appendix. Chapters 12-14 cover several topics involving time-series estimation with nonstationary data. Chapter 12 focuses on testing for unit roots and cointegration using Dickey-Fuller tests. Chapter 13 discusses estimation of vector error correction and vector autoregressive models. Chapter 14 focuses on macroeconomic and financial models with time varying volatility or conditional heteroskedasticity. This chapter introduces the ARCH and GARCH models as well as several extensions of these models. Chapter 15 treats panel data models, including the pooled least squares estimator with cluster corrected standard errors, the fixed and random effects estimators, with some detailed explanation of the within transformation. The Breusch-Pagan test for random effects and the Hausman test for endogeneity are covered. Seemingly unrelated regressions are discussed and an example given. Chapter 15 appendices include SAS/IML code for pooled regression, the estimation details of variance components, robust fixed effects estimation and the Hausman-Taylor model. Chapter 16 covers the array of qualitative and limited dependent variable models, probit, logit, multinomial v and conditional logit, ordered choice, count data models, tobit models and selectivity models. The appendix to Chapter 16 again takes the opportunity to cover maximum likelihood estimation, this time in the context of probit. Following the book Chapters are two short Appendices, A and B, that serve as a reference for commonly used functions in SAS and probability distributions and random number generation. Appendix C is a pedagogic coverage of the estimation and hypothesis testing in the context of the model of the mean. Several sections outline the maximum likelihood estimation and inference methods in one parameter and two parameter models. Bill Greene kindly allowed us the use of his exponential and gamma distribution example for which we provide SAS/IML code. The authors would like to especially thank Michelle Savolainen for careful comments, as well as Michael Rabbitt, Lee Adkins, Genevieve Briand and the LSU SAS workshop participants. A reader from the SAS Institute provided useful guidance on an early draft. Of course we could not have done this without the support of Bill Griffiths and Guay Lim, co-authors of Principles of Econometrics, 4th Edition. R. Carter Hill [email protected] Randall C. Campbell [email protected] September 1, 2011 vi BRIEF CONTENTS 1. Introducing SAS 1 2. The Simple Linear Regression Model 50 3. Interval Estimation and Hypothesis Testing 82 4. Prediction, Goodness-of-Fit, and Modeling Issues 103 5. The Multiple Regression Model 130 6. Further Inference in the Multiple Regression Model 162 7. Using Indicator Variables 190 8. Heteroskedasticity 207 9. Regression with Time-Series Data: Stationary Variables 264 10. Random Regressors and Moment-Based Estimation 304 11. Simultaneous Equations Models 346 12. Regression with Time-Series Data: Nonstationary Variables 369 13. Vector Error Correction and Vector Autoregressive Models 390 14. Time-Varying Volatility and ARCH Models 406 15. Panel Data Models 428 16. Qualitative and Limited Dependent Variable Models 468 Appendix A. Math Functions 522 Appendix B. Probability 528 Appendix C. Review of Statistical Inference 541 vii CONTENTS 1.13.2 Adding labels 30 1.14 Using PROC SORT 31 1.14.1 PROC PRINT with BY 31 1.14.2 PROC MEANS with BY 32 1.14.3 PROC SORT on two variables 32 1. Introducing SAS 1 1.14.4 Sort in descending order 33 1.1 The SAS System 1 1.15 Merging data sets 33 1.2 Starting SAS 1 Appendix 1A A guide to SAS help and 1.3 The opening display 1 online documentation 34 1.4 Exiting SAS 3 1A.1 SAS command line 35 1.5 Using Principles of Econometrics, 4E 1A.2 SAS help 35 data files 3 1A.3 SAS online documentation 1.5.1 Data definition files 4 37 1.6 A working environment 4 1A.4 SAS online examples 40 1.7 SAS Program structure 6 1A.5 Other resources 40 1.7.1 SAS comment statements 6 Appendix 1B Importing data into SAS 41 1.7.2 Creating a SAS program 7 1B.1 Reading ASCII data 41 1.7.3 Saving a SAS program 8 1B.2 Reading an external ASCII file 1.7.4 Running a SAS program 9 42 1.7.5 Printing data with PROC 1B.3 Importing data in Excel format PRINT 10 47 1.7.6 Saving SAS output 12 1.7.7 Opening SAS programs 15 2. The Simple Linear Regression Model 50 1.8 Summary Statistics using PROC 2.1 Econometric model and estimators 50 MEANS 15 2.2 Example: the food expenditure data 52 1.9 Making errors in SAS programs 17 2.3 Scatter diagram using PROC GPLOT 1.9.1 Typing errors 18 53 1.9.2 The SAS semi-colon “;” 18 2.4 Using PROC REG for simple regression 1.10 SAS Graphics: A scatter diagram 19 54 1.10.1 PROC PLOT 19 2.4.1 Analysis of variance table 54 1.10.2 PROC GPLOT 20 2.4.2 ANOVA auxiliary information 1.11 Creating or modifying data sets 22 56 1.11.1 The SET statement 22 2.4.3 PROC MEANS options 56 1.11.2 Using DROP and KEEP 22 2.5 PROC REG options 57 1.12 Creating new variables 23 2.5.1 Covariance matrix 57 1.12.1 Arithmetic operators 23 2.5.2 The least squares residuals 1.12.2 Comparison operators 24 58 1.12.3 Logical operators 25 2.5.3 Output residuals 58 1.12.4 Using SAS functions 25 2.5.4 PROC UNIVARIATE analysis 1.12.5 Missing values 26 of residuals 59 1.12.6 Using IF-THEN to recode 2.6 Prediction with PROC REG 60 variables 26 2.6.1 Deleting missing values from 1.12.7 Creating a data subset 27 data set 62 1.12.8 Using SET to combine data 2.6.2 Plotting a fitted line using sets 27 PROC GPLOT 63 1.13 Using SET to open SAS data sets 28 2.7 Creating plots using PROC REG 63 1.13.1 Using SAS system options 2.8 SAS ODS graphics 64 29

See more

The list of books you might like

Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.