logo资料库

Rats 7 使用向导.pdf

第1页 / 共650页
第2页 / 共650页
第3页 / 共650页
第4页 / 共650页
第5页 / 共650页
第6页 / 共650页
第7页 / 共650页
第8页 / 共650页
资料共650页,剩余部分请下载后查看
RATS VERSION 7 USER’S GUIDE Estima 1560 Sherman Ave., Suite 510 Evanston, IL 60201 Orders, Sales Inquiries 800–822–8038 847–864–8772 General Information 847–864–1910 Technical Support Fax: 847–864–6221 Web: General E-mail: Sales: Technical Support: www.estima.com estima@estima.com sales@estima.com support@estima.com
© 2007 by Estima. All Rights Reserved. No part of this book may be reproduced or transmitted in any form or by any means without the prior written permission of the copyright holder. Estima 1560 Sherman Ave., Suite 510 Evanston, IL 60201 Published in the United States of America First Printing: August 2007
Preface Welcome to Version 7 of RATS. In the three years since version 6 was released, we’ve continued our two-pronged approach of making the power and sophistication of RATS available to a wider range of users through the addition and improvement of “wiz- ards”, while simultaneously increasing that power and sophistication for our existing user base. Five years ago, we began a project of implementing (all) the worked examples from a wide range of textbooks. These have included everything from introductory econo- metrics and time series books to graduate level books covering almost the full range of modern econometrics. More recently, we’ve added replication files for a number of important published papers. Our experience with this (over 1000 running examples) has led to great improvements in the program. We’re grateful to Kit Baum, Tim Bollerslev, Chris Brooks, Kai Carstensen, Richard Davis, Steve De Lurgio, Frank Diebold, Jordi Gali, Bill Greene, Bruce Hansen, Jim Hamilton, Fumio Hayashi, Timo Teräsvirta, Ruey Tsay, Harald Uhlig, Marno Verbeek, Mark Watson and Jeff Woold- ridge for their help in providing data and programs, and checking results. The new documentation includes more and better examples. The chapters of the User’s Guide which have seen the most work are 6 (Hypothesis Tests), 10 (Vector Autoregressions), 12 (Special Models) and 13 (Simulations and Bootstrapping). Chapter 13, in particular, has been almost entirely rewritten to bring it up-to-date with the fast-moving branch of computationally-intensive statistics. Thanks to all those in the RATS community who have contributed ideas, suggestions and procedures for others to use. Special thanks go to Walter Enders for writing the popular e-book, The RATS Programming Language, Rob Trevor for setting up and maintaining the RATS discussion list, and to Paco Goerlich and Norman Morin for the numerous procedures they’ve written. Jonathan Dennis from the University of Copenhagen (the principal programmer of the CATS program) had a major role in designing and refining the REPORT and DBOX instructions. Chris Sims, as always, had a special role in influencing the direction of our coverage of time series. John Geweke has provided very helpful discussions on Bayesian methods. Tom Maycock has kept the reference manual up-to-date through six interim versions between 6.0 and 7.0, while handling the bulk of the technical support questions and maintaining our extensive web site. To say that he’s invaluable would be an under- statement. I would also like to thank my wife Robin and daughters Jessica and Sarah for their patience, and Jessica, in particular, for her work on the layout of Macintosh dialog boxes. Thomas A. Doan August 2007
Table of Contents Preface ............................................................................................................................. iii 1. Basics—An Introduction to RATS 1 1.0 Basic Operating Instructions ................................................................................... 2 1.1 Getting Started: An Example ................................................................................... 3 1.1.1 Describing the Data to RATS ...................................................................... 7 1.1.2 Reading In the Data .................................................................................. 10 1.1.3 Computing Statistics .................................................................................. 13 1.1.4 Displaying the Data ................................................................................... 16 1.1.5 Data Transformations and Creating New Series ....................................... 17 1.1.6 Graphing the Data ..................................................................................... 20 1.1.7 Estimating Regressions ............................................................................ 25 1.1.8 Hypothesis Testing .................................................................................... 31 1.1.9 Fitted Values and Forecasting ................................................................... 34 1.1.10 Scalar and Matrix Computations ............................................................... 36 1.2 Learning More About RATS .................................................................................. 38 1.3 More About Reading Data ..................................................................................... 39 1.4 More About Regressions and Estimations ............................................................ 42 1.5 Non-Linear Estimation ........................................................................................... 45 1.6 More About Forecasting ........................................................................................ 47 1.7 More on Data Transformations ............................................................................. 48 1.8 Arithmetic Expressions .......................................................................................... 52 1.9 Conditional Statements and Loops ....................................................................... 56 1.10 Using PROCEDURE and FUNCTION ................................................................... 58 1.11 RATS Instructions: Syntax .................................................................................... 60 1.12 More on Entry Ranges .......................................................................................... 64 1.13 Error Messages ..................................................................................................... 66 2. Dealing with Data 69 2.1 The Tools .............................................................................................................. 70 2.2 Where Are Your Data Now? .................................................................................. 72 2.3 Changing Data Frequencies ................................................................................. 76 2.4 Missing Data ......................................................................................................... 78 2.5 RATS Format ........................................................................................................ 81 2.6 Spreadsheet and Delimited Text Formats ............................................................. 85 2.7 Database Formats, ODBC, and SQL .................................................................... 90 Text Files: Free Format ......................................................................................... 92 2.8 2.9 Text Files: FORTRAN Format ............................................................................... 95 2.10 Haver Analytics and Other Commercial Databases .............................................. 99 2.11 FAME Format Databases .................................................................................... 100
Introduction 2.12 PORTABLE Format ............................................................................................. 102 2.13 Binary Data ......................................................................................................... 103 2.14 File Handling Tips and Tricks .............................................................................. 104 3. Graphics 107 3.1 Graphics .............................................................................................................. 108 3.2 Displaying Graphs on the Screen ....................................................................... 109 3.3 Saving and Opening Graphs ............................................................................... 110 3.4 Printing Graphs ................................................................................................... 112 3.5 Preparing for Publication ..................................................................................... 113 3.6 Labeling Graphs .................................................................................................. 117 3.7 Keys (Legends) ................................................................................................... 120 3.8 Overlay (Two-Scale or Two-Style) Graphs .......................................................... 121 3.9 Multiple Graphs on a Page .................................................................................. 123 3.10 GRTEXT—Adding Text to Graphs ...................................................................... 126 3.11 Graphing Functions ............................................................................................. 127 3.12 Contour Graphs................................................................................................... 128 3.13 Miscellaneous Topics .......................................................................................... 129 4. Scalars, Matrices and Functions 135 4.1 Working with Scalars ........................................................................................... 136 4.2 Getting Information from RATS ........................................................................... 142 4.3 The RATS Data Types ........................................................................................ 143 4.3.1 Basic Data Types ................................................................................................ 146 4.3.2 The Aggregate Data Types ....................................................................... 148 4.3.3 Using Arrays ............................................................................................. 149 4.4 Data Series (The SERIES Type) ......................................................................... 150 4.5 Strings and Labels .............................................................................................. 154 4.6 Matrix Calculations .............................................................................................. 156 4.7 Special Families of Functions.............................................................................. 165 4.7.1 The Sweep Functions ............................................................................... 165 4.7.2 Working With Polynomials ........................................................................ 167 4.7.3 Calendar Functions................................................................................... 168 4.8 Creating Reports ................................................................................................. 169 5. Linear Regression 175 5.1 Annotated Regression Output ............................................................................. 176 5.2 The SMPL Option: Outliers and Sample Selection.............................................. 180 5.3 Extensions to Linear Regression: A Framework ................................................. 183 5.4 Heteroscedasticity ............................................................................................... 186 Example 5.1 Heteroscedasticity ......................................................................... 188 5.5 Serial Correlation ................................................................................................ 189 Example 5.2 Serial Correlation ........................................................................... 191 vi RATS User’s Guide
Introduction 5.6 Instrumental Variables and Two-Stage Least Squares ....................................... 192 Example 5.3 Instrumental Variables ................................................................... 194 5.7 Recursive Least Squares .................................................................................... 195 5.8 Systems Estimation ............................................................................................. 197 Example 5.4 Grunfeld’s Investment Equations: Use of SUR .............................. 200 5.9 Distributed Lags .................................................................................................. 201 5.10 Information Criteria .............................................................................................. 203 Example 5.5 Choosing Lag Length: Information Criteria .................................... 204 5.11 Restricted Regressions ....................................................................................... 205 Example 5.6 Polynomial Distributed Lags .......................................................... 207 5.12 Ridge and Mixed Estimators ............................................................................... 208 Example 5.7 Shiller’s Smoothness Prior ............................................................ 210 5.13 Recomputing a Covariance Matrix ...................................................................... 211 5.14 Robust Estimation ............................................................................................... 214 Example 5.8 Robust Estimation ......................................................................... 215 5.15 Miscellaneous ..................................................................................................... 217 6. Hypothesis and Specification Testing 6.1 6.2 6.3 6.4 219 Introduction ......................................................................................................... 220 Technical Information (Wald Tests)..................................................................... 223 Technical Information (Lagrange Multiplier Tests) .............................................. 224 Testing for Heteroscedasticity ............................................................................. 226 Example 6.1 Testing for Heteroscedasticity ........................................................ 229 6.5 Serial Correlation ................................................................................................ 230 6.6 Granger-Sims Causality/Exogeneity Tests .......................................................... 232 Example 6.2 Granger-Sims Causality Tests ....................................................... 233 6.7 Structural Stability Tests or Constancy Tests ...................................................... 234 Example 6.3 Chow Test Using Subsample Regressions .................................... 236 Example 6.4 Chow Test Using Dummy Variables ............................................... 237 Example 6.5 General Constancy Tests............................................................... 238 6.8 Functional Form Tests ........................................................................................ 240 6.9 Specification Tests .............................................................................................. 242 Example 6.6 Hansen’s Specification Test ........................................................... 246 Example 6.7 Hausman’s Specification Test ........................................................ 247 6.10 Unit Root Tests ................................................................................................... 249 6.11 Cointegration Tests ............................................................................................. 252 Example 6.8 Cointegration Testing Procedures ................................................. 254 7. Non-Linear Estimation 255 7.1 General Principles and Problems ........................................................................ 256 7.2 Newton–Raphson and Related Methods ............................................................ 258 7.3 Derivative-Free Methods ..................................................................................... 262 7.4 Constrained Optimization .................................................................................... 264 RATS User’s Guide vii
Introduction 7.5 Covariance Matrices ........................................................................................... 266 7.6 Setting Up Your Model: NONLIN and FRML ....................................................... 270 7.7 Non-Linear Least Squares/Two-Stage Least Squares ........................................ 276 Example 7.1 Non-Linear Least Squares............................................................. 278 7.8 Method of Moments Estimators (Univariate) ....................................................... 279 Example 7.2 Generalized Instrumental Variables ............................................... 281 7.9 Non-Linear Systems Estimation .......................................................................... 282 Example 7.3 Non-Linear Systems Estimation .................................................... 285 7.10 More General Maximization ................................................................................ 286 7.11 Using FUNCTION ............................................................................................... 289 Example 7.4 Using FUNCTION .......................................................................... 291 7.12 Using FIND .......................................................................................................... 293 7.13 Troubleshooting .................................................................................................. 294 8. Introduction to Forecasting 297 8.1 Introduction ......................................................................................................... 298 8.2 Producing Forecasts ........................................................................................... 300 8.3 Generating and Using Results ............................................................................ 303 8.4 Forecast Performance ......................................................................................... 307 8.5 Comparing Forecasts .......................................................................................... 309 Troubleshooting .................................................................................................. 310 8.6 9. Univariate Forecasting 313 9.1 Time Series Methods .......................................................................................... 314 9.2 Common Issues .................................................................................................. 315 9.3 Exponential Smoothing ....................................................................................... 317 9.4 Box-Jenkins Models ............................................................................................ 319 9.4.1 The ARIMA Procedures ...................................................................................... 329 9.5 Spectral Forecasting ........................................................................................... 334 9.6 Intervention Modeling .......................................................................................... 336 10. Vector Autoregressions 341 10.1 Setting Up a VAR ................................................................................................ 342 10.2 Estimation ........................................................................................................... 345 10.3 Data Analysis ...................................................................................................... 346 10.4 Hypothesis Tests ................................................................................................. 347 Example 10.1 Testing Lag Length ...................................................................... 348 Example 10.2 Block Exogeneity ......................................................................... 350 10.5 Orthogonalization ................................................................................................ 351 10.5.1 Choleski Factorization ............................................................................. 352 10.5.2 Structural Decompositions ...................................................................... 353 10.5.3 Blanchard-Quah/Long-Run Restrictions ................................................. 358 10.5.4 Other Factorizations ................................................................................ 361 10.5.5 Examples ................................................................................................ 362 viii RATS User’s Guide
分享到:
收藏