GPD-1 Second Edition April 1994 An Introduction to GEMPACK GEMPACK Document No. 1 Copyright 1993-94 by the Impact Project and KPSOFT ISSN 1030-2514 This is part of the documentation of the GEMPACK Software System for solving large economic models, developed by KPSOFT and the IMPACT Project, Menzies Building, Monash University, Wellington Road, Clayton, Vic. 3168, Australia. Abstract GEMPACK is a suite of general-purpose economic modelling software especially suitable for general and partial equilibrium models. It can handle a wide range of economic behaviour and also contains powerful capabilities for solving intertemporal models. GEMPACK provides software for calculating accurate solutions of an economic model, starting from an algebraic representation of the equations of the model. These equations can be written as levels equations, linearized equations or a mixture of these two. The software is user-friendly, provides a range of utility programs for handling the economic data base and the results of simulations, and is fully documented from a user's point of view. GEMPACK runs on a wide variety of computers including o 80386/80486 microcomputers running DOS, Windows or OS/2, o Apple Macintosh computers, o Unix machines, o DEC VAX and Alpha machines running VMS, and o other mainframe, mini and microcomputers with an ANSI standard Fortran 77 compiler. This document is a "how to run it" introduction to GEMPACK. In particular it describes how to carry out simulations and how to build and/or modify models. If you have access to a computer with GEMPACK, this document supplemented by a small amount of machine- and site-specific information should enable you to carry out most routine modelling tasks with GEMPACK. The document also contains a guide to the rest of the GEMPACK documentation. _ Document Attributes Name : An Introduction to GEMPACK Audience : CGE Modellers Identifier : GPD-1 History : Date Author(s) Comment April 1993 Jill Harrison and First edition Ken Pearson April 1994 Jill Harrison and Second edition Ken Pearson CONTENTS CHAPTER 1 INTRODUCTION 1.1 The Programs . . . . . . . . . . . . . . . . . . . 1-2 1.2 Different Versions of GEMPACK . . . . . . . . . . 1-3 1.2.1 Source-code Versions . . . . . . . . . . . . . . 1-3 1.2.2 Executable Image Version . . . . . . . . . . . . 1-3 1.2.3 Demonstration Version . . . . . . . . . . . . . 1-4 1.3 Models Supplied with GEMPACK . . . . . . . . . . . 1-4 1.4 Documentation of GEMPACK . . . . . . . . . . . . . 1-5 1.5 A Guide to This Document . . . . . . . . . . . . . 1-6 1.5.1 For New GEMPACK Users . . . . . . . . . . . . . 1-6 1.5.2 Changes From Earlier Versions of GEMPACK . . . . 1-7 1.6 Contacting the Impact Project . . . . . . . . . 1-11 1.7 Acknowledgements . . . . . . . . . . . . . . . . 1-11 CHAPTER 2 HOW TO CARRY OUT SIMULATIONS WITH MODELS 2.1 The Steps in Carrying Out a Simulation . . . . . . 2-3 2.2 An Example Simulation with Stylized Johansen . . . 2-6 2.2.1 Introduction to the Stylized Johansen Model . . 2-6 2.2.2 Step 1 - Run TABLO . . . . . . . . . . . . . . . 2-8 2.2.3 Step 2 - Run GEMSIM . . . . . . . . . . . . . 2-10 2.2.4 Step 3 - Run GEMPIE . . . . . . . . . . . . . 2-12 2.2.5 Interpreting the Results . . . . . . . . . . . 2-14 2.3 Specifying a Simulation . . . . . . . . . . . . 2-16 2.3.1 Specifying a Simulation via a GEMPACK Command file . . . . . . . . . . . . . . . . . . . . . 2-16 2.3.2 Specifying a Simulation Interactively . . . . 2-20 2.3.3 Specifying a Simulation via a Stored-input File 2-22 2.4 How to Carry out Several Simulations At Once . . 2-24 2.4.1 Running SAGEM Interactively . . . . . . . . . 2-28 2.5 How Johansen and Multi-step Solutions are Calculated . . . . . . . . . . . . . . . . . . . 2-29 2.5.1 The Linearized Equations of a Model . . . . . 2-29 2.5.2 Johansen Solutions . . . . . . . . . . . . . . 2-31 2.5.3 Multi-step Simulations and Accurate Solutions of Nonlinear Equations . . . . . . . . . . . . 2-31 2.6 TABLO-generated Programs - An Alternative to GEMSIM . . . . . . . . . . . . . . . . . . . . . 2-35 2.6.1 Steps in Carrying Out a Simulation using TABLO-generated Program . . . . . . . . . . . 2-36 2.6.2 Step 1(a) - Run TABLO . . . . . . . . . . . . 2-39 2.6.3 Step 1(b) - Compile and Link the TABLO-generated Program . . . . . . . . . . . 2-41 2.6.4 Step 2 - Run the TABLO-generated Program . . . 2-41 2.6.5 Step 3 - Run GEMPIE . . . . . . . . . . . . . 2-42 2.7 The Simulation (Step 2) Revisited . . . . . . . 2-43 2.7.1 Generate the Equations and BCV Files . . . . . 2-43 2.7.2 Specify the Closure and Save It . . . . . . . 2-45 2.7.3 Specify the Shocks and Solution Method . . . . 2-45 2.8 GEMPACK File Types and Names . . . . . . . . . . 2-47 2.8.1 Standard Suffixes . . . . . . . . . . . . . . 2-47 2.8.2 Files - Binary or Text? . . . . . . . . . . . 2-47 2.8.3 Why So Many Files? . . . . . . . . . . . . . . 2-48 CHAPTER 3 BUILDING OR MODIFYING MODELS 3.1 Writing Down the Equations of a Model . . . . . . 3-2 3.1.1 Writing Down the Equations of Stylized Johansen 3-2 3.2 Data Requirements for the Linearized Equations . . 3-5 3.2.1 Data Requirements for Stylized Johansen . . . . 3-6 3.3 Constructing the TABLO Input File for a Model . . 3-7 3.3.1 Constructing Part of the TABLO Input File for Stylized Johansen . . . . . . . . . . . . . . . 3-7 3.3.2 The TABLO Input File for the Stylized Johansen Model . . . . . . . . . . . . . . . . . . . . 3-11 3.3.3 Completing the TABLO Input File for Stylized Johansen . . . . . . . . . . . . . . . . . . . 3-14 3.3.4 Change or Percentage-Change Variables . . . . 3-17 3.3.5 TABLO Language - Syntax and Semantics . . . . 3-17 3.4 Constructing Data Files . . . . . . . . . . . . 3-18 3.4.1 Constructing the Data File for Stylized Johansen . . . . . . . . . . . . . . . . . . . 3-18 3.4.2 Modifying Data Using MODHAR . . . . . . . . . 3-22 3.4.3 Using TABLO for Data Manipulation . . . . . . 3-23 3.4.4 Header Array and Text Data Files . . . . . . . 3-24 3.5 Linearized TABLO Input Files . . . . . . . . . . 3-27 3.5.1 A Linearized TABLO Input File for Stylized Johansen . . . . . . . . . . . . . . . . . . . 3-28 3.5.2 Noteworthy Features in the Linearized TABLO Input File . . . . . . . . . . . . . . . . . . 3-32 3.5.3 Writing UPDATE Statements . . . . . . . . . . 3-35 3.6 Levels TABLO Input Files . . . . . . . . . . . . 3-38 3.6.1 A Levels TABLO Input File for Stylized Johansen 3-38 3.7 Mixed, Linearized or Levels TABLO Input Files? . 3-43 3.8 TABLO Linearizes Levels Equations Automatically 3-44 3.9 Condensing Models . . . . . . . . . . . . . . . 3-45 3.9.1 Substituting Out Variables . . . . . . . . . . 3-45 3.9.2 Backsolving for Variables . . . . . . . . . . 3-48 3.9.3 Omitting Variables . . . . . . . . . . . . . . 3-49 3.9.4 Stopping and Restarting TABLO . . . . . . . . 3-50 CHAPTER 4 GEMSIM AND TABLO-GENERATED PROGRAMS 4.1 Actions in GEMSIM and TABLO-generated Programs . . 4-1 4.2 How These Programs Carry Out Multi-step Simulations . . . . . . . . . . . . . . . . . . . 4-3 4.2.1 Results of a 4-step Simulation Looked at in Detail . . . . . . . . . . . . . . . . . . . . . 4-6 4.3 Carrying out Simulations on Other Machines . . . . 4-8 4.4 Memory Required by TABLO-generated Programs . . . 4-8 CHAPTER 5 COMMON FEATURES OF GEMPACK PROGRAMS 5.1 Responding to Prompts . . . . . . . . . . . . . . 5-1 5.1.1 Default Response to Questions and Prompts . . . 5-1 5.2 Comments in Input from the Terminal . . . . . . . 5-2 5.3 Interactive and Batch Operation, Stored-input and Log Files . . . . . . . . . . . . . . . . . . . . 5-2 5.3.1 Invalid Input When Using Options 'sif' or 'asi' 5-4 5.3.2 Differences Between Batch and Interactive Program Dialogues . . . . . . . . . . . . . . . 5-5 5.3.3 Terminal Output and Log Files . . . . . . . . . 5-5 5.4 Other Program Options . . . . . . . . . . . . . . 5-6 5.5 Increasing Parameters . . . . . . . . . . . . . . 5-7 5.6 Error Messages . . . . . . . . . . . . . . . . . . 5-8 5.7 Eliminating Syntax Errors in GEMPACK Command Files 5-9 CHAPTER 6 CHOOSING THE CLOSURE, SHOCKS, AND OTHER SETS OF VARIABLES 6.1 Specifying the Closure . . . . . . . . . . . . . . 6-1 6.1.1 Miniature ORANI Model . . . . . . . . . . . . . 6-2 6.1.2 Specifying the Closure via a Command File . . . 6-3 6.1.3 Component Numbers for a Variable . . . . . . . . 6-6 6.2 Choosing Other Sets of Variables . . . . . . . . . 6-8 6.2.1 Choosing Sets of Variables via a Command File . 6-8 6.2.2 Choosing Sets of Variables Interactively . . . 6-12 6.2.3 Simple Choices . . . . . . . . . . . . . . . . 6-13 6.2.4 Choosing Using the Lists Option . . . . . . . 6-14 6.3 Specifying the Shocks . . . . . . . . . . . . . 6-16 6.3.1 Specifying the Shocks via a Command File . . . 6-16 6.3.2 Specifying the Shocks Interactively . . . . . 6-17 6.3.3 Shock Files . . . . . . . . . . . . . . . . . 6-19 CHAPTER 7 MORE ABOUT SIMULATIONS AND SOLUTION FILES 7.1 Several Simultaneous Johansen Simulations via SAGEM . . . . . . . . . . . . . . . . . . . . . . 7-1 7.2 Printing the Results of a Simulation . . . . . . . 7-4 7.3 Subtotals . . . . . . . . . . . . . . . . . . . . 7-5 7.3.1 Subtotals - An Example . . . . . . . . . . . . . 7-5 7.3.2 Subtotals and Sets of Shocks in General . . . . 7-6 7.3.3 Storing Subtotals on Solution Files When Running SAGEM . . . . . . . . . . . . . . . . . . . . . 7-6 7.3.4 Printing Subtotals or Individual Column Results using GEMPIE . . . . . . . . . . . . . . . . . . 7-7 7.4 Solution Files from Multi-Step Simulations . . . . 7-8 7.5 How SAGEM and TABLO-generated Programs Solve Linear Equations . . . . . . . . . . . . . . . . . 7-9 7.6 Special Options for SAGEM and GEMPIE . . . . . . 7-10 7.6.1 SAGEM Options . . . . . . . . . . . . . . . . 7-10 7.6.2 GEMPIE Options . . . . . . . . . . . . . . . . 7-12 7.7 Model Name, Version and Identifier . . . . . . . 7-12 CHAPTER 8 THE OTHER GEMPACK PROGRAMS 8.1 Information from Equations Files . . . . . . . . . 8-1 8.1.1 Map of an Equations File Produced via SUMEQ . . 8-2 8.1.2 Homogeneity Simulations using SUMEQ . . . . . . 8-4 8.2 Looking at or Comparing Data on Header Array Files 8-5 8.2.1 SUMHAR . . . . . . . . . . . . . . . . . . . . . 8-5 8.2.2 SEEHAR . . . . . . . . . . . . . . . . . . . . . 8-5 8.2.3 CMPHAR . . . . . . . . . . . . . . . . . . . . . 8-6 8.3 Processing and Reporting Simulation Results using SLTOHT . . . . . . . . . . . . . . . . . . . . . . 8-8 8.4 Transferring Models Between Machines . . . . . . 8-16 8.4.1 Transferring the Whole Model . . . . . . . . . 8-17 8.4.2 Transferring Johansen Simulation Capability . 8-18 8.4.3 Handling Large Data Files . . . . . . . . . . 8-18 8.5 Submatrix Data and Set-up Files . . . . . . . . 8-19 8.6 Comparing Results from Different Machines . . . 8-20 CHAPTER 9 A GUIDE TO THE REST OF THE DOCUMENTATION 9.1 Other Relevant Publications . . . . . . . . . . . 9-1 APPENDIX A APPENDIX A - GEMPACK COMMAND FILES FOR SIMULATIONS A.1 Command Files for GEMSIM and TABLO-generated Programs . . . . . . . . . . . . . . . . . . . . . A-1 A.2 Command Files for Running SAGEM . . . . . . . . A-13 APPENDIX B MODELS USUALLY SUPPLIED WITH GEMPACK APPENDIX C SYNTAX OF GEMPACK TEXT DATA FILES C.1 The "How Much Data" Information . . . . . . . . . C-1 C.1.1 Comments . . . . . . . . . . . . . . . . . . . . C-3 C.1.2 Array Sizes . . . . . . . . . . . . . . . . . . C-4 C.2 Actual Data Values of the Array . . . . . . . . . C-4 C.2.1 Differences Between Row Order and Spreadsheet Style Data . . . . . . . . . . . . . . . . . . . C-7 C.2.2 Element Name/Number Labels . . . . . . . . . . . C-7 C.3 Converting Release 4.2.02 Files for Use with Release 5 or Later . . . . . . . . . . . . . . . . C-8 APPENDIX D CHOOSING THE CLOSURE AND SETS OF VARIABLES INTERACTIVELY D.1 Specifying the Closure Interactively . . . . . . . D-1 D.1.1 Starting the Specification . . . . . . . . . . . D-2 D.1.2 Modification or Use of the Exogenous/Endogenous Split . . . . . . . . . . . . . . . . . . . . . D-4 D.2 Choosing Other Sets of Variables Interactively . . D-8 D.2.1 Specifying Components of One Variable . . . . . D-9 D.2.2 The Lists Option - Choosing a Set Actively . . . D-9 D.2.3 The Some Option - Responding to Prompts . . . D-12 APPENDIX E SUGGESTIONS FOR HANDS-ON COMPUTING E.1 Examples using the Stylized Johansen Model SJ . . E-1 E.2 Miniature ORANI Model Examples . . . . . . . . . . E-6 E.3 Other Models Supplied . . . . . . . . . . . . . . E-8 E.4 Working with TABLO Input Files . . . . . . . . . . E-8 E.5 Using TABLO-generated Programs . . . . . . . . . E-10 E.5.1 Stylized Johansen Simulations via TABLO-generated programs . . . . . . . . . . . E-10 E.5.2 Miniature ORANI Model Simulations via TABLO-generated program . . . . . . . . . . . E-13 APPENDIX F DIFFERENCES BETWEEN RELEASES 5.0 AND 4.2.02 OF GEMPACK APPENDIX G FORTRAN COMPILERS FOR USE WITH GEMPACK ON PCS G.1 Compilers on 80386/80486 Machines . . . . . . . . G-1 G.1.1 Hardware Requirements on 80386/80486 Machines . G-2 G.2 Compilers on Macintosh Computers . . . . . . . . . G-3 REFERENCES INDEX CHAPTER 1 INTRODUCTION This document is an introduction to the current version (Release 5.1, April 1994) of GEMPACK. GEMPACK (General Equilibrium Modelling PACKage) is a suite of general-purpose economic modelling software especially suitable for general and partial equilibrium models. It can handle a wide range of economic behaviour and also contains powerful capabilities for solving intertemporal models. GEMPACK provides software for calculating accurate solutions of an economic model, starting from an algebraic representation of the equations of the model. These equations can be written as levels equations, linearized equations or a mixture of these two. The software is user-friendly, provides a range of utility programs for handling the economic data base and the results of simulations, and is fully documented from a user's point of view. GEMPACK provides o a simple language in which to describe and document the equations of your economic model; o a preprocessor (the program TABLO) to convert the equations of your model to a form ready for running simulations with the model; o options for varying the choice of exogenous and endogenous variables and the variables shocked; o utility programs to assist in managing the data base on which the model is based. The data can be inspected, modified, converted to spreadsheets or moved to different machines (including those with different operating systems). GEMPACK runs on a wide variety of computers* including _________________ * In this document, when we say "different machines" or "differ from machine to machine", we really mean different operating systems (such as those found on a DOS IBM compatible and a Macintosh). GEMPACK programs run essentially unchanged on these different machines. However the commands to start them running usually differ between machines. INTRODUCTION Page 1-2 o 80386/80486 microcomputers running DOS, Windows or OS/2, o Macintosh computers, o Unix machines, o DEC VAX and Alpha machines running VMS, and o other mainframe, mini and microcomputers with an ANSI standard Fortran 77 compiler. This document is a "how to run it" introduction to GEMPACK. Chapter 2 tells you how to carry out simulations with models, while chapter 3 tells you how to build or modify models. Chapter 4 gives more information about the programs used to carry out simulations, namely GEMSIM and the programs written by TABLO. Chapter 5 describes common features of the different GEMPACK programs. Chapter 6 documents the different ways sets of variables can be chosen (such as the set of variables to shock or to print). Chapter 7 gives more information about simulations (especially Johansen simulations) while chapter 8 is a guide to the utility programs, that is those not directly involved with simulations or building models. Chapter 9 is a guide to the rest of the GEMPACK documentation. If you have access to a computer with GEMPACK, this document supplemented by a small amount of machine- and site-specific information should enable you to carry out most routine modelling tasks with GEMPACK. For the machine-specific documentation, refer to chapter 9 to identify the document for the machine you are working on. If you are working on a multi-user machine, you may also need site-specific information from your GEMPACK Manager. 1.1 The Programs The programs included in the current Release of GEMPACK are as follows. (1) For implementing models and carrying out simulations: TABLO for processing the description of your model GEMSIM for carrying out simulations with your model GEMPIE for printing simulation results SAGEM for carrying out Johansen simulations MODHAR for building or modifying data files (2) Utility programs: SUMEQ for information about the numerical equations SUMHAR,SEEHAR,CMPHAR for data management SLTOHT for post-solution processing of simulation results (3) Software for transferring models between different machines (that is, different operating systems): MKHAR, RWHAR, MKEQ, RWEQ, SPJNTX, RWSL, CMPSOL, COMPEQ INTRODUCTION Page 1-3 The Programs (4) Software for use with very large models requiring more than one TABLO Input file or needing to be split into submodels (perhaps because of memory limitations). [Only Johansen simulations can be carried out in such cases.] ASSEQ, AMST, SEESMD, SEEST, SUMSMD GEMPACK is suitable for models varying in size from a few equations to several thousand (or more). In particular, it contains facilities for handling very large models (such as the ORANI model of Australia which has over a million equations). The software consists of about 20 main programs (as listed above) and several hundred subroutines. 1.2 Different Versions of GEMPACK GEMPACK is sent to users either as source code or as executable images. An introduction to the different versions is given below. For more information, contact us at the Impact Project (see section 1.6 below). 1.2.1 Source-code Versions Prior to Release 5.1, all recent versions of GEMPACK were source-code versions. With these versions, a suitable Fortran compiler is required. The size of models that can be handled is limited only by the amount of memory on the computer on which the software is installed. The source code of the full GEMPACK occupies about 5 megabytes of disk space, and several extra megabytes of disk space are required to produce executable images of the programs and to build and/or modify models. Source-code versions are currently available for 80386/80486 PCs running DOS (or Windows or OS/2), Macintosh PCs, VMS (VAX and DEC Alpha) and Unix machines. Other machines may be added in the future. 1.2.2 Executable Image Version This is a version of GEMPACK available for 80386/80486 PCs running DOS (or Windows or OS/2). It consists of executable images of the most commonly-used GEMPACK programs. No Fortran compiler is required in this case. Models are limited in size by the configuration of the programs as sent. The standard Executable Image Version runs on a machine with 8 megabytes of memory. It can handle moderately large models, including all those in section 1.3 below. Because no source code is sent with this version, the programs cannot be reconfigured to handle larger models. Modellers with this version of GEMPACK can carry out the full range of modelling tasks, including building and solving new models, and modifying existing ones. The only restriction is on the size of the models that can be handled. INTRODUCTION Page 1-4 Executable Image Version The standard Executable Image Version runs on 80386/80486 PCs with at least 8 megabytes of memory, a numeric coprocessor and a hard disk. This version occupies about 12 megabytes of disk space, and several extra megabytes of disk space are required to build and/or modify models. An executable image version of GEMPACK could be made available for Macintosh PCs, or for 80386/80486 PCs with more memory (say 16Mb), if there is sufficient demand. 1.2.3 Demonstration Version The Demonstration Version is very similar to the Executable Image Version of GEMPACK except that it is restricted to small models. It is intended for essentially free distribution so potential users can assess the capabililties of GEMPACK. We also expect it will be useful in teaching situations. Modellers with this version of GEMPACK can carry out the full range of modelling tasks, including building and solving new models, and modifying existing ones. The only restriction is on the size of the models that can be handled. This version can handle all the models in section 1.3 below except for ORANI-F, TRADMOD and the 5x6 and 10x7 versions of GTAP. The Demonstration Version runs on DOS 80386/80486 PCs with at least 4 megabytes of memory, a numeric coprocessor and a hard disk. This version occupies about 7 megabytes of disk space, and several extra megabytes of disk space are required to build and/or modify models. Copies of this version can be obtained by sending 20 Australian dollars to the GEMPACK Manager at the address shown in section 1.6 below. (If sending from overseas, this must be in the form of a bank draft in Australian dollars which is payable on an Australian bank. You can obtain such a draft from your local bank.) 1.3 Models Supplied with GEMPACK Usually at least the following models are supplied with GEMPACK. Stylized Johansen, a small example general equilibrium model designed as an introduction to the issues involved in building and solving such models (see Chapter 3 of Dixon et al (1992)), Miniature ORANI, a pedagogical model designed to introduce some of the essential ideas behind the ORANI model of the Australian economy (see sections 3-9 of Dixon et al (1982)), TRADMOD, a flexible multi-country trade model documented in Hertel et al (1992), ORANI-F, the forecasting version of the ORANI model of the Australian economy, as documented in Horridge et al (1993), GTAP, the Global Trade Analysis Project's model for analysing INTRODUCTION Page 1-5 Models Supplied with GEMPACK trade issues, as documented in Hertel and Tsigas (1993), DMR, the well-known Dervis, De Melo, Robinson model of Korea, as documented in Chapter 4 of Dixon et al (1992), and three intertemporal models TREES, a stylized model of forestry designed to show how intertemporal models are implemented within GEMPACK, described in Codsi et al (1992), CRTS, a single sector investment model, described in Wilcoxen (1989) or Exercises 5.1-5.4 of Chapter 5 of Dixon et al (1992), and 5SECT, a 5 sector investment model designed as an introduction to the issues involved in building and solving intertemporal models, also described in Wilcoxen (1989) or Part C of Problem Set 5 of Dixon et al (1992). More details about these models (including the related files usually sent with GEMPACK) are given in Appendix B. GEMPACK software makes it easy to transfer models between different computers (including different operating systems), as described in section 8.4 below, so you can easily exchange models with other modellers using GEMPACK. 1.4 Documentation of GEMPACK GEMPACK is fully documented for users. The rest of the GEMPACK documents are described in chapter 9. You should be familiar with this document GPD-1*, especially chapters 2-6, before reading the other documents. ____________ * References to GEMPACK documents identify the document by GEMPACK Document (GPD) number, rather than by author or date. References are always to the version of the document which is current at the date of issue of the cross-referencing document. The GEMPACK documents referenced are listed in a separate section at the end of the References section of this document. Comments from readers on this or any of the GEMPACK documents, either pointing out errors, inaccuracies, omissions or obscurities, or making other suggestions for improvements, will be welcomed. Please address such comments to one of the authors at the Impact Project. The numbering of GEMPACK Documents has been re-started with Release 5 of GEMPACK, when the abbreviation "GPD" was first used. Previous editions of these documents did not have the same numbers as the current editions. Pre-Release-5 documents are numbered "GED-xx". INTRODUCTION Page 1-6 A Guide to This Document 1.5 A Guide to This Document We provide two alternative guides. Readers new to GEMPACK should read the one in section 1.5.1 while readers familiar with an earlier version of GEMPACK should read the one in section 1.5.2. This document contains an index which should make it easier for you to find the information you may need at different times in the future. 1.5.1 For New GEMPACK Users Chapter 2 tells you how to carry out simulations with existing models. We suggest that you read this in detail and (provided you have access to a machine with GEMPACK) carry out the simulations described there for yourself. When you are ready to build your own model (or modify someone else's), or if you just want to understand how a model is implemented in GEMPACK, you should read chapter 3. Perhaps read it quickly the first time and then go back for a more detailed study. Chapter 4 gives more information about carrying out simulations. When you want to know more about running the GEMPACK programs, read chapter 5. These give detailed suggestions for more efficient use of the programs whether you are running them interactively or in batch mode. Chapter 6 tells you about various ways of specifying closures (exogenous/endogenous splits) of models, and of choosing sets of variables (such as the set of variables to shock or the set to print out results for). Read the relevant parts of this when you are ready to carry out simulations with your own model, or to change the closure and/or shocks for an existing model. Read chapter 7 when you want to find out more about carrying out Johansen simulations. This tells you how to use the software to obtain several different (approximate) solutions very quickly, which is the great advantage of Johansen simulations. Chapter 8 documents the utility programs, including the program SLTOHT which may be helpful in preparing reports based on your simulations. Read the relevant parts of this chapter when you need to find out more detailed information about a model (perhaps to understand your simulation results in more detail) or when you want to transfer your model to a different machine. Chapter 9 is a guide to the rest of the GEMPACK documentation. Appendix E contains suggestions for hands-on computing you might like to try to familiarise yourself with the different GEMPACK programs and the tasks they can help you with. INTRODUCTION Page 1-7 Changes From Earlier Versions of GEMPACK 1.5.2 Changes From Earlier Versions of GEMPACK This is addressed to readers who have used an earlier version of GEMPACK, especially to those familiar with Release 5.0 of GEMPACK. (If you are new to GEMPACK you can skip the rest of this section.) If you are familiar with Release 4.2.02 of GEMPACK but not Release 5.0, you may like to read Appendix F (which describes how Release 5.0 differs from Release 4.2.02) before reading the rest of this section. The main new feature in Release 5.1 is a program GEMSIM (which is an abbreviation for General Equilibrium Model SIMulator). This is a general-purpose program which can be used to carry out multi-step simulations with any model implemented via GEMPACK. It is an alternative to the model-specific TABLO-generated program for your model. Indeed, the availability of GEMSIM is the main reason for this new Release. The other new features are described below. First we say a little more about GEMSIM. GEMSIM The Code stage of TABLO now has an option which, instead of writing a Fortran program (the TABLO-generated program), produces output for GEMSIM. This output is rather like the Auxiliary Statement and Table files associated with a TABLO-generated program. If you select this option, you have no Fortran program to compile and link. You run GEMSIM (rather than the TABLO-generated program) to carry out simulations with the model. GEMSIM looks and runs like the TABLO-generated program for a model. The difference is that it is suitable for all models. A glance at Figure 2.1 in chapter 2 will make this clear. See also Steps 1-3 in section 2.2 for hands-on experience with GEMSIM. For small and medium-sized models, GEMSIM runs quite quickly. However, for large models, it will probably run considerably more slowly than the TABLO-generated program for the model and you should still take the TABLO-generated program route (rather than the GEMSIM route) for such models. One important use we see for GEMSIM is in conjunction with teaching about GE modelling (or about GEMPACK). Using executable images of TABLO, GEMSIM, SAGEM, GEMPIE and a couple of utility programs (notably SEEHAR and SLTOHT), it is possible to do serious modelling (including building new models and modifying existing ones) without needing a Fortran compiler. (When a new model is built, or an existing one modified, you can run GEMSIM to carry out simulations - you don't need to compile and link the TABLO-generated program.) This has made it possible for us to prepare and distribute the Demonstration and Executable Image Versions of GEMPACK (see section 1.2 above). INTRODUCTION Page 1-8 Changes From Earlier Versions of GEMPACK Other New Features (1) It is now possible to use set and/or element names to specify components of a variable when choosing the closure or other sets of variables. For example, you can now use exogenous xFACIN("labor",SECT) ; shock p_XF("labor") = 10 ; as alternatives to exogenous xFACIN 1 3 ; shock p_XF 1 = 10 ; (2) When GEMPACK programs (namely GEMSIM, TABLO-generated programs, SEEHAR, SLTOHT) write row-order or column-order, real or integer arrays to text files, they now include element name or number labelling which makes it clear where each number is placed in the array. (3) Related to (2) above, it is now possible to include comments (beginning with a single exclamation mark '!', as elsewhere in GEMPACK) in the actual data part of text data files (for example, those read by TABLO-generated programs, GEMSIM or MODHAR); see Appendix C for details. (4) TABLO-generated programs (and GEMSIM) have several new options, as described in chapter 5 of GPD-2. The main one is the option NSE which can enable you to carry out simulations in which a large number of variables are shocked using considerably less computer resources (notably memory); see section 5.6.1 of GPD-2 for more details. (5) If you tell a TABLO-generated program (or GEMSIM) not to carry out some actions it is capable of (for example, not to do any writes), the program may omit some of the READs and FORMULAs in the TABLO Input file, which may make it run more quickly. The program now only does those reads and formulas needed for calculating the values of all coefficients required to carry out the actions requested. (See section 5.6 of GPD-2 for more information.) (6) There is a new form of syntax IF( , ) available in TABLO Input files for conditional expressions. For example, FORMULA (all,i,COM) A(i) = B(i) + IF( C(i) >= 0, D(i) ) ; sets A(i) = B(i) + D(i) if C(i) is positive or zero, or A(i) = B(i) if C(i) < 0. See section 4.4.6 of GPD-2 for details. INTRODUCTION Page 1-9 Changes From Earlier Versions of GEMPACK (7) Brackets [] and {} can now be used with SUM, IF and functions. (Previously round brackets () were required.) (8) It is now possible to refer to subsets of the sets over which coefficients are defined in READ, WRITE, DISPLAY and FORMULA(INITIAL) statements. For example, if coefficient A is defined by COEFFICIENT (all,c,COM) A(c) ; and MARGCOM has been defined as a SUBSET of COM, the statements READ (all,c,MARGCOM) A(c) ; WRITE (all,c,MARGCOM) A(c) ; DISPLAY (all,c,MARGCOM) A(c) ; FORMULA (INITIAL) (all,c,MARGCOM) A(c) = ... ; are now allowed. (Previously they would have caused semantic errors.) See sections 4.7.2 and 4.7.3 of GPD-2 for details. (9) The character '@' is now allowed in names (for example, of SETs, COEFFICIENTs) in TABLO Input files. For example, the statement COEFFICIENT (all,c,COM) D2FAC_F@I ; is now allowed. (See section 4.2.1 of GPD-2.) (10) It is now possible to run a TABLO-generated program (or GEMSIM) just to save an Environment file. To do this, use a Command file containing statements simulation = no ; use equations file ... ; save environment file ... ; plus statements specifying the exogenous and endogenous variables. (You must already have saved an Equations and a Base Coefficient Values file before doing this.) See section 2.7.2 below for an example. (11) If you have a file containing possible shocks for all components of a variable, and only want to shock some components, you can tell GEMSIM or the TABLO-generated program to select the relevant values from the file using a statement of the form shock v1 = select from file ; See section 6.3.1 for more details. (12) If you are printing a single solution (perhaps the solution of a multi-step simulation), GEMPIE now, by default, prints the results for several components of a variable across the page (up to 5 or 6 values per line), rather than in a single column as before. See Table 2.2.4 below for an example. Option "SNA" (see section 7.6.2 below) outputs the solution in a single column, as before. INTRODUCTION Page 1-10 Changes From Earlier Versions of GEMPACK (13) Our introduction to building models (see chapter 3) now integrates the alternatives of using linearized equations, levels equations or a mixture of these. As a result, document GPD-4, Implementing Levels Models Directly Using GEMPACK (First edition, April 1993) is now superseded; its contents are included in the current versions of GPD-1 and GPD-2. In chapter 3 we introduce three different versions of Stylized Johansen, namely mixed, linearized and levels TABLO Input files. We begin with the mixed one because we believe it is the easiest for inexperienced modellers to understand. (14) The increased use of levels and mixed levels/linear TABLO Input files has made the distinction between coefficients which are parameters and those which are not more important. See section 4.11 of GPD-2 for a little more about this. In this connection, we have tightened up the use of integer coefficients in TABLO Input files. For example, integer coefficients are now, by default, parameters, and integer coefficients occurring in equations must be parameters. Non-parameter integer coefficients are still allowed; however, any existing TABLO Input files with non-parameter integer coefficients may need slight changes. See section 4.4.10 of GPD-2 for more information about integer coefficients. The new statement "EQUATION(NONE);" can be used at the start of TABLO Input files which only do data manipulation (formally, contain no equations); it simplifies TABLO's treatment of such files. See sections 3.9.1 and 4.12 of GPD-2 for details. (15) We have gained some insights into convergence problems experienced with some simulations. In particular, we know why Gragg or the midpoint method are unsuitable in some cases (see section 5.2.7 of GPD-2), and we have clear evidence that the linearization used can affect the numerical properties and convergence of multi-step calculations (see section 5.2.8 of GPD-2). (16) We have implemented further refinements to the symbolic processing that takes place during condensation. You will no longer see, for example, several consecutive minus signs when TABLO reports new coefficients and formulas introduced there. Handling of conditional sums and expressions has been improved by implementing rules such as IF( , exp1) * exp2 = IF( , exp1*exp2 ) and SUM(i,S: , exp1) = IF( , SUM(i,S,exp1) ) if does not depend on the index i The use of such rules can reduce the running time of models with large numbers of conditions in their algebraic form. (For example, the CPU time for the formulas, equations, backsolves and updates for a recent and complex version of the MONASH model of the Australian economy was reduced by INTRODUCTION Page 1-11 Changes From Earlier Versions of GEMPACK about 70% after we implemented these sorts of rules.) (17) Apart from TABLO, the only programs that are changed from Release 5.0 are GEMPIE, SAGEM, SEEHAR, SLTOHT and the utility programs CMPSOL and RWSL. (18) Appendix E contains suggestions for hands-on computing you might like to try to familiarise yourself with GEMSIM and the new versions of the different GEMPACK programs and the tasks they can help you with. 1.6 Contacting the Impact Project For more information about GEMPACK, contact The GEMPACK Manager Impact Project 11th Floor, Menzies Building Monash University Wellington Rd Clayton, Vic 3168 Australia email: impact@vaxc.monash.edu.au telephone: (03)-905-5112 or +61-3-905-5112 from overseas The GEMPACK developers can be contacted as above. 1.7 Acknowledgements This document has benefited from our reading of Wayne Calder's "Hitchhiker's Guide to GEMPACK" (Calder 1992), which is an introduction to Release 4.2.02 of GEMPACK; we are grateful to Wayne for making a preliminary copy available to us while we were preparing the first edition of this document. We are also grateful to Paul Gallagher and Colin Thompson for assistance with, and feedback about, this document. We are grateful to those who beta tested Release 5.0 and/or Release 5.1, including Karen Chyc, Mark Gehlhar, Kevin Hanslow, Tom Hertel, Kent Lanclos, Derek Quirke, John Small, Marinos Tsigas, Peter Wilcoxen and our colleagues at Monash University. We are grateful to Peter Wilcoxen for suggesting the use of Command files (see, for example, section 2.3.1 and Appendix A) and for providing us with a prototype implementation. CHAPTER 2 HOW TO CARRY OUT SIMULATIONS WITH MODELS Implementation A model is implemented in GEMPACK when o the equations describing its economic behaviour are written down in an algebraic form, following a syntax described later in this document, and o data describing one solution of the model are assembled, to be used as a starting point for simulations. In the early versions of GEMPACK, the equations had to be written down in a linearized form, usually expressed in terms of percentage changes in the variables. Now you can choose to base your implementation on the original (usually nonlinear) equations or on a linearized representation of these. In either case you need to write them down in a text file which we call a TABLO Input file (since TABLO is the name of the GEMPACK program which processes this information). The procedure for implementing models is described in detail in chapter 3. Simulation Once a model is implemented, it can be used to carry out simulations. Many simulations are the answer to "What if" questions such as "If the government were to increase tariffs by 10 percent, how much different would the economy be in 5 years time from what it would otherwise have been?". From the original solution supplied as the starting point, a simulation calculates a new solution to the equations of the model. Within GEMPACK, the results of a simulation are usually reported as percentage changes from the original solution. Solving models within GEMPACK is always done in the context of a simulation. You specify the values of certain of the variables (the exogenous ones) and the software calculates the values of the remaining variables (the endogenous ones). The new values of the exogenous variables are usually given by specifying the percentage changes (increases or decreases) from their values in the original solution given as part of the implementation. HOW TO CARRY OUT SIMULATIONS WITH MODELS Page 2-2 Levels and Percentage-Change Variables When the model is implemented, the equations may be linearized (that is, differentiated). The variables in these linearized equations are usually interpreted as percentage changes in the original variables. The original variables (prices, quantities etc) are referred to as the levels variables and the (usually nonlinear) equations relating these levels variables are called the levels equations. [ For example, the levels equation D = PQ relates the dollar value D of a commodity to its price P ($ per tonne) and its quantity Q (tonnes). The linearized version of this is p_D = p_P + p_Q (as explained later in chapter 3 below) which says that, to first order, the percentage change p_D in the dollar value is equal to the sum of the percentage changes p_P in the price and p_Q in the quantity. ] The data for a model often consists of input-output data (giving dollar values) and parameters (including elasticities). The data given is usually sufficient to read off an initial solution to the levels equations. (Usually all basic prices are taken as 1 in the initial solution.) Details about linearizing the equations, the syntax of the TABLO Input file and the preparation of data files are given in chapter 3. Here we show you how to carry out simulations with an existing model (that is, one built by someone else). In this discussion, we use as an example the Stylized Johansen model described in Chapter 3 of Dixon et al (1992), hereafter referred to as DPPW. This is chosen because it is a simple, well-documented and well-known model. Once you know how to carry out simulations with it in GEMPACK, you will find it easy to carry out simulations with other, more complicated models (including ones you build yourself). HOW TO CARRY OUT SIMULATIONS WITH MODELS Page 2-3 The Steps in Carrying Out a Simulation 2.1 The Steps in Carrying Out a Simulation After the TABLO Input file for a model has been written, there are 3 steps on the computer to carry out a first simulation with the model. These steps are illustrated in Figure 2.1. Step 1. Computer Implementation of the Model Process the TABLO Input file for the model by running the GEMPACK program TABLO. At the Code stage, select the option PGS which asks TABLO to produce so-called GEMSIM Auxiliary files for the GEMPACK program GEMSIM (see Step 2). These files capture the theory of the model, as written in the TABLO Input file. Step 2. Simulation Run the GEMPACK program GEMSIM* and tell it to use the GEMSIM Auxiliary files produced in Step 1. Specify which base data are to be read and describe the closure (that is, the exogenous and endogenous variables) and the shocks. GEMSIM then computes the solution to your simulation and writes the results to a so-called Solution file. Step 3. Printing the Results of the Simulation Run the GEMPACK program GEMPIE to convert the solution produced in Step 2 to a so-called GEMPIE Print file. This is a text file which can be printed (or edited). Other Simulations Once you have carried out one simulation with a model, you will probably want to carry out others, for example, to change the closure and/or shocks, or even to run from different base data. In such cases, you do not have to repeat Step 1. All you have to do is carry out Steps 2 and 3. (Of course Step 1 must be repeated if you change the TABLO Input file for the model in any way.) _________________ * GEMSIM is an abbreviation for General Equilibrium Model SIMulator. HOW TO CARRY OUT SIMULATIONS WITH MODELS Page 2-4 The Steps in Carrying Out a Simulation Figure 2.1 goes on this page HOW TO CARRY OUT SIMULATIONS WITH MODELS Page 2-5 The Steps in Carrying Out a Simulation Files involved For many models there are just two starting files. On most machines* these might be called MODEL.TAB The TABLO Input file for the model MODEL.DAT The data file containing the original solution Step 1. Program: TABLO Input: the TABLO Input file MODEL.TAB Output: the GEMSIM Auxiliary files for the model, say MODEL.GSS and MODEL.GST Step 2. Program: GEMSIM Input: the GEMSIM Auxiliary files MODEL.GSS and MODEL.GST from Step 1, and the data file MODEL.DAT Outputs: Solution file, say SIM1.SL4 Updated (i.e., post-simulation) data, say MODEL.UPD When running the program GEMSIM you give information to describe the closure and shocks. (Some of the shocks may be read from files.) The main output is the Solution file, say SIM1.SL4 (for simulation number 1). (There will usually be other outputs including updated data file(s) showing post-simulation values.) Step 3. Program: GEMPIE Input: the Solution file SIM1.SL4 from Step 2 Output: the GEMPIE Print file, say SIM1.PI5 _________________ * Actual file names can vary from machine to machine. HOW TO CARRY OUT SIMULATIONS WITH MODELS Page 2-6 An Example Simulation with Stylized Johansen 2.2 An Example Simulation with Stylized Johansen 2.2.1 Introduction to the Stylized Johansen Model The model is a self-contained model of a single country. The model recognises 2 sectors "s1" and "s2" each producing a single commodity, one household sector and 2 primary factors (labor and capital). The initial input-output data base is as shown below in Table 2.2.1a, which is the same as Table E3.3.1 in DPPW (i.e. Dixon et al (1992)). For example, households consume 4 (million) dollars' worth of commodity 2 and industry 2 uses 3 (million) dollars' worth of labor. The amounts in the last row and column are totals. Industry Households Total Sales 1 2 Commodity 1 4 2 2 8 Sectors Commodity 2 2 6 4 12 Labor 3 1 3 4 Factors Capital 4 1 1 2 Total Production 8 12 6 Table 2.2.1a: Input-output Data Base for Stylized Johansen In the GEMPACK implementation, the levels variables are as follows. GEMPACK variable Meaning DPPW Notation* Y Value of household income Y PC(i) Price of commodity i P:i (i=1,2) PF(f) Price of factor f P:f (f=3,4) XCOM(i) Supply of commodity i X:i (i=1,2) XFAC(f) Supply of factor f X:f (f=3,4) XH(i) Household use of commodity i X:i0 (i=1,2) XC(i,j) Intermediate input of X:ij (i,j=1,2) commodity i to industry j XF(f,j) Input of factor f to industry j X:fj (f=3,4;j=1,2) DVCOMIN(i,j) Dollar value of inputs of (none) commodity i to industry j DVFACIN(f,j) Dollar value of usage of (none) factor f to industry j DVHOUS(i) Dollar value of household (none) use of commodity i Table 2.2.1b: Levels Variables of Stylized Johansen _________________ * In this column, a colon ':' indicates a subscript in DPPW, so that, for example, p:i means p with a subscript i. "(none)" means that this variable has no explicit counterpart in DPPW. HOW TO CARRY OUT SIMULATIONS WITH MODELS Page 2-7 Introduction to the Stylized Johansen Model Note that most of the variables have one or more arguments (indicating associated sectors and/or factors). We refer to such variables as vector variables and to the others ('Y' is the only one here) as scalar or macro variables. GEMPACK assumes that all variables are vector variables, and treats the scalars as vectors of length 1. For example, PC(i) is regarded as a vector variable with 2 components, one for each sector, namely PC("s1") and PC("s2"), XF(f,j) is regarded as a vector variable with the following 4 components: component 1 XF("labor","s1") : input of labor (factor 1) to sector 1 component 2 XF("capital","s1") : input of capital (factor 2) to sector 1 component 3 XF("labor","s2") : input of labor (factor 1) to sector 2 component 4 XF("capital","s2") : input of capital (factor 2) to sector 2 Corresponding to each of these levels variables, there is an associated percentage change variable. TABLO adds the prefix "p_" to the name of the levels variable to indicate a percentage change. For example, p_XF is the percentage change in the levels variable XF. In DPPW, lower case letters are used to denote percentage-change variables. More details about the model are given in chapter 3. The full TABLO Input file can be found in section 3.3.2. Full details about the model can be found in Chapter 3 of DPPW. The Simulation As an example of a simulation on the Stylized Johansen model, we will choose a closure with supplies of the two factors, labor and capital, as exogenous variables. This means we will specify the percentage changes in the variable XFAC, namely p_XFAC, and solve the model to find the percentage changes in all the other variables. For this simulation, we increase the supply of labor by 10 per cent and hold the supply of capital fixed. The starting points for any simulation with the Stylized Johansen model are the TABLO Input file (called SJ.TAB on most machines) and the data file (called SJ.DAT on most machines). If you have access to a machine with GEMPACK installed, we suggest you actually carry out the steps as described below.** Note that, when we refer to file names below, we are giving typical file names (such as on a DOS machine, for example). As indicated earlier, file names can vary from machine to machine. _________________ ** We suggest that you first copy the files SJ.TAB and SJ.DAT from the examples subdirectory in which they were supplied into another subdirectory and then work in this latter subdirectory to avoid cluttering the examples subdirectory. HOW TO CARRY OUT SIMULATIONS WITH MODELS Page 2-8 Step 1 - Run TABLO 2.2.2 Step 1 - Run TABLO The command to run a program varies from machine to machine. On many machines, just type tablo to run it. (If this does not work on your machine, consult your machine-specific documentation.) Then give the following responses. (The first and third are carriage returns. After each response, we have given a comment, which starts with an exclamation mark '!'; when running the program, you should not type in the exclamation mark or the following comment.) The user input for running TABLO is illustrated in Figure 2.2.2. User Input to TABLO ____________________________________________________________________ ! Use the default options sj ! Name of the TABLO Input file ! Use the default Information file name ! (often called SJ.INF) (TABLO will take a minute or two to check that the formulas, equations and updates contain no errors. When finished a menu will appear asking what to do next.) a ! Begin automatic code generation (The code generation menu appears.) pgs ! Produce output for GEMSIM ! Use the other default code generation options sj ! Name of GEMSIM Auxiliary files to be output (TABLO will take a minute or two to write the output required by GEMSIM.) ____________________________________________________________________ End of User Input to TABLO When this is finished, you can check that the following new files have been created. The GEMSIM Auxiliary Statement and Table files (usually called SJ.GSS and SJ.GST respectively). The Information file (often called SJ.INF). This contains information about the run of TABLO. If the TABLO Input file contains errors, these will be clearly marked and explained in this Information file. You can examine the Information file. It should indicate that there were no syntax or semantic errors during the CHECK stage and, at the end of the CODE stage, tell you the names of the GEMSIM Auxiliary Statement and Table files. HOW TO CARRY OUT SIMULATIONS WITH MODELS Page 2-9 Step 1 - Run TABLO Figure 2.2.2 goes on this page HOW TO CARRY OUT SIMULATIONS WITH MODELS Page 2-10 Step 2 - Run GEMSIM 2.2.3 Step 2 - Run GEMSIM This is where the actual simulation is run. In the example simulation which we will carry out below, we choose the standard closure for Stylized Johansen (supplies of the 2 factors are exogenous and all other variables are endogenous), and we increase the supply of labor by 10 per cent and hold the supply of capital fixed. As usual, the exact command to start GEMSIM running varies from machine to machine. On most machines you can simply enter gemsim When GEMSIM prompts you, enter the 2 responses cmf sjlb.cmf (These responses are the same on all machines.) Then there will be a lot of screen output. First this does a 1-step Euler solution and updates the data. Then a 2-step solution and finally a 4-step one. Finally the extrapolated solution is calculated from these 3 solutions and the updated data based on this is calculated and written. This will take a minute or two. In the above run, GEMSIM takes all of its input from the GEMPACK Command file SJLB.CMF. This file, which is shown in full in Figure 2.3.1 below, contains statements telling GEMSIM all the necessary information for carrying out this simulation. For example, the statement solution file = sjlb ; (don't type this) in the Command file SJLB.CMF tells GEMSIM the name of the Solution file to create during the run you have just completed. (This Solution file contains the solution of the simulation.) We postpone a discussion of the other statements in the Command file SJLB.CMF until section 2.3.1 below. Figure 2.2.3 is a schematic description of the information required to specify a simulation. We discuss this in more detail in section 2.3 below. When GEMSIM is finished, you can check that the Solution file SJLB.SL4 has been created. This contains the numerical results of the simulation. (There are several other files created; we discuss them later in section 2.3 below.) HOW TO CARRY OUT SIMULATIONS WITH MODELS Page 2-11 Step 2 - Run GEMSIM Figure 2.2.3 goes on this page HOW TO CARRY OUT SIMULATIONS WITH MODELS Page 2-12 Step 3 - Run GEMPIE 2.2.4 Step 3 - Run GEMPIE The Solution file produced in Step 2 is a binary file which cannot be viewed or printed directly. To convert it to a form suitable for viewing on your terminal or printing, you need to run the program GEMPIE, which can usually be done by entering: gempie Enter the following responses when prompted by the program. (This user input is illustrated in Figure 2.2.4.) As before, don't type in the exclamation marks and parts of lines after them. (In particular, if a line below begins with an exclamation mark, it is just a comment, and does not need to be entered when you run the program.) User Input to GEMPIE ____________________________________________________________________ ! Use the default program options sjlb ! Name of Solution file (produced in Step 3) L ! Use the "Lists" option to choose ! which endogenous variables to print a p_y p_pc p_xh p_xf p_dvhous ! Choose all components of these f ! Finished giving list ! Accept default name (usually SJLB.PI5) ! for the Print file Test Results ! Page heading 4 ! Number of decimal places ____________________________________________________________________ End of User Input to GEMPIE Check that a GEMPIE Print file (usually called SJLB.PI5) has been created. To check your results, type this file (or print it). The end of this file is shown in Table 2.2.4 below. HOW TO CARRY OUT SIMULATIONS WITH MODELS Page 2-13 Step 3 - Run GEMPIE Figure 2.2.4 goes on this page HOW TO CARRY OUT SIMULATIONS WITH MODELS Page 2-14 Step 3 - Run GEMPIE PAGE 1 Test Results p_Y Total nominal household expenditure 5.8853 p_PC (SECT) Price of commodity i s1 s2 0.0000* -0.9486 p_XH (SECT) Household demand for commodity i s1 s2 5.8853 6.8993 p_XF (FAC,SECT) Factor inputs to industry j p_XF(-,s1) results where '-' is in set 'FAC'. labor capital 10.0000 0.0000 p_XF(-,s2) results where '-' is in set 'FAC'. labor capital 10.0000 0.0000 p_DVHOUS (SECT) Dollar value of household use of commodity i s1 s2 5.8853 5.8853 Table 2.2.4: End of GEMPIE Print File 2.2.5 Interpreting the Results The results in Table 2.2.4 above mean that, if the supply of labor is increased by 10 per cent and the supply of capital is held fixed, then, for example, (1) the dollar value of total nominal household expenditure will increase by 5.8853 per cent from its pre-simulation value (this is the simulation result for 'p_Y', the percentage change in the levels variable 'Y'), (2) households will consume 6.8993 per cent more of commodity 2 than they did previously (the 'p_XH' result for commodity 2), (3) the price of commodity 2 will fall by 0.9486 per cent (the 'p_PC' result for commodity 2), and (4) the dollar value of household consumption of commodity 2 will rise by 5.8853 per cent (the p_DVHOUS("s2") result). HOW TO CARRY OUT SIMULATIONS WITH MODELS Page 2-15 Interpreting the Results Recall that, within GEMPACK, all simulations are set up and solved as perturbations from an initial solution, and results are usually reported as changes or percentage changes from this original solution. In this case the original solution values are as shown in Table 2.2.1a above, which shows million dollar values of activity. Suitable levels values for quantities can be obtained by assuming that, initially, all prices are 1. (This just sets the units in which quantities are measured.) Then, for example, since households consume 4 million dollars' worth of commodity 2, this means that they consume 4 million units of that commodity. Hence the three simulation results mentioned above mean that, once labor is increased by 10 per cent and capital is held fixed, (1) total nominal household expenditure has increased to approximately 6.353 million dollars (5.8853 per cent more than the original value of 6 million dollars), (2) household consumption of commodity 2 has increased to 4.2760 million units (6.8993 per cent more than the original 4 million units), (3) the price of commodity 2 has fallen from one dollar per unit to approximately 99.051 cents per unit (a fall of 0.9486 per cent), and (4) the dollar value of household consumption of the commodity produced by sector "s2" has risen from 4 million dollars to approximately 4.2354 million dollars (an increase of 5.8853 per cent). Of course the updated values in (2), (3) and (4) above should be related since dollar value should equal price times quantity. Note that this is true since, from (2) and (3) above, the post-simulation price times the post-simulation quantity is 0.99051 x 4.2760 = 4.2354 which is indeed the post-simulation dollar value in (4). This confirms that the solution shown in the GEMPIE Print file satisfies the levels equation connecting price, quantity and dollar value of household consumption of this commodity. You might like to check some of the other levels equations in this way. You can see that, from the results of the simulation, it is easy to infer the new levels values of all quantities of interest in the model (prices, quantities and dollar values). Indeed, the updated data file SJLB.UPD produced at the end of Step 3 above will contain these new levels values for the quantities read in initially from the data base. HOW TO CARRY OUT SIMULATIONS WITH MODELS Page 2-16 Specifying a Simulation 2.3 Specifying a Simulation In order to specify the details for carrying out a simulation, you must o say which model to use, o say which base data to begin from (that is, the pre-simulation solution), o say which closure (that is, which endogenous and exogenous variables), and o say which variables to shock, and by how much, and o specify the names of the various output files. (All of this information is shown schematically in Figure 2.2.3 above.) We discuss the different ways for doing this in the case of the simulation carried out in section 2.2 above. There are several ways of running GEMSIM to achieve this; these are outlined in the sections below. In Step 2 in section 2.2.3 above, you ran GEMSIM by taking all of its input from the GEMPACK Command file SJLB.CMF. The instructions in this file must be prepared in advance, of course. As an alternative to preparing a GEMPACK Command file, GEMSIM can be run interactively; you respond to prompts from the program. We explore this way of running GEMSIM in section 2.3.2 below and introduce you to a variant of it in section 2.3.3. First we explain in section 2.3.1 the statements in the GEMPACK Command file SJLB.CMF. 2.3.1 Specifying a Simulation via a GEMPACK Command file In Step 2 in section 2.2.3 above, we took all the information required to specify the simulation from the GEMPACK Command file SJLB.CMF. The file SJLB.CMF is shown in full in Figure 2.3.1. In section 2.2.3 above, we pointed out the statement in SJLB.CMF which specifies the name of the Solution file to be produced. The remaining statements in SJLB.CMF are discussed briefly below. The statement auxiliary files = sj ; tells GEMSIM to use the Auxiliary files SJ.GSS and SJ.GST produced in Step 1. (This effectively tells which model to work with, since these files are just a processed version of the TABLO Input file SJ.TAB for the Stylized Johansen model.) HOW TO CARRY OUT SIMULATIONS WITH MODELS Page 2-17 Specifying a Simulation via a GEMPACK Command file ! ! The following GEMPACK Command file (usually called SJLB.CMF) ! carries out a multi-step simulation ! for the Stylized Johansen model. ! Auxiliary files for model auxiliary files = sj ; ! Data files file iodata = sj.dat ; updated file iodata = sjlb.upd ; ! Equations file information equation file = sj ; ! creates a new Equations file model = sj ; version = 1 ; identifier = Stylized Johansen. Standard data. ; ! Closure exogenous p_xfac ; rest endogenous ; save environment file sjxfac ; ! Solution method information method = euler ; steps = 1 2 4 ; ! Simulation part solution file = sjlb ; shock p_xfac("labor") = 10 ; verbal description = Stylized Johansen model. Standard data and closure. 10 per cent increase in amount of labor. (Capital remains unchanged.) 1,2,4-step solutions plus extrapolation. ; ! Options extrapolation accuracy file = yes ; ! End of Command file Figure 2.3.1: The GEMPACK Command File SJLB.CMF HOW TO CARRY OUT SIMULATIONS WITH MODELS Page 2-18 Specifying a Simulation via a GEMPACK Command file The statement file iodata = sj.dat ; tells GEMSIM to read base data from the file SJ.DAT (which contains the data in Table 2.2.1a above). The statements exogenous p_xfac ; rest endogenous ; tell GEMSIM the closure (that is, which variables to take as exogenous and which to take as endogenous), while the statement shock p_xfac("labor") = 10 ; tells GEMSIM to increase the supply of labor by 10 per cent. The statement solution file = sjlb ; tells GEMSIM the name of the Solution file to contain the solution of the simulation. (The suffix '.SL4' is added automatically by GEMSIM, so that the Solution file is called SJLB.SL4.) When GEMSIM carries out a simulation, as well as being able to report the changes in the endogenous variables, it produces an updated version of the original data file(s); the data in these represent post-simulation values (that is, the ones that would hold after the shocks have worked their way through the economy). For Stylized Johansen, this contains post-simulation dollar values of the entries in Table 2.2.1a above. The statement updated file iodata = sjlb.upd ; names the file to contain this updated data. (The name includes 'LB' to remind us that this data depends on the labor shock.) You are required to give a so-called verbal description of the simulation. This description, which can be several lines of text, goes on the Solution file and is transferred to the GEMPIE Print file when you run GEMPIE (as in Step 3 above). You can use this to remind you (and others) about salient features of the simulation. The statement verbal description = Stylized Johansen model. Standard data and closure. 10 per cent increase in amount of labor. (Capital remains unchanged.) 1,2,4-step solutions plus extrapolation. ; in SJLB.CMF give 4 lines of text for the verbal description in this case. (The ';' indicates the end of this description. Note that all statements in GEMPACK Command files must end with a semicolon ';'.) HOW TO CARRY OUT SIMULATIONS WITH MODELS Page 2-19 Specifying a Simulation via a GEMPACK Command file With GEMPACK, you can choose one of 4 related solution methods for each simulation. These are introduced in section 2.5 below. The statements method = euler ; steps = 1 2 4 ; in the Command file tell GEMSIM to use Euler's method based on 3 separate solutions using 1, 2 and 4 steps respectively. (See section 2.5 below for an explanation about step numbers.) The accuracy of the solution depends on the solution method and the numbers of steps. GEMSIM can be asked to provide information about the accuracy on a so-called Extrapolation Accuracy file. The statement extrapolation accuracy file = yes ; asks GEMSIM to produce such a file. The information on this file is described in section 2.5.3 below. (The name of this file is the same as that of the Solution file except that it has a different suffix, namely '.XAC', which makes the full name SJLB.XAC.) GEMSIM usually produces a so-called Equations file which contains the numerical linearized equations of the model. (This can be used as a starting point for other simulations in some cases.) The statements equations file = sj ; model = sj ; version = 1 ; identifier = Stylized Johansen. Standard data. ; specify the name of the Equations file SJ.EQ4 (the suffix .EQ4 is added automatically by GEMSIM - see section 2.8 below), the model name, the version number and a model identifier (which can be up to 60 characters long). The statement save environment file sjxfac ; tells GEMSIM to save a so-called Environment file which records the closure used. This file can be used again for other simulations with the same closure; this saves specifying the exogenous/endogenous split each time, which can be more efficient, especially with larger models. (The suffix '.EN4' is added automatically by GEMSIM, so that the Environment file is called SJXFAC.EN4.) As you can see, several new files should have been created when you carried out the simulation; their names are specified in the Command file. You might like to check that they were all created when you carried out Step 2 in section 2.2.3 above. Complete documentation of the statements that can be used in a GEMPACK Command file for running GEMSIM is given in section A.1 of Appendix A. HOW TO CARRY OUT SIMULATIONS WITH MODELS Page 2-20 Specifying a Simulation Interactively 2.3.2 Specifying a Simulation Interactively You can also specify a simulation by running GEMSIM interactively and responding to prompts. The same information as on Command files must be given. This time the order depends on the order of the prompts. To see how this works, start GEMSIM running, which you can do on most machines by entering gemsim Then give the responses indicated below. (These are the same on all machines.) As before, don't type in the exclamation marks and parts of lines after them. (In particular, if a line below begins with an exclamation mark, it is just a comment, and does not need to be entered when you run the program.) The different parts of the user input are illustrated in Figure 2.3.2. User Input to GEMSIM ____________________________________________________________________ ! take the default program options sj ! Name of GEMSIM Statement (also Table) file (first solution method information) e ! Euler's method e ! extrapolate 3 ! number of multi-step solutions on which to ! base the extrapolation 1 2 4 ! number of steps in each of these 3 solutions n ! don't use old Equations/BCV files sj ! Equations file name SJ ! model name 1 ! version number Stylized Johansen. Standard data. ! Model identifier sjlb ! Solution file name:LB since is shock to labor y ! also create Extrapolation Accuracy file (then data and other file information) sj.dat ! file containing data (input-output data) sjlb.upd ! name of updated data file (name reflects ! simulation done) ! default name for intermediate update files sjextra ! name of extra data file (Now the program calculates the formulas and the Equations file. Then it asks you to specify the closure. There are various ways of specifying this. We show one which may be new to users familiar with an earlier version of GEMPACK.) n ! start with all variables endogenous m ! Choose to modify the closure sx p_xfac ! set all components of variable p_XFAC exogenous save ! save this closure for later use sjxfac ! name of Environment file to be saved f ! Finish specifying the closure u ! use this closure n ! don't save any files HOW TO CARRY OUT SIMULATIONS WITH MODELS Page 2-21 Specifying a Simulation Interactively Figure 2.3.2 goes on this page HOW TO CARRY OUT SIMULATIONS WITH MODELS Page 2-22 Specifying a Simulation Interactively 0.1 ! value of Harwell parameter for the sparse ! matrix routine MA28 a ! all exogenous variables shocked n ! not all shocks 1 n ! not uniform shocks for p_XFAC t ! read xfac shocks from the terminal 10 0 ! the shocks (10 for labor, 0 for capital) a ! all endogenous cumulatively-retained Stylized Johansen model. ! Verbal description of the simulation Standard data and closure. 10 per cent increase in amount of labour. (Capital remains unchanged.) 1,2,4-step solutions plus extrapolation. **end (Then there is a lot of screen output, essentially the same as for the run of GEMSIM described in section 2.2.3 above. This will take a minute or two.) ____________________________________________________________________ End of User Input to GEMSIM When GEMSIM is finished, you can check that the files mentioned at the end of section 2.3.1 have been re-created. Notice that a considerable amount of input is required from the terminal when running GEMSIM interactively. In our experience, it is more efficient and reliable to prepare a GEMPACK Command file first. When you do so, this is a record of your instructions and it can be altered easily to carry out a slightly different simulation. 2.3.3 Specifying a Simulation via a Stored-input File As observed above, running GEMSIM interactively requires a large amount of terminal input. Once you have run GEMSIM a few times, you may be able to anticipate the order of the questions and so plan your responses in advance (though doubtless a certain amount of trial and error will be required to get them exactly right). You can then put all these responses onto a text file (using your favourite editor), thus creating what we call a Stored-input file (because it stores your inputs). The resulting Stored-input file can be used to run the program (as we describe below). For example, to reproduce the results from Step 2, you can use the Stored-input file SJLB.STI which should be in the EXAMPLES subdirectory of any machine on which GEMPACK is installed.* First start the program GEMSIM running, for example by typing gemsim (or otherwise, as as required on your system). When it starts running, notice the options available. Respond sti (in either upper or lower case) and then, when prompted by the HOW TO CARRY OUT SIMULATIONS WITH MODELS Page 2-23 Specifying a Simulation via a Stored-input File program, enter the name of your Stored-input file (for example, SJLB.STI). The program takes all the rest of its inputs from this file (but still sends all output to your terminal screen), and only transfers control back to you when the program has finished running. Notice that if you also want a LOG file of this run you could select log and then give the name of the LOG file you want (for example SJLB.LOG) when prompted before selecting the 'sti' option. (If you are taking inputs from a Stored-input file and also writing a LOG file, you can choose whether you want output to both the log file and the terminal (choose B) or to just the log file (choose L).) All GEMPACK programs offer the options 'sti' and 'log' and so can be run from Stored-input files and/or have their output sent to log files in this way. Of course, most operating systems provide other ways of taking inputs from a Stored-input file and/or writing a LOG file. (For example, under DOS or Unix, the input redirection command gemsim < sjlb.sti will run program GEMSIM taking input from SJLB.STI, while gemsim < sjlb.sti > sjlb.log will also send output to the log file SJLB.LOG. On VAX/VMS, VAX command (.COM) files offer these possibilities.) ________________________ * If not, you can create such a file by following the steps below. 1. Use your favourite text editor to open a new file SJLB.STI. (For example, if you are running DOS version 4 or later, the command "edit sjlb.sti" should be satisfactory.) 2. Type in the responses shown in section 2.3.2. The first four lines should be ! take the default program options sj ! Name of GEMSIM Statement (also Table) file e ! Euler's method e ! extrapolate (Here, as explained in detail in section 5.2 below, the part of each line beginning with the single '!' is treated as a comment. You can omit this part of the lines if you prefer.) 3. Continue until you have entered all the responses in section "User Input to GEMSIM" in section 2.3.2. Do not include the commentary there, such as the line "(first solution method information)", or the blank lines before and after such commentary. 4. Exit, saving the new file. This should create the desired file SJLB.STI. HOW TO CARRY OUT SIMULATIONS WITH MODELS Page 2-24 How to Carry out Several Simulation At Once 2.4 How to Carry out Several Simulations At Once The GEMPACK program SAGEM can be used to carry out a simulation, and indeed, as we shall see in this section, several simulations at once. However these simulations produce somewhat less accurate solutions than the multi-step calculations carried out earlier, since the linearized equations of the model are only solved once. Nonetheless, carrying out these simulations, which are referred to as Johansen simulations*, can be quite revealing. In many cases, the results are sufficiently accurate to produce the right qualitative results. Being able to compute several such solutions as quickly as one multi-step solution has its advantages, especially for a new model whose behaviour you are just beginning to understand. The starting point is always the Equations file for the model which is produced by running GEMSIM (as in Step 2 of section 2.2). When running SAGEM you specify the Equations file, closure and shocks. The following run of SAGEM carries out several Johansen simulations with the Stylized Johansen model; the Johansen version of the simulation in section 2.2 above can easily be derived from these (as we indicate below). Again we suggest that you actually carry out this simulation if you have access to the GEMPACK software. Start SAGEM running by entering the command sagem (or whatever variation is required on your system). When SAGEM prompts you, give the two responses below. cmf ! Take inputs from a GEMPACK Command file sjlbj.cmf ! The name of the Command file This should create the Solution file usually called SJLBJ.SL4. (The last "J" in the name is a reminder that this contains Johansen solutions.) To see the results, you should run GEMPIE, for example by typing gempie (or otherwise, as as required on your system), and then giving the responses below. ________________________ * The name pays tribute to Johansen who pioneered this way of obtaining useful, approximate solutions of general equilibrium models around 1960. HOW TO CARRY OUT SIMULATIONS WITH MODELS Page 2-25 How to Carry out Several Simulation At Once User Input to GEMPIE ____________________________________________________________________ ! Take the default program options sjlbj ! Solution file (from SAGEM run) i ! Print individual results from Solution file a ! Print all available columns a ! Print all available rows ! Default name (SJLBJ) for Print file All shocks 1 ! Heading for Print file 5 ! Decimal places ____________________________________________________________________ End of User Input to GEMPIE This should create the GEMPIE Print file SJLBJ (its full name is usually SJLBJ.PI5), which you should print or look at in an editor. Page 1 of the results (these are on the second last page of the Print file) should be (approximately) as shown in Table 2.4a. (Page 2 of the results gives the results for variables p_DVFACIN and p_DVHOUS, which we do not show in Table 2.4a.) The results shown in Table 2.4a are individual column results because each column shows the approximate effect of the exogenous movement in one of the exogenous variables shocked in the simulation. The first column shows the effects on the endogenous variables of a 1 per cent increase in the supply of labor (with no change in the supply of capital) while the second column shows that of a 1 per cent increase in just the supply of capital. (The third column is the total of these two results.) Because these are results of a Johansen simulation, the results are not as accurate as the single result produced in section 2.2 above. However, the advantage of Johansen results is that they can be scaled and combined. For example, the Johansen results of a 10 per cent increase in the labor supply can be inferred by multiplying the results of a 1 per cent increase (column 1 in the Print file) by 10. You should do this and compare the results with those of the multi-step simulation in section 2.2 above. (For example, the extrapolated result for household expenditure 'p_Y' is 5.8853 while from the Johansen simulation the corresponding, less accurate, result is 6.0.) You can also combine columns to estimate the cumulative effect of any shocks to supplies of labor and capital. For example, to estimate the cumulative effect of an increase of 5 per cent in the supply of labor and a decrease of 10 per cent in the supply of capital, simply multiply the results in the two columns above by 5 and -10 respectively and add the results. HOW TO CARRY OUT SIMULATIONS WITH MODELS Page 2-26 How to Carry out Several Simulation At Once PAGE 1 All shocks 1 p_XFAC p_XFAC TOTALS 1 2 1.00000 1.00000 p_Y Total nominal household expenditure 1 0.60000 0.40000 1.00000 p_PC (SECT) Price of commodity i 1 s1 0.00000* 0.00000* 0.00000* 2 s2 -0.10000 0.10000 0.00000 p_PF (FAC) Price of factor f 1 labor -0.40000 0.40000 0.00000 2 capital 0.60000 -0.60000 0.00000* p_XCOM (SECT) Total demand for (or supply of) commodity i 1 s1 0.60000 0.40000 1.00000 2 s2 0.70000 0.30000 1.00000 p_XH (SECT) Household demand for commodity i 1 s1 0.60000 0.40000 1.00000 2 s2 0.70000 0.30000 1.00000 p_XC (SECT,SECT) Intermediate inputs of commodity i to industry j (-,s1) results where '-' is in set 'SECT'. [1] 1 (s1,s1) 0.60000 0.40000 1.00000 [2] 2 (s2,s1) 0.70000 0.30000 1.00000 (-,s2) results where '-' is in set 'SECT'. [3] 1 (s1,s2) 0.60000 0.40000 1.00000 [4] 2 (s2,s2) 0.70000 0.30000 1.00000 p_XF (FAC,SECT) Factor inputs to industry j (-,s1) results where '-' is in set 'FAC'. [1] 1 (labor,s1) 1.00000 0.00000* 1.00000 [2] 2 (capital,s1) 0.00000* 1.00000 1.00000 (-,s2) results where '-' is in set 'FAC'. [3] 1 (labor,s2) 1.00000 0.00000* 1.00000 [4] 2 (capital,s2) 0.00000* 1.00000 1.00000 p_DVCOMIN (SECT,SECT) Dollar value of inputs of commodity i to industry j (-,s1) results where '-' is in set 'SECT'. [1] 1 (s1,s1) 0.60000 0.40000 1.00000 Next 1 component(s) are the same as 1. (-,s2) results where '-' is in set 'SECT'. [3] 1 (s1,s2) 0.60000 0.40000 1.00000 Next 1 component(s) are the same as 3. Table 2.4a: Individual Column Results From GEMPIE HOW TO CARRY OUT SIMULATIONS WITH MODELS Page 2-27 How to Carry out Several Simulation At Once This is the main reason for using SAGEM rather than running GEMSIM. SAGEM can produce the Johansen results of several simulations* more quickly (that is, using less computing resources) than one single, more accurate, multi-step simulation result. The GEMPACK Command file for SJLBJ.CMF used to run SAGEM above is shown in full in Figure 2.4b below. Notice that this uses the Equations file SJ.EQ4 and the Environment file SJXFAC.EN4 produced during the run of GEMSIM in section 2.2.3 above. The statement individually-retained exogenous %all ; tells SAGEM that we want all the individual column results on the Solution file. The other statements in the Command file should be self-explanatory. (Full documentation of the statements allowed in GEMPACK Command files for running SAGEM can be found in section A.2 of Appendix A.) ! ! The following GEMPACK Command file (usually called SJLBJ.CMF) ! will run SAGEM to carry out two Johansen simulations with ! the Stylized Johansen model. ! Simulation part use equation file sj ; ! Uses existing Equations file solution file = sjlbj ; ! Closure (Use closure saved on Environment file) use environment file sjxfac ; ! Shock shock p_xfac = uniform 1 ; verbal description = Stylized Johansen model. Standard data and closure. 1 per cent increases in supplies of labor and capital. Johansen solutions. ; ! Retain all individual column results individually-retained exogenous %all ; ! End of Command file Figure 2.4b: The GEMPACK Command File SJLBJ.CMF for SAGEM _________________ * Indeed, the run of SAGEM in question can be said to produce the results of infinitely many Johansen simulations since it is easy to read off the (Johansen) result corresponding to any pair of increases/decreases in the supply of labor and capital. (Note that multi-step simulation results cannot be combined in this way.) HOW TO CARRY OUT SIMULATIONS WITH MODELS Page 2-28 How to Carry out Several Simulation At Once When you run SAGEM, the Solution file produced can contain several individual column results and/or cumulative results** and subtotals. More information about these is given in chapter 7 below. Another important difference between running SAGEM and running GEMSIM to carry out a Johansen simulation relates to the updated data. If you are only carrying out a single Johansen simulation (perhaps just giving one set of shocks and are only concerned with the cumulative result), SAGEM will not produce the updated data whereas GEMSIM will. 2.4.1 Running SAGEM Interactively Of course, SAGEM (like all GEMPACK programs) can also be run interactively or via a Stored-input file; you might like to try this to duplicate the results in section 2.4 above. We show suitable responses below. (Another alternative would be to put these responses onto a Stored-input file and use that to run SAGEM. Such a file, usually called SJLBJ.STI, is available on most machines on which GEMPACK is installed.) When the run below, finishes, check that the Solution file (usually called SJLBJ.SL4) has been created. User Input to SAGEM ____________________________________________________________________ ! Take the default program options sj ! Equations file (from Step 3 above) sjlbj ! Solution file ('j' at end to remind ! you it is a Johansen solution) e ! Use an existing closure e ! from an Environment file sjxfac ! Name of existing Environment file ! (created in Step 3 of section 2.2) u ! Use this closure n ! Don't save Environment or LU file 0.1 ! Value of Harwell parameter a ! Shock all exogenous variables y ! All shocks one a ! All shocked individually-retained a ! All endogenous individually-retained a ! All endogenous cumulatively-retained n ! No subtotals Stylized Johansen model. ! Verbal description of the simulation Standard data and closure. 1 per cent shocks to both exogenous variables (supplies of labor and capital). Johansen solution. **end ____________________________________________________________________ End of User Input to SAGEM _________________ ** To see the cumulative result (the combined effect of increases of 1 per cent in the supplies of both factors), re-run GEMPIE but this time give 't' for totals as your third response, and then continue the dialogue in the obvious way. HOW TO CARRY OUT SIMULATIONS WITH MODELS Page 2-29 How Johansen and Multi-step Solutions are Calculated 2.5 How Johansen and Multi-step Solutions are Calculated Johansen solutions are approximate results of a simulation. In contrast, multi-step solutions can be made arbitrarily accurate by taking enough steps. In this section we describe the main ideas involved in calculating these different solutions. 2.5.1 The Linearized Equations of a Model Johansen solutions are calculated by solving the linearized equations* of the model once while multi-step solutions are obtained by solving these equations several times. The system of linearized equations of any model can be written in the form Cz = 0 (1) where C is the n x m matrix of coefficients** of the equations, known as the Equations Matrix, z is the m x 1 vector of all the variables (usually in percentage change form) of the model, n is the total number of equations, m is the total number of variables. We call C the Equations Matrix of the model. It is often useful to think of this matrix as a rectangular array or tableau*** with the vector variables across the top and the equation blocks along the left-hand side. Each vector variable occupies as many columns as its number of components, and each equation block occupies as many rows as the number of actual equations in it. _________________ * If some or all of the equations in the TABLO Input file are levels equations, TABLO automatically converts them to the associated linearized equations. (It does the differentiation symbolically.) The linearized equations are the ones solved by GEMSIM. _________________ ** The Equations file for the model is essentially this Equations Matrix C. The numerical values in C come from evaluating the symbolic linearized equations of the model (as held on the TABLO Input file, or as linearized by TABLO) by inserting the values from the initial data attached when the model is implemented (as in Step 3 in section 2.2.4 above). This matrix C is often denoted by A(V) in DPPW. _________________ *** This explains the origin of the name TABLO. HOW TO CARRY OUT SIMULATIONS WITH MODELS Page 2-30 The Linearized Equations of a Model To illustrate this, part of the tableau for the 27 x 29 Equations Matrix C for the Stylized Johansen model (from the TABLO Input file SJ.TAB) is shown below. 1 2 2 2 4 2 p_Y p_PC p_PF p_XCOM.... p_DVFACIN p_DVHOUS cols --> 1 2 3 4 5 6 7 24..27 28 29 rows ___________________________________________________ 1 | | | | | | | | Comin 2 | | | | | | | | 4 3 | | | | | | | | 4 |___|_______|______ |_______|______|________|______| 5 | | | | | | | | Facin 6 | | | | | | | | 4 7 | | | | | | | | 8 |___|_______|______ |_______|______|________|______| House 9 | | | | | | | | 2 10 |___|_______|_______|_______|______|________|______| | | | | | | | | : | | | | | | | | : | | | | | | | | |___|_______|_______|_______|______|________|______| Numeraire 27| | | | | | | | 1 |___|_______|_______|_______|______|________|______| Table 2.5.1: Tableau of the Equations Matrix for Stylized Johansen Notice that we use the words "variable" and "equation" in two different senses. For example we usually say that Stylized Johansen is a model with 29 variables and 27 equations, where we count as variables all the components of the vector variables and we count as equations all the individual equations in the equation blocks; in this sense, the number of variables is the number of columns in the Equations Matrix while the number of equations is the number of rows. Alternatively we may say that the TABLO Input file for Stylized Johansen has 11 variables (meaning vector variables) and 10 equations (meaning equation blocks). Usually the context will make clear which of these two meanings is intended. In general, n is less than m in the system of equations in (1) above, so when you carry out a simulation (Johansen or multi-step) you must specify (m-n) of the variables as exogenous and the remaining variables as endogenous, and shocks (usually percentage changes) to some of the exogenous variables. For Stylized Johansen, the total number of variables (m) is 29 and the total number of equations (n) is 27, so we need 2 exogenous variables. We can shock either 1 or 2 of these exogenous variables. HOW TO CARRY OUT SIMULATIONS WITH MODELS Page 2-31 Johansen Solutions 2.5.2 Johansen Solutions Johansen solutions are defined to be solutions obtained by solving the linearized equations of the model just once. Because the levels equations of the model are usually nonlinear, the results of this calculation are only approximations (sometimes good ones and sometimes not-so-good ones) to the corresponding solution of the levels equations of the model. Once the exogenous/endogenous split has been chosen, the system of equations Cz = 0, as in (1) above, becomes A.z1 = -D.z2 (2) where z1 and z2 are respectively the (column) vectors of endogenous and exogenous variables, A is n x n and D is n x (m-n). The columns of the matrices A and D are just the columns of C corresponding to the endogenous and exogenous variables respectively. The shocks are the values to use for z2. Once these are known, we have a system A.z1 = b (3) to solve (where b is an n x 1 vector). It is the solution z1 of this matrix equation (3) which is the Johansen solution of the simulation.* 2.5.3 Multi-step Simulations and Accurate Solutions of Nonlinear Equations The idea of a multi-step simulation is to break each of the shocks up into several smaller pieces. In each step, the linearized equations are solved for these smaller shocks. After each step the data, shares and elasticities are recalculated to take into account the changes from the previous step. In general, the more steps the shocks are broken into, the more accurate will be the results. Figure 2.5.3 below makes this easy to visualize. In that figure we consider just one exogenous variable X (shown on the horizontal axis) and one endogenous variable Y (vertical axis); these are constrained to stay on the curve g(X,Y) = 0. We suppose that they start from initial values X0,Y0 at the point A and that X is shocked from value X0 to value X1. Ideally we should follow the curve g(X,Y)=0 in solving this. In a Johansen (that is, a 1-step) solution we follow the straight line which is a tangent to the curve at point A to reach point BJ and so get solution YJ. In Euler's method the direction to move at each step is essentially that of the tangent to the curve at the appropriate point. In a 2-step Euler solution (see Figure 2.5.3), we first go half way _________________ * The matrix A is usually sparse in the sense that most of its entries are zero. GEMPACK uses the Harwell Laboratory's sparse matrix routines MA28 to solve (3). These solve (3) by calculating a so-called LU decomposition of A (which is always more efficient than calculating the inverse of A). It is the sparsity of A which enables GEMPACK to handle such large models. See section 7.5 for more details. HOW TO CARRY OUT SIMULATIONS WITH MODELS Page 2-32 Multi-step Simulations and Accurate Solutions of Nonlinear Equations Figure 2.5.3 goes here along this tangent to point C2, then recompute the direction in which to move, and eventually reach point B2, giving solution YE2. The exact solution is at B where Y has value Y1. In a 4-step Euler simulation we follow a path of 4 straight-line segments, and so on for more steps. The default method used by GEMPACK is Gragg's method which uses an even more accurate method than Euler's method for calculating the direction in which to move at each step. When the shocks are broken into N parts, Euler's method does N separate calculations while Gragg's method does N+1. Usually the computational cost of this extra calculation is more than repaid by the extra accuracy obtained. (More information about Gragg's method can be found in section 5.2 of GPD-2. This also introduces the midpoint method which is similar to Gragg's method.) So one way of increasing accuracy is to increase the number of steps. It turns out however that the best way to obtain an accurate solution is to carry out 2 or 3 different multi-step calculations with different numbers of steps and then to calculate the solution as an appropriate weighted average of these; this is what is meant by the extrapolated solution. To illustrate this, we have shown below the different results for the percentage change in household expenditure 'p_Y' in the Stylized Johansen model for the simulation in section 2.2 above, in which labor supply is increased by 10 per cent and capital remains in fixed supply. The table below shows Euler and Gragg results for different step numbers and extrapolations based on them. Note that the exact result is 5.88528. HOW TO CARRY OUT SIMULATIONS WITH MODELS Page 2-33 Multi-step Simulations and Accurate Solutions of Nonlinear Equations Multi-step results for different methods and step numbers Method Number of steps 1 2 4 6 100 Euler 6.00000 5.94286 5.91412 5.90452 5.88644 Gragg* 5.88675 5.88545 5.88529 Extrapolated results From Euler 1,2-step results 5.88571 From Euler 1,2,4-step results 5.88527 From Gragg 2,4,6-step results 5.88529 Note that, in this case, the 4-step Gragg result is more accurate than the 100-step Euler result and that the result extrapolated from 1,2,4-step Euler results is much more accurate than the 100-step Euler result (even though the latter takes about 100/7 times as long to compute). These results are typical of what happens in general. The general messages are: 1. Gragg's method is usually much more accurate than Euler's. 2. If in doubt, extrapolate. 3. Extrapolating from 3 different solutions is better than from 2. (For example, extrapolating from Gragg 2,4 and 6-step solutions is usually better than from just 4 and 6-step solutions.) When you extrapolate, if you ask for an Extrapolation Accuracy file (usually a .XAC file), this file shows how accurate the solution is for each endogenous variable. The separate columns show the results for the different multi-step solutions calculated, and the last column of results is the extrapolated result. When you extrapolate from 3 different multi-step results (which is what we recommend), the last two columns give conservative information about the accuracy of each result. (If they show M figures agreement, this means that the 2 different extrapolations based respectively on just the first two and just the first and third agree to this number of figures.) For example, for the 1,2,4-step Euler results for household expenditure 'p_Y' reported above, the relevant line in the Extrapolation Accuracy file would be p_Y 1 6.00000 5.94286 5.91412 5.88527 CX 4 The results are the 1,2,4-step results and the extrapolation based on them. The comment "CX 4" is an abbreviation meaning that you can have confidence in the extrapolated result (this is the 'CX') and that the two extrapolations (the first based just on the 1,2-step results and the second based on the 1,4-step results) agree to 4 figures (or more). Note that the agreements are reported as figures, not decimal places. (For example 123.4567 and 123.4014 agree to 4 figures, but only one decimal place.) The abbreviations (such as 'CX') used on this file are explained at the top of the file. (The first "1" in the line displayed above means that this line refers to the first - in this case, the only - component of variable p_Y.) _________________ * A 1-step Gragg calculation doesn't make much sense, so we have not shown a result for it. HOW TO CARRY OUT SIMULATIONS WITH MODELS Page 2-34 Multi-step Simulations and Accurate Solutions of Nonlinear Equations At the end of the file is a summary (we refer to it as the Extrapolation Accuracy Summary) which states how many components fall into each category (EMA, CX etc). For a simulation with Stylized Johansen, this may look something like that shown below. SUMMARY OF CONVERGENCE RESULTS Number Min Figs Agree ------------------------------ ------ -------------- EMA Last two results equal to machine accuracy 3 6 FC0 Fair confidence that the result is zero 2 CX Confidence in the extrapolated result 22 2 2 results are judged accurate to 2 figures. 4 results are judged accurate to 3 figures. 16 results are judged accurate to 4 figures. 3 results are judged accurate to 6 figures. (The summary above covers the XAC-retained variables.) The first part is a summary of the number of times different comments (in the example above, "EMA", "FC0" and "CX") have been used for the different results. The second part tells how many results have been judged accurate to different numbers of figures. Readers who have used Release 4.2.02 of GEMPACK will know that this always doubled the number of steps from solution to solution when extrapolating, but this is not necessary. The only restriction is that, for Gragg's method and the midpoint method, the step numbers must either be all odd or all even (for example, 2,4,6 or 3,5,7). Note also that a 1-step Gragg or midpoint is a little unusual and is probably best avoided (since it is more like Euler than Gragg or midpoint). More details are given in section 5.2 of GPD-2 and some of the theory behind multi-step methods can be found in Pearson (1991). HOW TO CARRY OUT SIMULATIONS WITH MODELS Page 2-35 TABLO-generated Programs - An Alternative to GEMSIM 2.6 TABLO-generated Programs - An Alternative to GEMSIM The program GEMSIM is a general-purpose program for carrying out simulations with different models. It can be used to carry out simulations with any model implemented in GEMPACK. For small or medium-sized models, GEMSIM runs quickly and there is no need to use any alternative. However, for large models (for example, the ORANI model of the Australian economy, which has over 100 sectors), there is an alternative way of proceeding which can result in much quicker simulations. This involves asking TABLO to write a special-purpose Fortran program (called a TABLO-generated program) to capture the theory of the model (rather than to produce the GEMSIM Auxiliary Statement and Table files, as done in Step 1 of section 2.2). A TABLO-generated program is not general-purpose, but specific to one model. To pursue this alternative*, you must have a suitable Fortran compiler on your machine, and normally need a source-code (rather than executable image) version of GEMPACK.** If so, the steps involved in using a TABLO-generated program (rather than GEMSIM) to run simulations with a model are as set out in section 2.6.1 below. (Note that these are very similar to Steps 1,2,3 used in conjunction with GEMSIM. Step 1(b) below is an extra task here.) _________________ * The alternative is not available with the Demonstration or Executable Image versions of GEMPACK. _________________ ** Information about Fortran compilers for use with source-code versions of GEMPACK on 80386/80486 and Macintosh PCs is given in Appendix G. HOW TO CARRY OUT SIMULATIONS WITH MODELS Page 2-36 Carrying Out a Simulation using TABLO-generated Program 2.6.1 Steps in Carrying Out a Simulation using TABLO-generated Program These steps are illustrated in Figure 2.6.1. Step 1. Computer Implementation of the Model Step 1(a). Process the TABLO Input file for the model by running the program TABLO. At the Code stage, select the option WFP which tells TABLO to write a Fortran program (referred to as the TABLO-generated program of the model) which captures the theory of the model. (Selecting option WFP rather than the option PGS as in section 2.2.2 above is what initiates the TABLO-generated program route rather than the GEMSIM route.) Step 1(b). Compile and link the TABLO-generated program of the model, produced in Step 1(a). This will produce a so-called executable image of the TABLO-generated program. Step 2. Simulation Run the executable image of the TABLO-generated program, as produced in Step 1(b). Specify which base data are to be read and describe the closure (that is, the exogenous and endogenous variables) and the shocks. This program then computes the solution to your simulation and writes the results to a Solution file. Step 3. Printing the Results of the Simulation Run the GEMPACK program GEMPIE to convert the solution produced in Step 2 to a GEMPIE Print file. This file can be printed (or edited). Note that Step 1(a) above is very similar to Step 1 in the GEMSIM case (see section 2.1 above). Step 1(b) has no analogue in the GEMSIM case. Step 2 is different only in that the TABLO-generated program is run rather than GEMSIM. Step 3 is identical in the two cases. Other Simulations Once you have carried out one simulation with a model, you will probably want to carry out others, for example, to change the closure and/or shocks, or even to run from different base data. In such cases, you do not have to repeat Steps 1(a) and 1(b). All you have to do is carry out Steps 2 and 3. (Of course Steps 1(a) and 1(b) must be repeated if you change the TABLO Input file for the model in any way.) HOW TO CARRY OUT SIMULATIONS WITH MODELS Page 2-37 Carrying Out a Simulation using TABLO-generated Program Figure 2.6.1 goes on this page HOW TO CARRY OUT SIMULATIONS WITH MODELS Page 2-38 Carrying Out a Simulation using TABLO-generated Program Files involved For many models there are just two starting files. On most machines these might be called MODEL.TAB The TABLO Input file for the model MODEL.DAT The data file containing the original solution Step 1(a). Program: TABLO Input: the TABLO Input file MODEL.TAB Output: the TABLO-generated Fortran program, say MODEL.FOR and its associated Auxiliary files, MODEL.AXS and MODEL.AXT Step 1(b). Program: Fortran compiler/linker on your computer Input: the TABLO-generated program MODEL.FOR (from Step 1(a)) Output: the executable image, say MODEL.EXE Step 2. Program: the executable image MODEL.EXE from Step 1(b) and its associated Auxiliary files, MODEL.AXS and MODEL.AXT Input: the data file MODEL.DAT Outputs: Solution file, say SIM1.SL4 Updated (i.e., post-simulation) data, say MODEL.UPD When running the program MODEL.EXE (from Step 1(b)) you give information to describe the closure and shocks. (Some of the shocks may be read from other files.) The main output is the Solution file, say SIM1.SL4 (for simulation number 1). (There will usually be other outputs including updated data file(s) showing post-simulation values.) Step 3. Program: GEMPIE Input: the Solution file SIM1.SL4 from Step 2 Output: the GEMPIE Print file, say SIM1.PI5 If you have a suitable Fortran compiler which can be used in conjunction with GEMPACK on your machine, we suggest that you carry out the same simulation as in section 2.2, this time using the TABLO-generated program for Stylized Johansen. The details are in sections 2.6.2 to 2.6.5 below. HOW TO CARRY OUT SIMULATIONS WITH MODELS Page 2-39 Step 1(a) - Run TABLO 2.6.2 Step 1(a) - Run TABLO Type tablo (or whatever variant is required on your machine to run TABLO. Then give the following responses. The user input for running TABLO is illustrated in Figure 2.6.2. User Input to TABLO ____________________________________________________________________ ! Use the default options sj ! Name of the TABLO Input file ! Use the default Information file name ! (often called SJ.INF) (TABLO will take a minute or two to check that the formulas, equations and updates contain no errors. When finished a menu will appear asking what to do next.) a ! Begin automatic code generation (The code generation menu appears.) wfp ! Write a Fortran (the TABLO-generated) program ! Use the other default code generation options sj ! Name of the program to be written (TABLO will take a minute or two to write the code for the TABLO-generated program.) ____________________________________________________________________ End of User Input to TABLO When this is finished, you can check that the following new files have been created. The TABLO-generated program (often called SJ.FOR). The Information file (often called SJ.INF), essentially identical to that produced in section 2.2.2 above. Auxiliary Statement and Table files (usually called SJ.AXS and SJ.AXT respectively) for the TABLO-generated program. These are binary files containing data for the program SJ.FOR. (They should not be deleted, renamed or moved.) They are different from the GEMSIM Auxiliary files produced if, as in section 2.2.2 above, you select option PGS ("Prepare output for GEMSIM") instead of WFP; the different suffixes (usually .AXS,.AXT in the TABLO-generated case and .GSS,.GST in the GEMSIM case) indicate this. You can examine the Information file. It should indicate that there were no syntax or semantic errors during the CHECK stage and, at the end of the CODE stage, tell you how many lines of code are in the TABLO-generated program. HOW TO CARRY OUT SIMULATIONS WITH MODELS Page 2-40 Step 1(a) - Run TABLO Figure 2.6.2 goes on this page HOW TO CARRY OUT SIMULATIONS WITH MODELS Page 2-41 Step 1(b) - Compile and Link the TABLO-generated Program 2.6.3 Step 1(b) - Compile and Link the TABLO-generated Program The exact command for doing this varies from machine to machine. On most machines you can simply type* ltg sj to do this. (Consult your machine-specific documentation if this does not work.) It should create an executable image (often called SJ.EXE or just SJ). 2.6.4 Step 2 - Run the TABLO-generated Program This is where the actual simulation is run. We carry out the same simulation as in section 2.2.3 above. As usual, the exact command to start this running varies from machine to machine. On most machines you can simply enter sj As with GEMSIM, you have the choice of running the TABLO-generated program interactively or of taking all input from a GEMPACK Command file (previously prepared) or a Stored-input file. Below we follow the Command file route (the preferred route, we think). You may wish to experiment with interactive running also. The only difference between the information required by GEMSIM and a TABLO-generated program is that the TABLO-generated program always knows which model is involved (it is, after all, a model-specific program), whereas GEMSIM must be told this at the start. On a Command file, the statement auxiliary files = ... ; which essentially tells GEMSIM the model, is not usually required for a TABLO-generated program.** Or, if you are running interactively, the first question asked by GEMSIM, namely which Auxiliary Statement (and Auxiliary Table) file to use, is not asked by a TABLO-generated program. All the other statements in the Command file are identical in the two cases; or the user input is identical for interactive use, _________________ * This is the only step that requires a suitable Fortran compiler and, normally, a source-code version of GEMPACK. (This step cannot be carried out with the Demonstration Version of GEMPACK.) _________________ ** Note that we are recommending a few lines below that you use the same Command file sjlb.cmf to run the TABLO-generated program as you used to run GEMSIM in section 2.2.3 above. It includes an "auxiliary files = ... ;" statement which is not necessary. This statement will not cause a problem if, as usual, you have given the TABLO-generated program the same name (SJ) as that of the GEMSIM Auxiliary files and you are attached to the same directory as the program was created in when you run it. (Section 5.9.1 of GPD-2 about the NAX option with TABLO-generated programs contains more details.) HOW TO CARRY OUT SIMULATIONS WITH MODELS Page 2-42 Step 2 - Run the TABLO-generated Program except for the first question. So, to return to this run of the TABLO-generated program SJ.EXE, we suggest that you respond cmf sjlb.cmf The resulting screen activity will be just as in section 2.2.3 above. Exactly the same output files should be produced as in that case. 2.6.5 Step 3 - Run GEMPIE This is identical to Step 3 in section 2.2.4 above. HOW TO CARRY OUT SIMULATIONS WITH MODELS Page 2-43 The Simulation (Step 2) Revisited 2.7 The Simulation (Step 2) Revisited In order to carry out a simulation, you must specify (a) the starting point for the simulation (that is, the pre-simulation data base(s)), (b) the closure, and (c) the shocks and solution method. In the example above (sections 2.2.3 and 2.6.4) we have specified all of these in one run of GEMSIM (section 2.2.3) or the TABLO-generated program (section 2.6.4). When working with a new model, or a large one, it may be convenient to take points (a), (b) and (c) one at a time. (For example, it may take some time to work out a suitable closure for a new model.) Many GEMPACK users follow such a procedure, and prepare separate Command files for each of (a), (b) and (c). In this section we illustrate this for the simulation carried out in sections 2.2 and 2.6 above. You will be able to adapt this to more complex situations. 2.7.1 Generate the Equations and BCV Files The Equations and BCV (Base Coefficient Values) files capture the starting point of the simulation, as explained in sections 2.4 and 2.5 above. The Equations file contains the entries of the matrix C in equation (1) of section 2.5.1 and the BCV file contains the values of those coefficients needed in doing any backsolves or updates of the data in a multi-step simulation. The Command file SJEQ.CMF shown in Figure 2.7.1 creates these files for Stylized Johansen. The important statements there are o "simulation = no ;" which says that no simulation is to be attempted. o "file iodata = sj.dat ;" which indicates the starting data base. o "equations file = sj ;" which specifies the name of the Equations file to produce. The Base Coefficient Values file is given the same name (but different suffix, usually '.bcv'). If you run GEMSIM or the TABLO-generated program SJ using this Command file SJEQ.CMF, you should see that new Equations and BCV files (usually called SJ.EQ4 and SJ.BCV respectively) are created. HOW TO CARRY OUT SIMULATIONS WITH MODELS Page 2-44 Generate the Equations and BCV Files ! ! The following GEMPACK Command file (usually called SJEQ.CMF) ! is used to create the Equations file ! for the Stylized Johansen model. ! Auxiliary files for model auxiliary files = sj ; ! No simulation simulation = no ; ! Data files file iodata = sj.dat ; ! Equations file information equations file = sj ; ! creates a new Equations file model = sj ; version = 1 ; identifier = Stylized Johansen. Standard data. ; ! End of Command file Figure 2.7.1: Command File SJEQ.CMF for Creating Equations File ! ! The following GEMPACK Command file (usually called SJENV.CMF) ! sets up and saves (on an Environment file) the standard ! closure for the Stylized Johansen model. ! [This can be used to run GEMSIM, the TABLO-generated program ! for SJ, or SAGEM. If SAGEM, must comment out or omit the ! "auxiliary files = sj ;" statement.] ! ! Auxiliary files for model auxiliary files = sj ; ! No simulation simulation = no ; ! Equations file to use use equations file sj ; ! Closure exogenous p_xfac ; rest endogenous ; save environment file sjxfac ; ! End of Command file Figure 2.7.2: Command File SJENV.CMF for Creating Environment Files HOW TO CARRY OUT SIMULATIONS WITH MODELS Page 2-45 Specify the Closure and Save It 2.7.2 Specify the Closure and Save It Once you have the Equations and BCV files, you can specify the closure by running GEMSIM or the relevant TABLO-generated program. For example, the Command file SJENV.CMF shown in Figure 2.7.2 does this for the standard closure for Stylized Johansen. The noteworthy statements in it are o "use equations file sj ;" which tells the program which Equations (and BCV) files to use - namely those produced in section 2.7.1 above. o the statements specifying which variables are exogenous and endogenous (exactly as in SJLB.CMF used in section 2.2.3). o "save environment file sjxfac ;" which specifies the name of the Environment file to save. If you run GEMSIM or the TABLO-generated program SJ using this Command file SJENV.CMF, you should see that new Environment file (usually called SJXFAC.EN4) is created. [You can also run SAGEM to save an Environment file; if so, omit the "auxiliary files" statement from the Command file SJENV.CMF.] 2.7.3 Specify the Shocks and Solution Method Once Equations, BCV and Environment files have been created, the simulation can be completed by specifying o the names of these files, o the sizes of the shocks, o the names of the Solution file and of any updated data files, o the solution method and number of steps, and o the verbal description. The Command file SJLBE.CMF shown in Figure 2.7.3 does this for the simulation in section 2.2 with Stylized Johansen. It is very similar to the file SJLB.CMF shown in Figure 2.3.1. The main difference is the statements use equations file sj ; use environment file sjxfac ; which say which Equations, BCV and Environment files to use. Notice that the base data file (SJ.DAT) is not mentioned in this Command file SJLBE.CMF: all information required from it is already in the Equations and BCV files. If you run GEMSIM or the TABLO-generated program SJ using this Command file STLBE.CMF, you should see that the output is as in section 2.2.3 except for the Equations, BCV and Environment files which had already been created. Note that if you change the original (that is, pre-simulation) data, you must re-run all three parts (a), (b) and (c) in order to carry out a simulation based on this changed data. HOW TO CARRY OUT SIMULATIONS WITH MODELS Page 2-46 Specify the Shocks and Solution Method ! ! The following GEMPACK Command file (usually called SJLBE.CMF) ! carries out a multi-step simulation ! for the Stylized Johansen model. ! It is the same as SJLB.CMF except that here an existing ! Equations file and an existing Environment file are used. ! ! Auxiliary files for model auxiliary files = sj ; ! Solution method information method = euler ; steps = 1 2 4 ; ! Data files - only updated files need to be mentioned updated file iodata = sjlb.upd ; ! Equations file and closure use equation file sj ; ! created via SJEQ.CMF use environment file sjxfac ; ! created via SJENV.CMF ! Solution file solution file = sjlb ; ! Shock shock p_xfac("labor") = 10 ; verbal description = Stylized Johansen model. Standard data and closure. 10 per cent increase in amount of labor. (Capital remains unchanged.) 1,2,4-step solutions plus extrapolation. ; ! Options extrapolation accuracy file = yes ; ! End of Command file Figure 2.7.3: Command File SJLBE.CMF for Rest of the Simulation HOW TO CARRY OUT SIMULATIONS WITH MODELS Page 2-47 GEMPACK File Types and Names 2.8 GEMPACK File Types and Names 2.8.1 Standard Suffixes File names differ from machine to machine. On most machines files have suffixes or extensions (at the end of the file names) such as the '.TAB' in SJ.TAB. GEMPACK requires several standard suffixes to facilitate communication between programs. Some GEMPACK files with standard suffixes are shown below. File type Usual suffix* TABLO Input file .TAB TABLO Information file .INF Solution file .SL4 GEMPIE Print file .PI5 Equations file .EQ4 Base Coefficient Values file .BCV Extrapolation Accuracy file .XAC GEMSIM Auxiliary Statement file .GSS GEMSIM Auxiliary Table file .GST TABLO-generated Auxiliary Statement file .AXS TABLO-generated Auxiliary Table file .AXT TABLO-generated program .FOR Environment file .EN4 LU file .LU4 You will notice that GEMPACK programs often automatically add the appropriate suffix to whatever name you type in. For example, when running TABLO, you should respond just 'sj' rather than 'sj.tab' when giving the name of the TABLO Input file. Also notice that, on most machines (but not Unix), the case of file names (upper or lower) is irrelevant. Other files used or created by GEMPACK programs are not required to have specific suffixes. The most notable are data files and updated data files, for which you must specify the whole name (including suffix), such as 'sj.dat'. These data files can be given any suffix you choose. Other files such as GEMPACK Command files (see section 2.3.1 above) and Stored-input files also can be given any suffix you choose. 2.8.2 Files - Binary or Text? There are two basic file types on all computers - text files (which are sometimes called ASCII files) and binary files. The former can be printed or edited while the latter cannot be. GEMPACK uses several files of each type, as discussed below. Below is a list of common GEMPACK files (some of which you will not meet until later in this document) with information as to whether they are binary or text files. _________________ * These suffixes are different on some machines. For example, on Unix machines they are all lower case. HOW TO CARRY OUT SIMULATIONS WITH MODELS Page 2-48 Files - Binary or Text? File Type Binary or Text TABLO Input file text TABLO Information file text Solution file binary GEMPIE Print file text Equations file binary Base Coefficient Values file binary Extrapolation Accuracy file text TABLO-generated program text GEMSIM Auxiliary Statement,Table files binary TABLO-generated Auxiliary files binary Environment file binary LU file binary Base data files can be binary or text Updated data files can be binary or text GEMPACK Command files text Stored-input files text Several GEMPACK programs output a text file which we often call a Print file since it is usually sent to a printer. Base data for models can be held on text or binary files. When binary files are used, they must be GEMPACK Header Array files (see section 3.4 below), where each array of data is identified by specifying its 4-character header. Text data files used in GEMPACK must follow a standard format which is introduced in section 3.4 below. 2.8.3 Why So Many Files? When GEMSIM or a TABLO-generated program runs, it produces various files. o The updated data files provide information about the simulation and can be used as the starting point for other simulations. o The Equations file can be used as the starting point for Johansen simulations (see sections 2.4 and 2.5.2 above). o The Equations and Base Coefficient Values (BCV) files can be used to slightly speed up the running of subsequent multi-step simulations (with different closure and/or shocks). o The Extrapolation Accuracy file can be used to tell if the solution produced is sufficiently accurate for your purpose. (If not, you may need to re-run it with more steps.) Saving an Environment file makes it easy to run a different simulation with the same closure: you simply give the name of the Environment file instead of having to re-specify which of the variables are exogenous or endogenous. Indeed, if you just want to make a small change in the closure, it is still easiest to start from an existing Environment file. More information about this is given in section 6.1 below. HOW TO CARRY OUT SIMULATIONS WITH MODELS Page 2-49 Why So Many Files? More information about the purpose of the other GEMPACK files is given later in this document. Appendix E contains suggestions for more hands-on computing (along the lines of those earlier in this chapter) you might like to try to familiarise yourself with the different GEMPACK programs and the tasks they can help you with. CHAPTER 3 BUILDING OR MODIFYING MODELS In order to build a model within GEMPACK, it is necessary to prepare a TABLO Input file containing the equations of the model and to construct one or more data files whose purpose is essentially to give one solution of the levels equations of the model. The preparation of a TABLO Input file involves o writing down the equations in a suitable form. You can use levels equations, linearized equations or a mixture of these. We discuss this in section 3.1 below. o working out the data requirements of the model. This is discussed in section 3.2 below. We describe the preparation of TABLO Input files in section 3.3 and the preparation of the actual data files in section 3.4. We illustrate each step in the process by doing it for the Stylized Johansen model. Of course, to modify an existing model, you modify the TABLO Input file (to change the theory of the model) and/or the data file(s). The TABLO Input file given for Stylized Johansen in section 3.3 is a mixed one (in the sense that it contains a mixture of linearized and levels equations). In sections 3.5 and 3.6 we describe alternative TABLO Input files for Stylized Johansen consisting only of linearized or levels equations respectively. In section 3.7 we compare briefly the different sorts of representations - mixed, linearized or levels. TABLO linearizes all levels equations in TABLO Input files and converts all levels variables to the associated linear ones (change or percentage change in the associated levels variables). This is described in section 3.8. In section 3.9 we introduce the process of condensation. This can be used to reduce very large models to a manageable size. BUILDING OR MODIFYING MODELS Page 3-2 Writing Down the Equations of a Model 3.1 Writing Down the Equations of a Model TABLO Input files contain the equations of a model written down in a syntax which is very similar to ordinary algebra. Once you have written down the equations of your model in ordinary algebra, it is a simple matter to put them into a TABLO Input file, as we illustrate in section 3.3 below. You are free to use levels or linearized versions of the equations or a mixture of these two types. For example, if a certain dollar value D is the product of the price P and quantity Q, the levels equation is D = PQ and the associated linearized equation is p_D = p_P + p_Q where "p_" denotes "percentage change in". The linearized version says that, to first order of approximation, the percentage-change in the dollar value is the sum of the percentage changes in the price and the quantity. Whichever version of the equation you include, GEMPACK can still produce accurate solutions of the underlying levels equations (which are usually nonlinear). We say more about the process of linearizing equations in section 3.8 below. The best way of making the above clear is to take a concrete example, as we do below, using Stylized Johansen as our example model. 3.1.1 Writing Down the Equations of Stylized Johansen We start from the equations as written down in Chapter 3 of DPPW (to which we refer readers interested in the derivation of, and motivation behind, these equations). The equations of the model are shown in Table 3.1.1a. In that table, both the levels and linearized versions of each equation are shown, taken essentially unchanged from DPPW.* Notice that, in Table 3.1.1a, upper case letters (for example, X) denote levels quantities while lower case letters (for example, x) denote percentage change in the corresponding levels quantity. For our first implementation of Stylized Johansen (see section 3.3 below), we have chosen a mixed representation, based on the shaded blocks in Table 3.1.1a. That is, we decided to use the levels versions of some of the equations (most are accounting identities and _________________ * The last 2 rows in Table 3.1.1a, which relate dollar values to prices and quantities, are not explicitly written down in DPPW but, of course, underlie the treatment there. The levels equations are (E3.1.9) [consumer demands], (E3.1.10), (E3.1.12), (E3.1.6), (E3.1.7) and (E3.1.23) [numeraire] in DPPW, while the corresponding linearized equations are (E3.2.1), (E3.2.2), (E3.2.3), (E3.2.4), (E3.2.5) and (E3.2.6) respectively. BUILDING OR MODIFYING MODELS Page 3-3 Writing Down the Equations of Stylized Johansen Table 3.1.1a goes on this page BUILDING OR MODIFYING MODELS Page 3-4 Writing Down the Equations of Stylized Johansen one is the numeraire equation) and the linearized versions of the top three equations (which are behavioural equations). Later, in sections 3.5 and 3.6 respectively, we describe implementations based on exclusively linearized equations (section 3.5) and exclusively levels equations (section 3.6). Of course, each of these 3 implementations is valid and all three produce the same results. The notation in DPPW involves a liberal use of subscripts which are not suitable for the linear type of input usually required by computers (and required in the TABLO Input file). Hence we use a different notation from DPPW. The levels variables of the model are as follows. (In the last column of this table, we use a colon : to indicate subscript, as in P:i which means P with subscript i.) In DPPW subscripts 1 and 2 refer to sectors (commodity or industry), subscripts 3 and 4 refer to factors (3 is labor and 4 is capital) while subscript 0 refers to households. GEMPACK variable Meaning DPPW Notation Y Value of household income Y PC(i) Price of commodity i P:i (i=1,2) PF(f) Price of factor f P:f (f=3,4) XCOM(i) Supply of commodity i X:i (i=1,2) XFAC(f) Supply of factor f X:f (f=3,4) XH(i) Household use of commodity i X:i0 (i=1,2) XC(i,j) Intermediate input of X:ij (i,j=1,2) commodity i to industry j XF(f,j) Input of factor f to industry j X:fj (f=3,4;j=1,2) DVCOMIN(i,j) Dollar values for intermediate inputs (i,j=1,2) DVFACIN(f,j) Dollar values for factor use by industry(f=3,4;j=1,2) DVHOUS(i) Dollar values for household consumption (i=1,2) Table 3.1.1b: Levels Variables for Stylized Johansen Parameters DPPW Notation ALPHACOM(i,j) Commodity exponents in production ALPHA:ij (i,j=1,2) function for sector j (E3.1.4) ALPHAFAC(i,j) Factor exponents in production ALPHA:fj (f=3,4; function for sector j (E3.1.4) j=1,2) Table 3.1.1c: Parameters for Stylized Johansen Levels Equations We introduce sets SECT, the set of two sectors say "s1" and "s2", and FAC, the set of the two factors "labor" and "capital". Below we have rewritten the selected equations from Table 3.1.1a, this time using the GEMPACK variables and notation as in Tables 3.1.1b and 3.1.1c. Note that below we also use the GEMPACK convention that "p_" indicates percentage change in the relevant levels variable. For example, p_XH(i) denotes the percentage change in XH(i), household consumption of commodity i. In these equations we use "*" to denote multiplication and "/" to denote division. We also use SUM(i,,) to denote sums (usually expressed via greek sigma) over all i in the set ; here is SECT or FAC. BUILDING OR MODIFYING MODELS Page 3-5 Writing Down the Equations of Stylized Johansen (E1) p_XH(i) = p_Y - p_PC(i) i in SECT [This is equation (E3.2.1) in DPPW] (E2) p_XC(i,j) = p_XCOM(j) - [p_PC(i) - p_PC(j)] i,j in SECT [This is obtained from equation (E3.2.2) for i=1,2 in DPPW. The term p_PC(j) is included because of equation (E3.2.3) in DPPW.] (E3) p_XF(f,j) = p_XCOM(j) - [p_PF(f) - p_PC(j)] f in FAC,j in SECT [This is obtained from equation (E3.2.2) for i=3,4 in DPPW. The term p_PC(j) is included because of equation (E3.2.3) in DPPW.] (E4) p_PC(j) = SUM(i,SECT, ALPHACOM(i,j)*p_PC(i)) + SUM(f,FAC, ALPHAFAC(f,j)*p_PF(f)) j in SECT [This is equation (E3.2.3) in DPPW] (E5) XCOM(i) = XH(i) + SUM(j,SECT, XC(i,j)) i in SECT [This is equation (E3.1.6) in DPPW] (E6) XFAC(f) = SUM(j,SECT, XF(f,j)) f in FAC [This is equation (E3.1.7) in DPPW] (E7) PC("s1") = 1 [This is equation (E3.1.23) in DPPW] (E8) XC(i,j) = DVCOMIN(i,j) / PC(i) i,j in SECT [This equation is not numbered in DPPW] (E9) XH(i) = DVHOUS(i) / PC(i) i in SECT [This equation is not numbered in DPPW] (E10) XF(f,j) = DVFACIN(f,j) / PF(f) f in FAC, j in SECT [This equation is not numbered in DPPW] These equations appear essentially as above in the TABLO Input file (see section 3.3.2 below). 3.2 Data Requirements for the Linearized Equations As a general rule, GEMPACK requires an initial levels solution of the model. Thus it is necessary to provide data from which initial (that is, pre-simulation) values of all levels variables and the values of all parameters of the model can be inferred. As we shall see in section 3.2.1 for Stylized Johansen, it is frequently the case that the data required are o mainly dollar values (rather than separate prices and quantities), and o certain parameters (such as elasticities). Once dollar values are known, it is often possible to set basic prices equal to 1 (this amounts to a choice of units for the related quantities), from which the quantities can be derived by dividing the dollar value by the price. [The choice of 1 for the basic price is, of course, arbitrary. Any other fixed value would be as good.] BUILDING OR MODIFYING MODELS Page 3-6 Data Requirements for Stylized Johansen 3.2.1 Data Requirements for Stylized Johansen Suppose that we know the following pre-simulation dollar values. DVCOMIN(i,j) Intermediate inputs DVHOUS(i) Household consumption DVFACIN(f,j) Factor use by industry Then, if we set all the prices PC(i) Price of commodities PF(f) Price of factors to one, we can infer all other levels variables in Table 3.1.1b as follows. XC(i,j) = DVCOMIN(i,j)/PC(i) Intermediate inputs XH(i) = DVHOUS(i)/PC(i) Household use XF(f,j) = DVFACIN(i,j)/PF(f) Factor use Y = SUM(i,SECT, DVHOUS(i)) Household expenditure The only other quantities in the equations (E1)-(E10) are the parameters ALPHACOM(i,j) and ALPHAFAC(f,j) in (E4). Because there is a Cobb-Douglas production function involved, it is well-known that these are cost shares, namely ALPHACOM(i,j) = DVCOMIN(i,j)/DVCOSTS(j), ALPHAFAC(f,j) = DVFACIN(f,j)/DVCOSTS(j), where DVCOSTS(j) is an abbreviation for SUM(i,SECT,DVCOMIN(i,j)) + SUM(f,FAC,DVFACIN(f,j)), the total costs in industry j. [These results are easily obtained from equations (E3.1.10) and (E3.1.12) in DPPW.] Thus the only data requirements are the dollar values DVHOUS(i), DVCOMIN(i,j) and DVFACIN(f,j). One instance of the data required is as shown in the body of Table 2.2.1a in section 2.2.1 above. In the TABLO Input file, the pre-simulation values of these data will be read and the values of all others will be calculated from them. BUILDING OR MODIFYING MODELS Page 3-7 Constructing the TABLO Input File for a Model 3.3 Constructing the TABLO Input File for a Model The TABLO Input file of the model is the means of communicating the theory of the model to the computer, in particular to the GEMPACK program TABLO. It consists of the equations written in a syntax which is very similar to ordinary algebra. It also contains a description of the data to be read, where it is to be read from, and how this data is to be used to calculate values of parameters and pre-simulation values of the other levels variables occurring in the equations. The main part of a TABLO Input file is the equations, which usually come at the end of the file. Before them must come o the VARIABLEs (levels or linearized) occurring; o the SETs used to describe the different arguments of variables; o the data to be read; o means of calculating pre-simulation values of any levels variables not read in as data (calculations are done via FORMULAs); o means of calculating (via FORMULAs) any parameters whose values are not read in; o logical names of the associated data files; o the headers on the data file(s) where the different pieces of data are to be found (if the data files are GEMPACK Header Array files - see section 3.4 below). The order of these in the TABLO Input file is somewhat flexible but follows the general rule that items cannot be used until they have been declared. Thus the SET statements (saying which sets are involved) usually come first. Then the declarations of data files (via FILE statements) often come next, followed by the declarations of the VARIABLEs and parameters. These ideas are best learnt and understood by example. Hence we launch straight into the preparation of the TABLO Input file for Stylized Johansen. 3.3.1 Constructing Part of the TABLO Input File for Stylized Johansen In this subsection we consider just two equations of Stylized Johansen, namely (E9) and (E4) in section 3.2.1 above. We show how these are written in the TABLO Input file. (We show the full TABLO Input file in section 3.3.2 and then discuss the rest of this file in section 3.3.3 below.) Consider first the very simple equation (E9) relating prices, quantities and dollar values of household consumption. BUILDING OR MODIFYING MODELS Page 3-8 Constructing Part of the TABLO Input File for Stylized Johansen In the TABLO Input file this equation could be written as* EQUATION House # Household demand for commodity i # (all,i,SECT) XH(i) = DVHOUS(i) / PC(i) ; where o EQUATION is a keyword indicating that what follows is an equation, o House is the name by which this equation is known in the model, o the words between the hashes # form optional additional labelling information which is associated with the equation, o the quantifier (all,i,SECT) indicates that there are really several equations, one for each sector, and o the semicolon ; marks the end of this part of the input. For this equation to be meaningful, we must explain in the TABLO Input file all the names used in the equation. The levels variables can be declared (that is, explained) via the statements VARIABLE (all,i,SECT) XH(i) # Household demand for commodity i # ; VARIABLE (all,i,SECT) DVHOUS(i) # Dollar value of household use of commodity i # ; VARIABLE (all,i,SECT) PC(i) # Price of commodity i # ; Notice that, by convention, these declarations also declare associated linear variables p_XH, p_DVHOUS and p_PC which denote the percentage-change in the relevant levels variables. These linear variable names are used in reporting simulation results (see the results in section 2.2.4 above, for example) and are available for use in linearized equations in the TABLO Input file (see, for example, the EQUATION named "Price_formation" discussed later in this section) without further explicit declaration. The names of the associated linear variables must also be used in preparing GEMPACK Command files (see sections 2.2.3 and 2.3.1 above); this is because the levels equations are linearized automatically by TABLO and so only the linear variables appear by the time you come to carry out simulations with your model. The fact that SECT is a set with two sectors "s1" and "s2" in it can be indicated via the statement SET SECT # Sectors # (s1-s2) ; We must also indicate how pre-simulation values of the levels variables can be inferred from the data base. We can do this via the _________________ * The reason for writing XH(i)=DVHOUS(i)/PC(i) rather than DVHOUS(i)=PC(i)*XH(i) will become clear when we discuss identifying pre-simulation values. BUILDING OR MODIFYING MODELS Page 3-9 Constructing Part of the TABLO Input File for Stylized Johansen statements READ DVHOUS from FILE iodata HEADER "HCON" ; FORMULA (all,i,SECT) PC(i) = 1 ; FORMULA (all,i,SECT) XH(i) = DVHOUS(i)/PC(i) ; In the first of the above statements, o READ is the keyword, o iodata is the (logical) name by which the particular data file containing this input-output data is known in the TABLO Input file, and o the Header "HCON" tells where on the file the relevant array of data is to be found. In the second and third statements, FORMULA is the keyword. The third of these contains the same expression as the equation we are considering. Indeed, we can combine the EQUATION and FORMULA into a single statement on the TABLO Input file, namely** FORMULA & EQUATION House # Household demand for commodity i # (all,i,SECT) XH(i) = DVHOUS(i) / PC(i) ; The statement FILE iodata # input-output data for the model # ; declares "iodata" as the logical name*** of the file containing the actual data. Secondly, consider the equation (E4) "price formation for commodities". This can be written in the TABLO Input file as EQUATION (LINEAR) Price_formation (all,j,SECT) p_PC(j) = SUM(i,SECT, ALPHACOM(i,j)*p_PC(i)) + SUM(f,FAC, ALPHAFAC(f,j)*p_PF(f)) ; in which o the qualifier (LINEAR) indicates that this is a linearized equation (not a levels equation), o the fact that p_PC(i) and p_PF(f) are percentage-changes in the levels variables PC(i) and PF(f) is guaranteed by the convention that, once these levels variables have been declared via _________________ ** This explains why we have written the equation as shown rather than the more natural DVHOUS(i)=PC(i)*XH(i). _________________ *** The actual name of this file on your computer can be quite different from this logical name which is just used in the TABLO Input file to distinguish between possibly several different logical files. BUILDING OR MODIFYING MODELS Page 3-10 Constructing Part of the TABLO Input File for Stylized Johansen VARIABLE (all,i,SECT) PC(i) # Price of commodity i # ; VARIABLE (all,f,FAC) PF(f) # Price of factor f # ; the associated linear variables p_PC(i) and p_PF(f) are automatically considered declared. In this equation, ALPHACOM and ALPHAFAC are parameters. That the values of these can be calculated from the data base can be communicated via the statements FORMULA # Share of intermediate commodity i in costs of industry j # (all,i,SECT)(all,j,SECT) ALPHACOM(i,j) = DVCOMIN(i,j) / [SUM(ii,SECT,DVCOMIN(ii,j)) + SUM(ff,FAC,DVFACIN(ff,j)) ] ; FORMULA # Share of factor input f in costs of industry j # (all,f,FAC)(all,j,SECT) ALPHAFAC(f,j) = DVFACIN(f,j) / [SUM(ii,SECT,DVCOMIN(ii,j)) + SUM(ff,FAC,DVFACIN(ff,j)) ] ; where FORMULA is the keyword. The fact that ALPHACOM and ALPHAFAC are parameters can be indicated via the statements COEFFICIENT(PARAMETER) (all,i,SECT)(all,j,SECT) ALPHACOM(i,j) ; COEFFICIENT(PARAMETER) (all,f,FAC) (all,j,SECT) ALPHAFAC(f,j) ; in which COEFFICIENT is the keyword and (PARAMETER) is a qualifier. This introduces the main types of statements in a TABLO Input file, namely EQUATIONs, FORMULAs, READs, VARIABLEs, COEFFICIENTs, SETs and FILEs. In addition, if you want to check the values of say ALPHAFAC, you could add one of the statements DISPLAY ALPHAFAC ; WRITE ALPHAFAC TO TERMINAL ; WRITE ALPHAFAC TO FILE xxx ; (where "xxx" would need to be declared as a FILE). Here DISPLAY and WRITE are the keywords. These statements can be added anywhere after the FORMULA giving the values of ALPHAFAC. Each entity (VARIABLE, COEFFICIENT, etc) must be declared on the TABLO Input file before it is used in EQUATIONs and FORMULAs. This partly determines the order of the statements on the Input file. We suggest that you now look at the complete TABLO Input file for this model, as set out in section 3.3.2 below. You will find all the statements shown above (except the DISPLAY and WRITE statements) in that file. Since declarations must come before use, you will find them in pretty much the reverse order from that in which we have introduced them above. We discuss the rest of this TABLO Input file in section 3.3.3. BUILDING OR MODIFYING MODELS Page 3-11 The TABLO Input File for the Stylized Johansen Model 3.3.2 The TABLO Input File for the Stylized Johansen Model !-------------------------------------------------------------------! ! Mixed TABLO Input file for the ! ! Stylized Johansen model ! ! ! ! following the description in Chapter 3 of the text ! ! "Notes and Problems in Applied General Equilibrium Economics" ! ! by P.Dixon, B.Parmenter, A.Powell and P.Wilcoxen [DPPW] ! ! published by North-Holland 1992. ! ! ! !-------------------------------------------------------------------! ! Text between exclamation marks is a comment. ! ! Text between hashes (#) is labelling information. ! !-------------------------------------------------------------------! ! Set default values ! !-------------------------------------------------------------------! VARIABLE (DEFAULT = LEVELS) ; EQUATION (DEFAULT = LEVELS) ; COEFFICIENT (DEFAULT = PARAMETER) ; FORMULA (DEFAULT = INITIAL) ; !-------------------------------------------------------------------! ! Sets ! !-------------------------------------------------------------------! ! Index values i=1,2 in DPPW correspond to the sectors called s1,s2. Index values i=3,4 in DPPW correspond to the primary factors, labor and capital. The set SECT below doubles as the set of commodities and the set of industries. ! SET SECT # Sectors # (s1-s2) ; SET FAC # Factors # (labor, capital) ; SET NUM_SECT # Numeraire sector - sector 1 # (s1) ; SUBSET NUM_SECT is subset of SECT ; BUILDING OR MODIFYING MODELS Page 3-12 The TABLO Input File for the Stylized Johansen Model !-------------------------------------------------------------------! ! Levels variables ! !-------------------------------------------------------------------! ! In the DPPW names shown below, : denotes subscript. ! ! For example, x:j indicates that j is a subscript. ! VARIABLE Y # Total nominal household expenditure # ! This is also Y in DPPW ! ; VARIABLE (all,i,SECT) PC(i) # Price of commodity i # ! This is p:i (i=1,2) in DPPW ! ; VARIABLE (all,f,FAC) PF(f) # Price of factor f # ! This is p:i (i=3,4) in DPPW ! ; VARIABLE (all,i,SECT) XCOM(i) ! This is x:i (i=1,2) in DPPW ! # Total demand for (or supply of) commodity i # ; VARIABLE (all,f,FAC) XFAC(f) ! This is x:i (i=3,4) in DPPW ! # Total demand for (or supply of) factor f # ; VARIABLE (all,i,SECT) XH(i) # Household demand for commodity i # ! This is x:i0 (i=1,2) in DPPW ! ; VARIABLE (all,i,SECT) (all,j,SECT) XC(i,j) # Intermediate inputs of commodity i to industry j # ! This is x:ij (i,j=1,2) in DPPW ! ; VARIABLE (all,f,FAC)(all,j,SECT) XF(f,j) # Factor inputs to industry j # ! This is x:ij (i=3,4; j=1,2) in DPPW ! ; !-------------------------------------------------------------------! ! Dollar values read in from database ! !-------------------------------------------------------------------! VARIABLE (all,i,SECT)(all,j,SECT) DVCOMIN(i,j) # Dollar value of inputs of commodity i to industry j # ; VARIABLE (all,f,FAC)(all,j,SECT) DVFACIN(f,j) # Dollar value of factor f used in industry j # ; VARIABLE (all,i,SECT) DVHOUS(i) # Dollar value of household use of commodity i # ; !-------------------------------------------------------------------! ! Parameters ! !-------------------------------------------------------------------! COEFFICIENT (all,i,SECT)(all,j,SECT) ALPHACOM(i,j) # Share of intermediate use of commodity i in costs of industry j # ; COEFFICIENT (all,f,FAC)(all,j,SECT) ALPHAFAC(f,j) # Share of factor input f in costs of industry j # ; !-------------------------------------------------------------------! ! File ! !-------------------------------------------------------------------! FILE iodata # input-output data for the model # ; !-------------------------------------------------------------------! ! Reads from the data base ! !-------------------------------------------------------------------! READ DVCOMIN from FILE iodata HEADER "CINP" ; READ DVFACIN from FILE iodata HEADER "FINP" ; READ DVHOUS from FILE iodata HEADER "HCON" ; BUILDING OR MODIFYING MODELS Page 3-13 The TABLO Input File for the Stylized Johansen Model !-------------------------------------------------------------------! ! Formulas ! !-------------------------------------------------------------------! FORMULA (all,i,SECT) PC(i) = 1.0 ; FORMULA (all,i,FAC) PF(i) = 1.0 ; FORMULA (all,i,SECT)(all,j,SECT) ALPHACOM(i,j) = DVCOMIN(i,j) / [SUM(ii,SECT,DVCOMIN(ii,j)) + SUM (ff,FAC,DVFACIN(ff,j))] ; FORMULA (all,f,FAC)(all,j,SECT) ALPHAFAC(f,j) = DVFACIN(f,j) / [SUM(ii,SECT,DVCOMIN(ii,j)) + SUM (ff,FAC,DVFACIN(ff,j))] ; !-------------------------------------------------------------------! ! Formulas and levels equations ! !-------------------------------------------------------------------! FORMULA & EQUATION Comin # Intermediate input of commodity i to industry j # (all,i,SECT)(all,j,SECT) XC(i,j) = DVCOMIN(i,j) / PC(i) ; FORMULA & EQUATION Facin # Factor input f to industry j # (all,f,FAC)(all,j,SECT) XF(f,j) = DVFACIN(f,j) / PF(f) ; FORMULA & EQUATION House # Household demand for commodity i # (all,i,SECT) XH(i) = DVHOUS(i) / PC(i) ; FORMULA & EQUATION Com_clear ! (E3.1.6) in DPPW ! # Commodity market clearing # (all,i,SECT) XCOM(i) = XH(i) + SUM(j,SECT,XC(i,j)) ; FORMULA & EQUATION Factor_use ! (E3.1.7) in DPPW ! # Aggregate primary factor usage # (all,f,FAC) XFAC(f) = SUM(j,SECT,XF(f,j)) ; !-------------------------------------------------------------------! ! Equations ! !-------------------------------------------------------------------! EQUATION(LINEAR) Consumer_demands ! (E3.2.1) in DPPW ! # Household expenditure functions # (all,i,SECT) p_XH(i) = p_Y - p_PC(i) ; EQUATION(LINEAR) Intermediate_com ! (E3.2.2) with i=1,2 in DPPW ! # Intermediate demands for commodity i by industry j # (all,i,SECT)(all,j,SECT) p_XC(i,j) = p_XCOM(j) - (p_PC(i) - p_PC(j)) ; EQUATION(LINEAR) Factor_inputs ! (E3.2.2) with i=3,4 in DPPW ! # Factor input demand functions # (all,f,FAC)(all,j,SECT) p_XF(f,j) = p_XCOM(j) - (p_PF(f) - p_PC(j)) ; EQUATION(LINEAR) Price_formation ! (E3.2.3) in DPPW ! # Unit cost index for industry j # (all,j,SECT) p_PC(j) = SUM(i,SECT,ALPHACOM(i,j)*p_PC(i)) + SUM(f,FAC,ALPHAFAC(f,j)*p_PF(f)) ; EQUATION Numeraire ! (E3.1.23) in DPPW ! # Price of commodity 1 is the numeraire # (all,i,NUM_SECT) PC(i) = 1 ; !--------------end of TABLO Input file------------------------------! BUILDING OR MODIFYING MODELS Page 3-14 Completing the TABLO Input File for Stylized Johansen 3.3.3 Completing the TABLO Input File for Stylized Johansen Notice that the TABLO Input file consists of a number of statements, each beginning with its relevant keyword (such as SET or VARIABLE). Some statements include a qualifier such as (LINEAR) in EQUATION(LINEAR). Each statement ends with a semicolon ';'. Text between exclamation marks '!' is treated as a comment; such text can go anywhere in the TABLO Input file. Text between hashes '#' is labelling information; the positioning of this labelling information is restricted (see chapter 3 of GPD-2 for full details). The TABLO Input file is not case-sensitive so for example, XH and Xh would be identical so far as TABLO is concerned. First come the so-called DEFAULT statements. In TABLO Input files, EQUATIONs and VARIABLEs can be linear or levels. It is possible to distinguish each type by using the appropriate qualifier (LEVELS) or (LINEAR) after the keyword each time, as in, for example, VARIABLE (LEVELS) Y # Nominal household expenditure # ; VARIABLE (LINEAR) (all,f,FAC) p_PF(f) # Price of factors # ; When most variables being declared are levels variables, it seems wasteful to have to keep repeating the qualifier (LEVELS). We have introduced DEFAULT statements to allow you to reduce the number of qualifiers required in your TABLO Input files. If you put the statement VARIABLE (DEFAULT = LEVELS) ; early in a TABLO Input file, then, after it, any VARIABLE declaration is taken as the declaration of a levels variable unless a different qualifier (LINEAR) is present. Similarly for EQUATIONs coming after the statement EQUATION (DEFAULT = LEVELS) ; Of course, if most equations in your TABLO Input file are linearized ones, you could put the opposite default statement EQUATION (DEFAULT = LINEAR) ; near the start of your file, and then you would only have to flag, using the qualifier (LEVELS), the levels equations. Similarly, the statements COEFFICIENT (DEFAULT = PARAMETER) ; FORMULA (DEFAULT = INITIAL) ; set the default types for COEFFICIENTs declared and FORMULAs. The only COEFFICIENTs in the file in section 3.2.2 above are parameters, while the only FORMULAs are used to set initial values (that is, pre-simulation values) of levels variables, or to set the values of the parameters. We will see non-parameter COEFFICIENTs and non-initial FORMULAs in section 3.5 below, when we look at linearized TABLO Input files. BUILDING OR MODIFYING MODELS Page 3-15 Completing the TABLO Input File for Stylized Johansen Next come the declarations of the SETs, namely SECT (sectors) and FAC (primary factors). A further set NUM_SECT to stand for the single numeraire sector (sector s1) is also defined; this is only used for the last of the equations, the numeraire equation. The reason for the SUBSET statement will be explained when we discuss that equation below. Then come the declarations of the VARIABLEs. Note that the arguments (if any) of each are clearly described, using the "(all,,)" quantifier(s) at the start of the declaration. These quantifiers refer to the SETs, which is why the SET declarations must precede the VARIABLE declarations. The variables declared are all levels variables (because of the DEFAULT statement earlier). Although not explicitly mentioned here, the associated linear variables p_Y, p_XH etc are taken as automatically declared by convention, and can be used in subsequent EQUATIONs without further explicit declaration. Then comes the declaration of the parameters - which must always be declared as COEFFICIENTs. The qualifier (PARAMETER) is not needed here because of the earlier DEFAULT(COEFFICIENT=PARAMETER) statement. Next comes the declaration of the single data FILE required. This file is given the logical name 'iodata'. The actual name of the file on your computer containing this data is not limited by this logical name. You can give the actual file any convenient name. GEMSIM or the TABLO-generated program will prompt you for this actual name when you run it; the prompt will use the logical name 'iodata' from the TABLO Input file. Or, if you use a GEMPACK Command file, you will need to use the logical name as well as the actual name in the relevant statement (for example, "file iodata = sj.dat ;") Then come READ statements telling the program to read in initial (that is, pre-simulation) values of certain levels variables. Each READ statement says from where the data is to be read (that is, which file and which header on the file). Next come some FORMULAs assigning initial values to other levels variables. The left-hand side of a FORMULA (that is, the part before the '=' sign) must be a simple VARIABLE or COEFFICIENT, but the right-hand side can be a complicated expression. In such an expression, the symbols for the arithmetic operations are '+' and '-' for addition and subtraction, '*' and '/' for multiplication and division, and '^' for exponentiation. Note that '*' must be shown explicitly wherever multiplication is required. Notice also the use of the syntax SUM(,, ) to express sums over sets. You may notice that there is no FORMULA assigning an initial value to the levels variable Y (nominal household expenditure). This is because this variable does not appear in any of the linearized EQUATIONs. (The only EQUATION in the TABLO Input file involving Y is the linear EQUATION "Consumer_demands" which has the linear variable p_Y in it, but not Y itself.) Thus it is not necessary to give a FORMULA for the initial value of Y. [Indeed, if you add a FORMULA for Y, TABLO will tell you that this seems to be redundant because Y does BUILDING OR MODIFYING MODELS Page 3-16 Completing the TABLO Input File for Stylized Johansen not appear in the system of linearized equations.] Finally come the EQUATIONs (see (E1) to (E10) in section 3.1.1 above). As explained in section 3.3.1, some of these double as FORMULAs, in which case the statement must begin with FORMULA & EQUATION to indicate that there are really two statements here. The syntax of the last equation (the numeraire equation) may surprise you. We could have expressed this as PC("s1") = 1 ; using the sector element name "s1" to indicate which price is fixed at one. Instead we have introduced the new set NUM_SECT consisting of just this sector "s1" and written the equation as (all,i,NUM_SECT) PC(i) = 1 ; This illustrates the point of SUBSET declarations. The VARIABLE PC has been declared to have one argument ranging over the set SECT, but here we need to give it an argument ranging over the smaller set NUM_SECT. The earlier SUBSET statement SUBSET NUM_SECT is subset of SECT ; alerts TABLO to the fact that an argument ranging over NUM_SECT is always in the set SECT. Without this, the use of PC(i) with i ranging over NUM_SECT would trigger a semantic error since TABLO checks that all arguments range over appropriate sets. As stated earlier, the order of the statements in the TABLO Input file can be varied. For example, especially with larger models, some COEFFICIENTs may only be relevant to a small number of the EQUATIONs and it may be better to declare these and assign values to them just before the relevant EQUATION or group of EQUATIONs. Note also that there are DISPLAY and WRITE statements to enable you to look at the values of COEFFICIENTs (or levels VARIABLEs) as calculated and/or to write other files (text or Header Array files) via GEMSIM or TABLO-generated programs. [These features give TABLO some of the properties of a data base manipulator, as explained in section 3.4.3 below.] You might like to try them out by adding the following statements at the end of the TABLO Input file for Stylized Johansen and then re-running Steps 1,2 and 3 in section 2.2. DISPLAY ALPHACOM ; WRITE ALPHAFAC TO TERMINAL ; FILE (NEW, TEXT) output ; WRITE ALPHACOM TO FILE output ; WRITE ALPHAFAC TO FILE output ; Complete documentation of TABLO Input files is given in GPD-2, which you will need to consult when you start to build a new model. BUILDING OR MODIFYING MODELS Page 3-17 Change or Percentage-Change Variables 3.3.4 Change or Percentage-Change Variables Many levels variables (for example, prices, quantities, dollar values) are always positive and it is usual to work with the associated percentage change as the associated linear VARIABLE. However, when the relevant levels variable can be positive or zero or negative (examples are the Balance of Trade and an ad valorem tax rate), it is wiser to work with the associated change as a linear VARIABLE. This is because, in such a case, if the levels value happens to be zero at the start of any step of a multi-step simulation, the associated percentage change could not be calculated (since it would require division by zero). Also, there are often numerical problems (which slow or hinder convergence of the solutions) when a percentage-change variable changes sign in the levels; these problems may be overcome if a change variable is used because then TABLO often works with a slightly different linearization of the EQUATIONs involving this VARIABLE. In summary, we suggest the following guidelines. o For levels variables which are always positive (or always negative), work with the associated percentage change as a linear VARIABLE. o For levels variables which may be positive, zero or negative, work with the associated change as a linear VARIABLE. In this case, if you are declaring the levels variable, insert the qualifier (CHANGE) after the keyword VARIABLE. This tells TABLO to automatically declare the associated change as a linear variable (the prefix "c_" is added to the levels name). For example, if you have a declaration VARIABLE (CHANGE) BT # Balance of trade # ; in your TABLO Input file, the associated change linear variable c_BT is automatically available for use in linearized equations and will be used in reporting simulation results. Alternatively a linear change variable can be declared directly, using the two qualifiers LINEAR and CHANGE as in VARIABLE (LINEAR,CHANGE) delB # Change in trade balance # ; (When you declare a linear change variable explicitly, you are not required to begin the name with "c_".) 3.3.5 TABLO Language - Syntax and Semantics Full details of the syntax and semantics used in TABLO Input files are given in chapters 3 and 4 of GEMPACK Document GPD-2. The description in GPD-2 applies to all TABLO Input files - that is, to those containing just levels equations, just linearized ones and to those (such as the one in section 3.3.2 above) containing a mixture of levels and linearized equations. We will introduce more information about the syntax and semantics in sections 3.5 and 3.6 below (where we describe alternative TABLO Input files for Stylized Johansen, firstly one containing just linearized equations and secondly one containing just levels equations). BUILDING OR MODIFYING MODELS Page 3-18 Constructing Data Files 3.4 Constructing Data Files In preparing the TABLO Input file for a model, you work out how much data is required and what it must represent. Then comes the (often difficult and time-consuming) task of assembling the actual data (numbers); we say nothing about this here. Once that has been done, you must create files which can be read by the GEMPACK programs containing these numbers. These files can be GEMPACK Header Array files (which are binary files) or text files. In the latter case you can create them using your favourite editor. The syntax required for text files is introduced in the next subsection, section 3.4.1, and is explained in detail in Appendix C. While text files may be attractive because you can create or change them via an editor, they are not very practical, especially for large models, and there is a danger that data on them will be assigned to the wrong COEFFICIENTs if the order of your READ statements does not match the order of the data on the file (or if you have two or more data files for the model*). For these reasons, Header Array files are the default files recognised by TABLO, GEMSIM and TABLO-generated programs. The GEMPACK program MODHAR makes it fairly easy for you to create these files and to subsequently modify the data on them, while the utility programs SUMHAR and SEEHAR enable you to examine the data on these files. The routine way of creating a Header Array data file is to first create one (or more) text files which between them contain the arrays (or matrices) of data. [These text files can be created via an editor or from spread-sheet output or, occasionally, by writing a program.] Then it is easy to run MODHAR to create a Header Array file containing these arrays of data at the appropriate header (as stated in the TABLO Input file). We illustrate this for Stylized Johansen in the subsection below. 3.4.1 Constructing the Data File for Stylized Johansen As we have seen in section 3.2.1 above, we need three arrays of data for DVCOMIN, DVFACIN and DVHOUS; these are of size 2 x 2, 2 x 2 and 2 respectively. The matrices of data required are as shown in the data base in Table 2.2.1a of section 2.2.1 above, namely ( 4.0 2.0 ) ( 1.0 3.0 ) DVCOMIN ( ) DVFACIN ( ) ( 2.0 6.0 ) ( 1.0 1.0 ) DVHOUS ( 2.0 4.0 ) Step 1 - Create a GEMPACK Text File Containing the Data The first step is to create a text file containing the data. For each array of data on a text file, there are two parts: (1) the "how much data" information, and (2) the actual data. _________________ * There may also be a problem in the unlikely event that you have to split your model into submodels. BUILDING OR MODIFYING MODELS Page 3-19 Constructing the Data File for Stylized Johansen The "how much data" information begins with the size of each dimension (or argument on the TABLO Input file) of the array. For example. this is just '2' for DVHOUS and is '2 2' for DVCOMIN since it is an array of size 2 x 2. Then, on text files for input to MODHAR, it is usual to include the header and long name which will be associated with the array on the Header Array file to be created, following the syntax header "
" longname "" The header must agree with that specified for the relevant READ statement on the TABLO Input file (see section 3.3.2 above). Finally, the "how much data" information must end with a semi-colon ';'. For example, the "how much data" information for DVCOMIN is 2 2 header "CINP" longname "Intermediate inputs of commodities to industries - dollar values" ; (The actual long name, which can describe the data in some detail, and can be up to 70 characters long, is enclosed in quotes " " and must all be on one line of the file. It cannot be split over two lines.) The actual data is, by default, in ROW order, with each row starting on a new line of the file.* For example, for DVFACIN, the data part is 1.0 3.0 ! first row of the matrix of data 1.0 1.0 ! second row of the matrix of data The full text data file for the Stylized Johansen model is shown below. _________________ * Alternatively, the data can be in column order if the word 'col_order' is in the "how much data" information. Full details of the syntax and different orders are given in Appendix C. Users familiar with Release 4.2.02 of GEMPACK will note that the format of arrays on a text file is considerably different from that required by that release of the software. However, it is quite easy to convert text files used with Release 4.2.02 to be used with Release 5 or later - see Appendix C for details. Note also that Header Array files prepared with an earlier release of GEMPACK require no changes in order to be compatible with Release 5 or later. BUILDING OR MODIFYING MODELS Page 3-20 Constructing the Data File for Stylized Johansen ! ! Text data file (usually called sjdat.txt) which can be used ! with MODHAR via the 'at' option to create a Header Array ! file (usually called sj.dat) to be the file with logical ! name 'iodata' referred to in the TABLO Input ! file (usually called sj.tab) for the Stylized Johansen model. ! ! For the use of this text data file, see section 3.4.1 of ! GEMPACK document GPD-1. ! The data are as set out in Table 2.2.1a of GPD-1. ! ! ! DVCOMIN - dollar values of commodity inputs to current production ! 2 2 header "CINP" longname "Intermediate inputs of commodities to industries - dollar values" ; 4 2 2 6 ! ! DVFACIN - dollar values of primary factor inputs to current production ! 2 2 header "FINP" longname "Intermediate inputs of primary factors - dollar values" ; 1 3 1 1 ! ! DVHOUS - dollar values of household use of commodities ! 2 header "HCON" longname "Household use of commodities - dollar values" ; 2 4 ! ! End of file ! The text after the exclamation marks contains comments. Such comments, which will be ignored by the program MODHAR when it reads these files, can come anywhere in the file.* These comments, which can make the file self-documenting, follow the same syntax as for comments in terminal input or Stored-input files. That is, they start with a single exclamation mark '!' and end at the end of the line. A comment can be continued over several lines by putting an exclamation mark in the first column of the next line. _________________ * A new feature of Release 5.1 of GEMPACK is that these comments can be in the data parts of the file, when the data is in "row_order" (the default) or "col_order" (but not when it is in spreadsheet style). See Appendix C for details. BUILDING OR MODIFYING MODELS Page 3-21 Constructing the Data File for Stylized Johansen Step 2 - Run MODHAR to Create a Header Array File The 3 arrays of data can be put on to a GEMPACK Header Array file by running the program MODHAR. We reproduce below the commands for running MODHAR to do this. We encourage you to actually run MODHAR using this input to make your own copy of the data file for Stylized Johansen. Of course, you will first have to create the text file described above. In the dialogue below, we have called this file 'sjdat.txt' (On some systems you may need to change this name; if so, you will need to change the related response below accordingly.) [Note that for small models such as Stylized Johansen, it is not really essential to have prepared the file SJDAT.TXT. This data could be entered from the terminal when running MODHAR. But we have used a file to illustrate the method applicable for larger models.] Input for MODHAR to Recreate Data File for Stylized Johansen __________________________________________________________________ ! Use default program options n ! Not based on old file (we are creating a new one) sj.dat ! Name of file to be created (Now comes the input saying you wish to add all arrays from the text file 'sjdat.txt'.) at ! Add arrays from a text file sjdat.txt ! The name of the text file a ! Add all arrays from this file (Now the end of the program) ex ! Exit (There is no more data to add.) ! Your name ! Date (Will not be prompted for on most machines) Standard input-output data for the Stylized Johansen model. ! History **end ! end the history y ! Yes, this history is what I wanted _____________________________________________________________________ End of Input for MODHAR to Recreate Data File for Stylized Johansen You may wish to check that the file SJ.DAT has been created. You can examine the data on it by running the GEMPACK program SEEHAR. As you can see from this, it is easy to use MODHAR to create a Header Array file with any number of arrays of data (once you have prepared the text file containing the data). It is also easy to prepare a Stored-input file to control the run since the responses required are easily predicted. (If you do prepare such a file and use the STI option when running MODHAR, you will not need the last line shown above, as explained in section 5.3.2 below.) BUILDING OR MODIFYING MODELS Page 3-22 Modifying Data Using MODHAR 3.4.2 Modifying Data Using MODHAR Once you have created the Header Array file or files for your model, you may wish to change the data. You can do this either by editing the text file used with MODHAR to create the original file (as in section 3.4.1 above) and then re-running MODHAR, or by running MODHAR to modify the data on the Header Array file directly. Below we give a simple example of the second method, showing how you can use MODHAR to modify data on the Header Array file produced in section 3.4.1 above. Suppose that you want to change the input-output data base for Stylized Johansen so that industry 2 uses an input of 7 (million) dollars' worth of commodity 2 (rather than 6 as in the standard data in section 2.2.1 above).** If you run MODHAR and give the following responses, the new file (SJMOD.DAT) created will have this change incorporated in it. Example of Responses to MODHAR to Modify Data for Stylized Johansen _____________________________________________________________________ ! Use default program options y ! Is based on existing file sj.dat ! Existing file (as created above) sjmod.dat ! New file to be created, containing modified data (A typical set of responses to change data in one array) mw ! Modify and write one array CINP ! Header whose associated data is to be modified m ! Modify the data r ! Replace (not scale) o ! One entry 2 2 7.0 ! Replace entry in row 2 and column 2 by value 7.0 w ! Write the modified data n ! Do not use this as basis for another array (Now exit, transferring unchanged the other 2 arrays) ex ! Exit a ! Transfer all other arrays ! Your name ! Today's date (May not be prompted for) Modified input of commodity 2 to industry 2 ! History from 6 to 7. ! History **end ! End of history y ! Yes, this is what I want _____________________________________________________________________ End of Responses to MODHAR to Modify Data for Stylized Johansen Of course, more complicated changes would require more complicated responses. But the general idea should be clear from the above. Note that, when you actually run MODHAR, it gives you information confirming initial values and new (modified) ones. Complete documentation for MODHAR is given in GPD-3. _________________ ** Note that the data base will still be balanced after this single change. BUILDING OR MODIFYING MODELS Page 3-23 Using TABLO for Data Manipulation 3.4.3 Using TABLO for Data Manipulation Although the main use of TABLO is to implement and solve models, the availability of WRITE statements means that it can also be used as a data manipulator. You can use TABLO to write text files and/or Header Array files. For example, if you have a lot of data on a text file, you could use TABLO (instead of MODHAR) to create a Header Array file containing this data: read the data from the text file into suitably declared COEFFICIENTs, then write it out to the desired headers. Indeed, you could also perform calculations on the data or make other changes such as rearranging the order of the arguments of some arrays of data or combining parts of an array into a single array. Usually TABLO Input files for data manipulation have no EQUATIONs (and hence no VARIABLEs or UPDATEs) in them. Below we give a simple example of a TABLO Input file which does some of these things. The file should be self-explanatory. Of course, you can do much more complicated operations than those shown. ! Example of the use of TABLO to manipulate data ! ! The next statement indicates that there are no equations here ! EQUATION (NONE) ; SET COM # Commodities # SIZE 10 ; SET IND # Industries # SIZE 8 ; SET SOURCE (domestic, imported) ; FILE (TEXT) orig_data # Original data # ; FILE (NEW) base_data # Base data - Header Array file # ; ! Calculate basic consumption values and put them and tax on HA file ! COEFFICIENT (all,i,COM) CONBASIC(i) # Consumption excluding tax # ; COEFFICIENT (all,i,COM) CONINCTAX(i) # Consumption including tax # ; COEFFICIENT (all,i,COM) CONTAX(i) # Tax on consumption # ; READ CONINCTAX FROM FILE orig_data ; READ CONTAX FROM FILE orig_data ; FORMULA (all,i,COM) CONBASIC(i) = CONINCTAX(i) - CONTAX(i) ; WRITE CONBASIC TO FILE base_data HEADER "CBAS" LONGNAME "Consumption by commodity, excluding tax" ; WRITE CONTAX TO FILE base_data HEADER "CTAX" LONGNAME "Tax on consumption, by commodity" ; ! Transfer basic government use data to HA file ! COEFFICIENT (all,i,COM) GOVBASIC(i) # Government usage # ; READ GOVBASIC FROM FILE orig_data ; WRITE GOVBASIC TO FILE base_data HEADER "GBAS" LONGNAME "Government usage by commodity" ; ! Reorder arguments of intermediate usage data ! COEFFICIENT (all,i,COM)(all,j,IND)(all,s,SOURCE) INT_ORIG(i,j,s) ; COEFFICIENT (all,i,COM)(all,s,SOURCE)(all,j,IND) INTUSE(i,s,j) ; READ INT_ORIG FROM FILE orig_data ; FORMULA (all,i,COM)(all,s,SOURCE)(all,j,IND) INTUSE(i,s,j) = INT_ORIG(i,j,s) ; WRITE INTUSE TO FILE base_data HEADER "IUSE" LONGNAME "Intermediate use of commodities from different sources, by industry"; Example of a TABLO Input File to Carry Out Data Manipulation BUILDING OR MODIFYING MODELS Page 3-24 Using TABLO for Data Manipulation In this example, reading is done from a text file and writing is to a Header Array file. GEMSIM and TABLO-generated programs can also read from Header Array files and write to GEMPACK text data files. TABLO can also be used to carry out aggregation of data - see section 8.4 of GPD-2 for a brief discussion of this. See section 4.12 of GPD-2 for more about the statement "EQUATION(NONE);" which is usually put at the start of TABLO Input files doing only data manipulation. 3.4.4 Header Array and Text Data Files In this subsection, we give a brief account of these files and the principal ways they are used in GEMPACK. Header Array Files Header Array files should usually be preferred to text files as the means of holding data for models, especially large ones. In a Header Array file, each array of data has an associated 4-letter header which is used to refer to the array. Headers usually consist of letters A-Z and/or digits 0-9. Different arrays must have different headers. The case (upper or lower) of the header is not significant. (For example, you cannot have one array on a Header Array file with header 'ABCD' and another on the same file with header 'AbCd'.) Headers starting with the letters 'XX' are reserved for internal program use so an error occurs if you choose a header starting with 'XX'. Note that, in addition to its header, each array of data has an associated long name (up to 70 characters long) which can contain a description of the data in the array. Header Array files are binary files so they cannot be printed or edited directly. Because of this, GEMPACK provides a number of utility programs for accessing them. These include SUMHAR For summarising the contents of a Header Array file SEEHAR For looking at the actual data on a Header Array file MODHAR For modifying the data on a Header Array file Details about SUMHAR and SEEHAR are given in chapter 8, while MODHAR is documented in GPD-3. Text Files These are the principal means of importing data into GEMPACK from elsewhere, including other (non-GEMPACK) programs such as spreadsheets, and of exporting data (for example, to report-writing software). For example, if you prepare data for your model using a spreadsheet program, you can write it out from the spreadsheet as a text file (using the widely supported comma-separated values or CSV format) and then, using MODHAR much as in section 3.4.1 above, create a GEMPACK Header Array file containing the data. If you subsequently BUILDING OR MODIFYING MODELS Page 3-25 Header Array and Text Data Files wish to modify the data, you can use SEEHAR to write it out in CSV format, import it into your spreadsheet and modify the data there, then write out the modified data in CSV form and rerun MODHAR to create a Header Array file containing the modified data. Note that, even if you are running GEMPACK on a mainframe computer and your spreadsheet program is on a PC, you can still do this since transferring text files between PCs and mainframes is easy (using Kermit or FTP, for example). One way of preparing reports on simulations carried out with your model is to first convert the simulation results (stored on a GEMPACK Solution file) to a text file (via the GEMPACK program SLTOHT described in section 8.3 below) and then import this text file into a spreadsheet or graphing package in order to prepare tables or graphs of your results. Text files can also be used to hold the data base for models (rather than using Header Array files). They are especially suitable for small models which only require one data file. An example is the intertemporal model TREES (see Appendix B); you might like to look at its text data file* TREES20.DAT (in the examples subdirectory of a machine on which GEMPACK is installed) and the TABLO Input file TREES.TAB to see how this data is accessed. However using text data files for large models or models with two or more data files is not recommended. The order of the data on text files must be identical to the order of the READ statements otherwise errors may occur without any warning. (With Header Array files, the header in the READ statement ensures that the correct data is always matched with the COEFFICIENTs.) Other problems and drawbacks with using text files as data files for models are indicated in section 4.6.1 of GPD-2. For large or complex models we recommend that you use Header Array files. Note also that GEMSIM and TABLO-generated programs can be used to write data files (see, for example, section 3.4.3 above). These programs can write text files. To do this, the FILE statement declaring the logical file to be written must declare the FILE to be a NEW (this says it will be written to) TEXT file; these two pieces of information are put in as so-called File "qualifiers" which appear in brackets after the word FILE in the TABLO Input file, as in FILE (NEW, TEXT) .... By default, text files written by GEMSIM or TABLO-generated programs have all arrays written in row order. However, you can change this to column order or spreadsheet style by adding another File qualifier (namely COL_ORDER or SPREADSHEET respectively) as in FILE (TEXT, NEW, SPREADSHEET, SEPARATOR="/") .... _____________________ * Note that the file TREES20.DAT for Release 5 or later of GEMPACK is slightly different form that shown near the end of section 6 in Codsi et al (1992), which follows the format required for Release 4.2.02 of GEMPACK. (See section C.3 of Appendix C for more details about these changes.) BUILDING OR MODIFYING MODELS Page 3-26 Header Array and Text Data Files Here the qualifier SEPARATOR="/" says that you want separator '/' to appear between data items. If you specify SPREADSHEET and omit the SEPARATOR= qualifier, the separator used will be a comma, which means that the file is written in comma-separated values (CSV) format. A summary of which programs to use in converting files from one type to another is given below in Table 3.4.4. It includes references to sections of this document where these programs are described in more detail. Input File Output File Program Option Reference Spreadsheet Text file Spreadsheet CSV - data (CSV) Text file Header Array MODHAR 'at' 3.4.1 file Also GPD-3 Header Array Text file(CSV) SEEHAR SS 8.2.2 file (row order) ROW (column order) COL Solution Header array SLTOHT - 8.3 file file Solution Text file(CSV) SLTOHT SS 8.3 file (row order) SIR (column order) SIC Text file Spreadsheet Spreadsheet - - (CSV) data Table 3.4.4: Programs to Use in File Conversion More details about the syntax required in GEMPACK text data files are given in Appendix C. Details about FILE qualifiers are given in sections 3.5 and 4.6 of GPD-2. BUILDING OR MODIFYING MODELS Page 3-27 Linearized TABLO Input Files 3.5 Linearized TABLO Input Files It is possible to make a TABLO Input file containing only linearized equations*; we refer to these as linearized TABLO Input files. We illustrate this by giving in full in section 3.5.1 below such a TABLO Input file for Stylized Johansen. In comparison with the mixed TABLO Input file for Stylized Johansen in section 3.3.2 above, the main differences to note are as follows. o The linear VARIABLEs are declared explicitly. o The levels variables do not seem to be present. But in fact, in a linearized TABLO Input file, many of these are declared as COEFFICIENTs. Thus, in TABLO Input files, COEFFICIENTs have two functions. (i) They can denote the (pre-simulation) values of a levels variable. (ii) They can denote parameters. o In a linearized TABLO Input file, the requirement that an initial solution be obtainable from the data base means that the values of all COEFFICIENTs occurring in the linearized EQUATIONs must have their values defined (via READs or FORMULAs). o It is necessary to provide so-called UPDATE statements to tell how the data read from the data base changes in response to small changes in the relevant linear VARIABLEs. (It helps to think in terms of a multi-step simulation as described in section 2.5.3 above. After each step, the data base has to be updated to take into account changes in all the linear VARIABLEs over the step.) We give a more detailed discussion of UPDATE statements in sections 3.5.2 and 3.5.3 below. One role of UPDATE statements is to provide the link between the linear VARIABLEs and the COEFFICIENTs (that is, levels variables). We give the full TABLO Input file in section 3.5.1 and then discuss noteworthy features of it in section 3.5.2 below. Advice about linearizing equations by hand can be found in section A.2 of Appendix A in GPD-2. _____________________ * Indeed, in releases of GEMPACK prior to Release 5.0 (April 1993), this was the only kind of TABLO Input files allowed. BUILDING OR MODIFYING MODELS Page 3-28 A Linearized TABLO Input File for Stylized Johansen 3.5.1 A Linearized TABLO Input File for Stylized Johansen !-------------------------------------------------------------------! ! Linearized TABLO Input file for the ! ! Stylized Johansen model ! ! ! ! following the description in Chapter 3 of the text ! ! "Notes and Problems in Applied General Equilibrium Economics" ! ! by P.Dixon, B.Parmenter, A.Powell and P.Wilcoxen [DPPW] ! ! published by North-Holland 1992. ! !-------------------------------------------------------------------! ! Text between exclamation marks is a comment. ! ! Text between hashes (#) is labelling information. ! !-------------------------------------------------------------------! ! Sets ! !-------------------------------------------------------------------! ! Index values i=1,2 in DPPW correspond to the sectors called s1,s2. Index values i=3,4 in DPPW correspond to the primary factors, labor and capital. The set SECT below doubles as the set of commodities and the set of industries. ! SET SECT # Sectors # (s1-s2) ; SET FAC # Factors # (labor, capital) ; SET NUM_SECT # Numeraire sector - sector 1 # (s1) ; SUBSET NUM_SECT is subset of SECT ; !-------------------------------------------------------------------! ! File ! !-------------------------------------------------------------------! FILE iodata # the input-output data for the model # ; ! In the DPPW names shown below, : denotes subscript. ! ! Thus, for example, x:j indicates that j is a subscript. ! !-------------------------------------------------------------------! ! Variables ! ! (All are percentage changes in the relevant levels quantities) ! !-------------------------------------------------------------------! VARIABLE p_Y # Total household expenditure # ! This is also y in DPPW !; VARIABLE (all,i,SECT) p_PC(i) # Price of commodities # ! This is p:i (i=1,2) in DPPW !; VARIABLE (all,f,FAC) p_PF(f) # Price of factors # ! This is p:i (i=3,4) in DPPW !; VARIABLE (all,i,SECT) p_XCOM(i) # Total demand for (or supply of) commodities # ! This is x:i (i=1,2) in DPPW !; BUILDING OR MODIFYING MODELS Page 3-29 A Linearized TABLO Input File for Stylized Johansen VARIABLE (all,f,FAC) p_XFAC(f) # Total demand for (or supply of) factors # ! This is x:i (i=3,4) in DPPW !; VARIABLE (all,i,SECT) p_XH(i) # Household consumption of commodities # ! This is x:i0 (i=1,2) in DPPW !; VARIABLE (all,i,SECT)(all,j,SECT) p_XC(i,j) # Intermediate commodity inputs # ! This is x:ij (i,j=1,2) in DPPW !; VARIABLE (all,f,FAC)(all,j,SECT) p_XF(f,j) # Intermediate factor inputs # ! This is x:ij (i=3,4; j=1,2) in DPPW !; !-------------------------------------------------------------------! ! Base data, updates and reads ! ! (Base data is as in Table E3.3.1 of DPPW) ! !-------------------------------------------------------------------! COEFFICIENT (all,i,SECT)(all,j,SECT) DVCOMIN(i,j) ! Dollar value of inputs of commodity i to industry j ! ; UPDATE (all,i,SECT)(all,j,SECT) DVCOMIN(i,j) = p_PC(i)*p_XC(i,j) ; COEFFICIENT (all,f,FAC)(all,j,SECT) DVFACIN(f,j) ! Dollar value of inputs of factor f to industry j ! ; UPDATE (all,f,FAC)(all,j,SECT) DVFACIN(f,j) = p_PF(f)*p_XF(f,j) ; COEFFICIENT (all,i,SECT) DVHOUS(i) ! Dollar value of household use of commodity i ! ; UPDATE (all,i,SECT) DVHOUS(i) = p_PC(i)*p_XH(i) ; !-------------------------------------------------------------------! ! Reads from the data base ! !-------------------------------------------------------------------! READ DVCOMIN FROM FILE iodata HEADER "CINP" ; READ DVFACIN FROM FILE iodata HEADER "FINP" ; READ DVHOUS FROM FILE iodata HEADER "HCON" ; !-------------------------------------------------------------------! ! Other coefficients and formulas for them ! !-------------------------------------------------------------------! COEFFICIENT (all,i,SECT) DVCOM(i) ! Dollar value of total demand for commodity i ! ; FORMULA (all,i,SECT) DVCOM(i) = SUM(j,SECT, DVCOMIN(i,j)) + DVHOUS(i) ; COEFFICIENT (all,f,FAC) DVFAC(f) ! Dollar value of total demand for factor f ! ; FORMULA (all,f,FAC) DVFAC(f) = SUM(j,SECT,DVFACIN(f,j)) ; BUILDING OR MODIFYING MODELS Page 3-30 A Linearized TABLO Input File for Stylized Johansen COEFFICIENT(PARAMETER) (all,i,SECT)(all,j,SECT) ALPHACOM(i,j) ! alpha(i,j) - commodity parameter in Cobb-Douglas production function. It is equal to the initial share of commodity i in total inputs to industry j ! ! This is alpha:ij (i=1,2; j=1,2) in (E3.1.4) of DPPW ! ; FORMULA(INITIAL) (all,i,SECT)(all,j,SECT) ALPHACOM(i,j) = DVCOMIN(i,j)/DVCOM(j) ; COEFFICIENT(PARAMETER) (all,f,FAC)(all,j,SECT) ALPHAFAC(f,j) ! alpha(f,j) - factor parameter in Cobb-Douglas production function. It is equal to the initial share of factor f in total inputs to industry j ! ! This is alpha:ij (i=3,4; j=1,2) in (E3.1.4) of DPPW ! ; FORMULA(INITIAL) (all,f,FAC)(all,j,SECT) ALPHAFAC(f,j) = DVFACIN(f,j)/DVCOM(j) ; COEFFICIENT (all,i,SECT)(all,j,SECT) BCOM(i,j) ! beta(i,j) - share of industry j in total demand for commodity i ! ! This is beta:ij (i=1,2; j=1,2) in (E3.2.4) of DPPW ! ; FORMULA (all,i,SECT)(all,j,SECT) BCOM(i,j) = DVCOMIN(i,j)/DVCOM(i) ; COEFFICIENT (all,i,SECT) BHOUS(i) ! beta(i,0) - share of households in total demand for commodity i ! ! This is beta:i0 (i=1,2) in (E3.2.4) of DPPW ! ; FORMULA (all,i,SECT) BHOUS(i) = DVHOUS(i)/DVCOM(i) ; COEFFICIENT (all,f,FAC)(all,j,SECT) BFAC(f,j) ! beta(f,j) - share of industry j in total demand for factor f ! ! This is beta:ij (i=3,4; j=1,2) in (E3.2.5) of DPPW ! ; FORMULA (all,f,FAC)(all,j,SECT) BFAC(f,j) = DVFACIN(f,j)/DVFAC(f) ; !-------------------------------------------------------------------! ! Equations (Linearized) ! !-------------------------------------------------------------------! EQUATION Consumer_demands # Household expenditure functions # (all,i,SECT) p_XH(i) =p_Y - p_PC(i) ! This is (E3.2.1) in DPPW ! ; EQUATION Intermediate_com # Intermediate demands for commodity i by industry j # (all,i,SECT) (all,j,SECT) p_XC(i,j) = p_XCOM(j) - [ p_PC(i) - SUM(t,SECT,ALPHACOM(t,j)*p_PC(t)) - SUM(f,FAC,ALPHAFAC(f,j)*p_PF(f)) ] ! This is (E3.2.2) (i=1,2; j=1,2) in DPPW ! ; BUILDING OR MODIFYING MODELS Page 3-31 A Linearized TABLO Input File for Stylized Johansen EQUATION Factor_inputs # Factor input demand functions # (all,f,FAC) (all,j,SECT) p_XF(f,j) = p_XCOM(j) - [ p_PF(f) - SUM(t,SECT,ALPHACOM(t,j)*p_PC(t)) - SUM(g,FAC,ALPHAFAC(g,j)*p_PF(g)) ] ! This is (E3.2.2) (i=3,4; j=1,2) in DPPW ! ; EQUATION Price_formation # Unit cost index for industry j # (all,j,SECT) p_PC(j) = SUM(t,SECT,ALPHACOM(t,j)*p_PC(t)) + SUM(f,FAC,ALPHAFAC(f,j)*p_PF(f)) ! This is (E3.2.3) in DPPW ! ; EQUATION Com_clear # Commodity market clearing # (all,i,SECT) p_XCOM(i) = BHOUS(i)*p_XH(i) + SUM(j,SECT,BCOM(i,j)*p_XC(i,j)) ! This is (E3.2.4) in DPPW ! ; EQUATION Factor_use # Aggregate primary factor usage # (all,f,FAC) p_XFAC(f) = SUM(j,SECT,BFAC(f,j)*p_XF(f,j)) ! This is (E3.2.5) in DPPW ! ; EQUATION NUMERAIRE # Numeraire for the model is price of commodity 1 # (all,i,NUM_SECT) p_PC(i) = 0 ! Alternatively, this could be written as p_PC( "s1" ) = 0 ! ! This is (E3.2.6) in DPPW ! ; !-------------------------------------------------------------------! ! Balance check for data base ! !-------------------------------------------------------------------! ! In a balanced data base, total demand for commodity i, DVCOM(i) should equal DVCOST(i), the total cost of inputs to industry i ! ! To check that total demand = total costs to industry i, remove the strong comment markers ![[! ... !]]! around the following lines ! ![[! COEFFICIENT (all,i,SECT) DVCOSTS(i) ! Total cost of inputs to industry i! ; FORMULA (all,i,SECT) DVCOSTS(i) = SUM(u,SECT,DVCOMIN(u,i)) + SUM(f,FAC,DVFACIN(f,i)) ; ! Check that the values of DVCOM and DVCOSTS are equal ! DISPLAY DVCOM ; DISPLAY DVCOSTS ; !]]! !---------end of TABLO Input file-----------------------------------! BUILDING OR MODIFYING MODELS Page 3-32 Noteworthy Features in the Linearized TABLO Input File 3.5.2 Noteworthy Features in the Linearized TABLO Input File 1. DEFAULT statements Notice that there are no DEFAULT statements at the start of the linearized file in section 3.5.1. This is because of the convention that all TABLO Input files are assumed to begin with defaults appropriate for linearized TABLO Input files*, namely as if there were the following statements at the start. VARIABLE (DEFAULT = LINEAR) ; EQUATION (DEFAULT = LINEAR) ; VARIABLE (DEFAULT = PERCENT_CHANGE) ; COEFFICIENT (DEFAULT = NON_PARAMETER) ; FORMULA (DEFAULT = ALWAYS) ; The purpose of the last of these is discussed under the heading "FORMULAs" below. 2. VARIABLEs The linear variables are declared explicitly. We have chosen to use the same names as are declared implicitly in the mixed TABLO Input file in section 3.3.2 above. (This makes results from the 2 files easier to compare.) But we could have chosen different names. 3. COEFFICIENTs Many of the levels quantities which were declared as levels variables in the mixed TABLO Input file in section 3.3.2 are declared here as COEFFICIENTs. (For example, the dollar values DVHOUS and DVCOM. The first is READ from the data base and the second has its values assigned via a FORMULA.) It may help to think of these COEFFICIENTs as holding pre-simulation values of the levels variables. However this is not entirely accurate in a multi-step simulation as we see below in the discussion of FORMULAs and UPDATEs. 4. FORMULAs Most of the FORMULAs in the linearized file are re-evaluated at each step of a multi-step simulation. This is what the qualifier (ALWAYS) denotes in the DEFAULT statement shown in 1. above. After each step of a multi-step simulation, the data base is updated and all FORMULA(ALWAYS)s are re-evaluated. For example, this ensures that DVCOM is always an accurate reflection of the DVCOMIN and DVHOUS values on the currently updated data base. _____________________ * These defaults were chosen so that TABLO Input files written for versions of GEMPACK before Release 5.0 would not need altering for use with Release 5.0 and subsequent releases. BUILDING OR MODIFYING MODELS Page 3-33 Noteworthy Features in the Linearized TABLO Input File However some FORMULAs, those with qualifier (INITIAL), are only evaluated on the first step of a multi-step simulation. FORMULAs giving the value of parameters (such as those for ALPHACOM and ALPHAFAC) should only be applied initially (that is, at the first step) since the value of a parameter should not be changed. 5. UPDATEs The purpose of an UPDATE statement is to tell the software how a COEFFICIENT (that is, a levels variable) changes in response to the small changes in the linear VARIABLEs at each step of a multi-step simulation. For example, consider DVHOUS(i), the dollar value of household consumption of commodity i. (a) Suppose there were an explicit linear VARIABLE, say p_DVHOUS(i), declared giving the percentage change in DVHOUS(i). (In fact there is no such VARIABLE in the TABLO Input file.) Then, in response to a change in this, the new value of DVHOUS(i) should be given by new_DVHOUS(i) = old_DVHOUS(i)*[1 + p_DVHOUS(i)/100]. (On any step, the old value is the value before the step and the new value is the one put on the data base updated after the step.) We would need an UPDATE statement to indicate this. The statement could be UPDATE (all,i,SECT) DVHOUS(i) = p_DVHOUS(i) ; (b) In fact there is no linear VARIABLE declared in the TABLO Input file giving the percentage change in DVHOUS(i). However there are explicit linear VARIABLEs p_PC(i) and p_XH(i) showing the percentage changes in the relevant price and quantity. If p_DVHOUS(i) were declared, there would be a linear EQUATION connecting it to p_PC(i) and p_XH(i). This EQUATION would say that p_DVHOUS(i) = p_PC(i) + p_XH(i). Thus, the procedure for updating DVHOUS(i) is new_DVHOUS(i) = old_DVHOUS(i)*[1 + {p_PC(i)+p_XH(i)}/100] . In fact the UPDATE statement is UPDATE (all,i,SECT) DVHOUS(i) = p_PC(i) * p_XH(i) ; This is interpreted by TABLO as having the correct effect. At first you may be puzzled by the multiplication sign "*" here since the percentage change in DVHOUS(i) is the SUM of p_PC(i) and p_XH(i). However, this form of UPDATE is called a PRODUCT UPDATE because it is used to update a COEFFICIENT (that is, a levels variable) which is the product of 2 or more levels variables whose percentage changes are explicit linear VARIABLEs. Here, in the levels, BUILDING OR MODIFYING MODELS Page 3-34 Noteworthy Features in the Linearized TABLO Input File DVHOUS(i) = PC(i) * XH(i) and the "*" used in a PRODUCT UPDATE is to remind you of this levels formula.* 6. Levels Prices and Quantities not Needed Notice that no COEFFICIENTs have been declared to hold the levels values of prices or quantities. This is a fairly common feature of linearized TABLO Input files. In such files, (i) normally linear VARIABLEs are declared to show percentage changes (or changes) in prices and quantities, but no explicit linear VARIABLEs are declared to show percentage changes in dollar values. (ii) COEFFICIENTs holding levels dollar values are declared but there are not normally COEFFICIENTs holding levels prices or quantities. 7. Names for Levels and Linearized VARIABLEs As you have seen above, the levels variables required in a linearized TABLO Input file appear as COEFFICIENTs while the percentage-change (or change) variables required appear as linear VARIABLEs. It may happen that you need on the TABLO Input file a levels variable as a COEFFICIENT and its percentage change (or change) as a VARIABLE. In this case, since TABLO Input files are not case-sensitive, you cannot follow the convention of using upper case for the levels variables or COEFFICIENTs (for example, XHOUS) and the same name partly or wholly in lower case for the associated linear VARIABLEs (for example, xHOUS). We suggest two alternative ways around this problem. (1) Use the natural name for the COEFFICIENT version and attach 'p_' (for percentage change) or 'c_' (for change) at the start for the VARIABLE. For example, VARIABLE p_XHOUS(i) COEFFICIENT XHOUS(i) (2) Alternatively, use the natural name for the VARIABLE version and attach '_L' (for levels) to the end for the COEFFICIENT. For example, VARIABLE xHOUS(i) COEFFICIENT XHOUS_L(i) _____________________ * There are other kinds of UPDATE statements called CHANGE UPDATEs. They are less commonly needed and are documented in section 3.5.3 below. BUILDING OR MODIFYING MODELS Page 3-35 Noteworthy Features in the Linearized TABLO Input File Although TABLO Input files are not case-sensitive (meaning that xHOUS and XHOUS are treated as being the same), we find it makes linearized TABLO Input files more readable if we consistently put linear VARIABLE names in lower case or consistently put the first letter of all linear VARIABLE names in lower case and the rest in upper case. 3.5.3 Writing UPDATE Statements The purpose of an UPDATE statement is to tell how much some part of data read changes in response to changes in the model's variables in the current step of a multi-step simulation. An introductory example was given in section 3.5.2 above. Consider a COEFFICIENT X whose value(s) are read. There are three possibilities for the UPDATE statement for X. 1. If there is a linear VARIABLE, say p_X, in the TABLO Input file which represents the percentage change in X, then use a UPDATE statement of the form UPDATE X = p_X ; 2. If, in the levels, X is equal to the product of two or more quantities say Q1,Q2,...,Qn for each of which there is a corresponding percentage-change VARIABLE say p_Q1,p_Q2,...,p_Qn in the TABLO Input file, then use a UPDATE statement of the form UPDATE X = p_Q1*p_Q2*...*p_Qn ; (This type of UPDATE statement is referred to as a PRODUCT UPDATE since it involves updating a Levels variable which is a product of other Levels quantities.) 3. Otherwise work out an expression for the change in X in terms of linear VARIABLEs in the TABLO Input file and use a CHANGE UPDATE statement of the form UPDATE (CHANGE) X = ; Of these, the second case is by far the most common and probably will cover over 90% of your UPDATE statements.* All three UPDATE statements in the linearized TABLO Input file for Stylized Johansen _________________ * Readers familiar with Release 4.2.02 of GEMPACK may have expected to see an EXPLICIT UPDATE statement of the form UPDATE (EXPLICIT) X = X + ; While this form of an UPDATE statement is still accepted, we recommend that you do not use statements of this kind in the future and that you change any such statements in old TABLO Input files to UPDATE (CHANGE) statements. The numerical accuracy of solutions obtained via Gragg's method or the midpoint method increases greatly if you use the UPDATE (CHANGE) form. BUILDING OR MODIFYING MODELS Page 3-36 Writing UPDATE Statements are of this form (see section 3.5.1 above). The first is easy to use if it applies. Of course if COEFFICIENT X has one or more arguments, the UPDATE statements also have the appropriate quantifiers, for example (all,i,SECT), in them (as in those in Stylized Johansen in section 3.5.1). Note also that only COEFFICIENTs whose values are READ or assigned via a FORMULA(INITIAL) in the TABLO Input file must be UPDATEd. In case 3. above, the expression for the change in X is obtained by linearizing the levels equation connecting X to other levels variables whose associated linear variables have been declared in the TABLO Input file. We illustrate this in the example below. Advice about linearizing equations by hand can be found in section A.2 of Appendix A in GPD-2. Example of an UPDATE (CHANGE) statement Consider a commodity with base level price P, a quantity Q of which is sold and which is taxed at an ad valorem rate of T per cent. Suppose that read from the data base are COEFFICIENTs V representing the pre-tax dollar value and W representing the post-tax dollar value of sales of this commodity. Suppose also that VARIABLEs in the TABLO Input file include p_P and p_Q being the percentage changes in P and Q respectively and also c_T being the CHANGE (not percentage change) in T.** Clearly the relevant levels equations are V = P*Q (1) W = P*Q*(1+T) = V*(1+T) (2) Updating V is easy since clearly case 2 above applies. Here we work out an appropriate UPDATE statement for W, which must follow case 3 above (since cases 1 and 2 do not apply). To do this amounts to linearizing equation (2) which we do by partial differentiation in the usual way (see section A.2 of Appendix A in GPD-2). Using d in front of quantities to denote differentials or changes, we obtain dW = dV*(1+T) + V*d(1+T) = dV*(1+T) + V*dT (since d(1+T) = dT) = dV*(1+T) + V*c_T (3) since c_T is the VARIABLE representing the change in T. But, linearizing (1) similarly by partial differentiation and using the fact that changes dE and percentage changes pE in a quantity E are related via dE = E*pE/100, we obtain _________________ ** Since T is usually positive but may also be negative if the tax is in fact a subsidy, it may be unwise to include the percentage change in T as a VARIABLE. In this case the VARIABLE c_T would be declared in the TABLO Input file via a VARIABLE(CHANGE) statement, as explained in section 3.3.4 above. BUILDING OR MODIFYING MODELS Page 3-37 Writing UPDATE Statements dV = P*dQ + Q*dP = P*Q*p_Q/100 + Q*P*p_P/100 = P*Q*[p_P + p_Q]/100 = V*[p_P + p_Q]/100. If we substitute this into (3) we obtain dW = W*[p_P+p_Q]/100 + V*c_T as the expression for the change in W. Thus the appropriate UPDATE statement for W is UPDATE (CHANGE) W = W*[p_P+p_Q]/100 + V*c_T ; Of course if the VARIABLE in the TABLO Input file were p_T, the percentage change in T, rather than c_T the change in T, then we would have c_T=T*p_T/100, in which case an appropriate UPDATE statement for W would be UPDATE (CHANGE) W = W*[p_P+p_Q]/100 + V*T*p_T/100 ; BUILDING OR MODIFYING MODELS Page 3-38 Levels TABLO Input Files 3.6 Levels TABLO Input Files We illustrate the construction of TABLO Input files containing only levels equations by looking at such a file for Stylized Johansen in section 3.6.1. The main difference in general from mixed TABLO Input files is in connection with behavioural equations (such as CES specifications). You should expect the levels files to contain explicit calibration FORMULAs of the kind familiar to levels modellers for calculating the values of the parameters of these functions. A surprise with the Cobb-Douglas specification in Stylized Johansen is that, although such parameters appear in the levels equations, we do not need to calculate their values since these parameters do not appear in the linearized equations produced by TABLO. But this would not be the case if Cobb-Douglas were replaced by CES. 3.6.1 A Levels TABLO Input File for Stylized Johansen The main difference from the mixed TABLO Input file shown in section 3.3.2 comes from using the levels version of the behavioural equations (the first three blocks in Table 3.1.1a). These involve two parameters not present in the linearized versions of these equations, namely ALPHA parameters in the consumer demand equations i0 Q parameters in the intermediate demand equations j These are called ALPHAH(i) and Q(j) respectively in the levels TABLO Input file given later in this section. As part of the calibration phase, you would expect to have to give FORMULAs for calculating the values of these. For example, using the TABLO Input file notation, ALPHAH(i) = PC(i)*XH(i)/Y = DVHOUS(i)/SUM(ii,SECT,DVHOUS(ii)) and it would also be possible to write down a formula for the Q(j). However, in GEMPACK, the levels equations are only used as a means of writing down the linearized equations (TABLO does this by symbolically differentiating the levels equations). Once this has been done, the levels equations are ignored. Thus, since the linearized versions of these equations no longer involve these ALPHAH and Q parameters, it is not necessary to give FORMULAs for them.* Of course, in a more complicated model, you may not be sure if similar parameters are going to appear in the linearized system. When in doubt, you can write down the TABLO Input file leaving out calibration FORMULAs for such parameters and process the file by running TABLO. If the values are needed in the linearized system, TABLO will tell you and not allow you to proceed until you have _____________________ * Indeed, if you add the FORMULA shown in the text for ALPHAH(i), TABLO will tell you that this seems to be redundant because it does not appear in the linearized system. BUILDING OR MODIFYING MODELS Page 3-39 A Levels TABLO Input File for Stylized Johansen supplied calibration FORMULAs. Another noteworthy feature of the levels TABLO file shown below is in the EQUATION for the quantity called W(j) there. This has been introduced to simplify the "intermediate demands" and "price formation" equations. W(j) is most naturally a product of several quantities. However, although TABLO recognises SUMs, it does not yet allow products, which would be naturally expressed via PROD( , , ). Accordingly, we have converted the PROD implicit in the expression for W(j) into a SUM by taking logarithms of both sides. The full levels TABLO Input file is shown below. !-------------------------------------------------------------------! ! Levels TABLO Input File for the ! ! Stylized Johansen Model ! ! ! ! following the description in Chapter 3 of the text ! ! "Notes and Problems in Applied General Equilibrium Economics" ! ! by P.Dixon, B.Parmenter, A.Powell and P.Wilcoxen [DPPW] ! ! published by North-Holland 1992 ! !-------------------------------------------------------------------! ! Text between exclamation marks is a comment ! ! Text between hashes (#) is labelling information ! !-------------------------------------------------------------------! ! Set defaults for Levels model ! !-------------------------------------------------------------------! EQUATION(DEFAULT=LEVELS) ; VARIABLE(DEFAULT=LEVELS) ; FORMULA(DEFAULT=INITIAL) ; COEFFICIENT(DEFAULT=PARAMETER) ; !-------------------------------------------------------------------! ! Sets ! !-------------------------------------------------------------------! ! Index values i=1,2 in DPPW correspond to the sectors called s1,s2. Index values i=3,4 in DPPW correspond to the primary factors, labor and capital. The set SECT below doubles as the set of commodities and the set of industries. ! SET SECT # Sectors # (s1-s2) ; SET FAC # Factors # (labor, capital) ; BUILDING OR MODIFYING MODELS Page 3-40 A Levels TABLO Input File for Stylized Johansen !-------------------------------------------------------------------! ! Levels variables ! !-------------------------------------------------------------------! ! In the DPPW names shown below, : denotes subscript. ! ! For example, x:j indicates that j is a subscript. ! VARIABLE Y # Total nominal household expenditure # ! This is also Y in DPPW ! ; VARIABLE (all,i,SECT) PC(i) # Price of commodity i # ! This is p:i (i=1,2) in DPPW ! ; VARIABLE (all,f,FAC) PF(f) # Price of factor f # ! This is p:i (i=3,4) in DPPW ! ; VARIABLE (all,i,SECT) XCOM(i) # Total demand for (or supply of) commodity i # ! This is x:i (i=1,2) in DPPW ! ; VARIABLE (all,f,FAC) XFAC(f) # Total demand for (or supply of) factor f # ! This is x:i (i=3,4) in DPPW ! ; VARIABLE (all,i,SECT) XH(i) # Household demand for commodity i # ! This is x:i0 (i=1,2) in DPPW ! ; VARIABLE (all,i,SECT) (all,j,SECT) XC(i,j) # Intermediate inputs of commodity i to industry j # ! This is x:ij (i,j=1,2) in DPPW ! ; VARIABLE (all,f,FAC)(all,j,SECT) XF(f,j) # Factor inputs to industry j # ! This is x:ij (i=3,4; j=1,2) in DPPW ! ; VARIABLE (all,j,SECT) W(j) #Price expression#; !-------------------------------------------------------------------! ! Dollar values read in from database ! !-------------------------------------------------------------------! VARIABLE (all,i,SECT)(all,j,SECT) DVCOMIN(i,j) # Dollar value of inputs of commodity i to industry j # ; VARIABLE (all,f,FAC)(all,j,SECT) DVFACIN(f,j) # Dollar value of factor f used in industry j # ; VARIABLE (all,i,SECT) DVHOUS(i) # Dollar value of household use of commodity i # ; !-------------------------------------------------------------------! ! Parameters ! !-------------------------------------------------------------------! COEFFICIENT (all,i,SECT) ALPHAH(i) #Household parameter#; COEFFICIENT (all,i,SECT) (all,j,SECT) ALPHACOM(i,j) #Commodity parameter#; COEFFICIENT (all,f,FAC) (all,j,SECT) ALPHAFAC(f,j) #Factor parameter#; COEFFICIENT (all,j,SECT) Q(j) #Scale parameter#; !-------------------------------------------------------------------! ! File ! !-------------------------------------------------------------------! FILE iodata # input-output data for the model # ; BUILDING OR MODIFYING MODELS Page 3-41 A Levels TABLO Input File for Stylized Johansen !-------------------------------------------------------------------! ! Reads from the data base ! !-------------------------------------------------------------------! READ DVCOMIN from FILE iodata HEADER "CINP" ; READ DVFACIN from FILE iodata HEADER "FINP" ; READ DVHOUS from FILE iodata HEADER "HCON" ; !-------------------------------------------------------------------! ! Formulas to calculate the Initial solution ! !-------------------------------------------------------------------! ! 1. Formulas for initial prices ! !....................................! FORMULA (all,i,SECT) PC(i) = 1 ; FORMULA (all,f,FAC) PF(f) = 1 ; FORMULA (all,j,SECT) W(j) = 1 ; ! 2. Formulas which are also equations ! !..........................................! FORMULA & EQUATION Comin # Intermediate input of commodity i in industry j # (all,i,SECT)(all,j,SECT) XC(i,j) = DVCOMIN(i,j) / PC(i) ; ! Quantity = Dollar value / price ! FORMULA & EQUATION Facin # Factor input f in industry j # (all,f,FAC)(all,j,SECT) XF(f,j) = DVFACIN(f,j)/PF(f) ; FORMULA & EQUATION House # Household demand for Commodity i # (all,i,SECT) XH(i) = DVHOUS(i)/PC(i) ; FORMULA & EQUATION Com_clear #Commodity market clearing # ! (E3.1.6) in DPPW ! (all,i,SECT) XCOM(i) = XH(i) + SUM(j,SECT, XC(i,j)) ; FORMULA & EQUATION Factor_use # Aggregate primary factor usage # ! (E3.1.7) in DPPW ! (all,f,FAC) XFAC(f) = SUM(j,SECT, XF(f,j)) ; ! 3. Formulas for the parameters ! !...................................! ! FORMULAs for ALPHAH(i) and Q(j) are not needed since they do not appear in the linearized equations produced by TABLO. ! FORMULA (all,i,SECT)(all,j,SECT) ALPHACOM(i,j) = XC(i,j)/XCOM(j) ; FORMULA (all,f,FAC)(all,j,SECT) ALPHAFAC(f,j) = XF(f,j)/XCOM(j) ; BUILDING OR MODIFYING MODELS Page 3-42 A Levels TABLO Input File for Stylized Johansen !-------------------------------------------------------------! ! Levels Equations (Numbers refer to DPPW) ! !-------------------------------------------------------------! EQUATION Consumer_demands #Household expenditure functions # ! (E3.1.9) in DPPW ! (all,i,SECT) XH(i) = ALPHAH(i)*Y/PC(i) ; EQUATION Intermediate_com #Intermediate demand for commodity i by industry j # ! (E3.1.10) in DPPW ! (all,i,SECT) (all,j,SECT) XC(i,j) = ALPHACOM(i,j)*Q(j)*XCOM(j)*W(j)/PC(i) ; EQUATION Extra (all,j,SECT) LOGE(W(j)) = SUM(t,SECT,ALPHACOM(t,j)*LOGE(PC(t))) + SUM(u,FAC,ALPHAFAC(u,j)*LOGE(PF(u))) ; EQUATION Factor_inputs # Factor input demand functions # !(E3.1.10) in DPPW ! (all,f,FAC) (all,j,SECT) XF(f,j) = ALPHAFAC(f,j)*Q(j)*XCOM(j)*W(j)/PF(f) ; EQUATION Price_formation # Unit cost index for industry j # ! (E3.1.12) in DPPW ! (all,j,SECT) PC(j) = Q(j)*W(j) ; EQUATION Numeraire #Numeraire for the model is price of commodity 1 (E3.1.23)# PC("s1") = 1 ; !-------------end of TABLO Input file-------------------------! BUILDING OR MODIFYING MODELS Page 3-43 Mixed, Linearized or Levels TABLO Input Files? 3.7 Mixed, Linearized or Levels TABLO Input Files? You are probably asking yourself which it is best to build - mixed, linearized or levels TABLO Input files. In our view, there is no single answer to this question; rather, the answer depends on your background and priorities. We believe that, for many models, mixed representations are easiest to understand (and perhaps to build); this is why we introduced the mixed version of Stylized Johansen first. Modellers who come from a background of levels or linearized models may find these sorts of TABLO Input files easier to work with. Perhaps the main thing to keep in mind is that it doesn't matter really which you build since (provided they are done correctly) they all produce the same results. From this point of view, the answer is to use whichever form comes most naturally to you. Another factor to keep in mind is the efficiency of the different implementations - that is, the speed with which they solve and the memory required to solve them. Our experience with ORANI-F, reported in section 5.3 of Harrison et al (1993a), found that the linearized implementation was more efficient than our mixed one. At this stage, we are not sure if this is true in general, and we hope to compare the efficiency of different implementations of other models. It is possible that mixed representations will become more efficient as modellers gain more experience in working with them. A fuller discussion of this whole question can be found in Harrison et al (1993a). Advice about linearizing equations by hand can be found in section A.2 of Appendix A in GPD-2. BUILDING OR MODIFYING MODELS Page 3-44 TABLO Linearizes Levels Equations Automatically 3.8 TABLO Linearizes Levels Equations Automatically When the program TABLO processes a TABLO Input file containing levels EQUATIONs and levels VARIABLEs, it converts the file to a linearized file; we refer to this as the associated linearized TABLO Input file. Although you may not see this associated linearized file (since the conversion is done internally by TABLO), you should be aware of some of its features. The most important feature of this conversion is that, for each levels VARIABLE, say X, in your original TABLO Input file, there is an associated linear VARIABLE whose name is that of the original levels variable with "p_" added at the start.* Also, for each levels VARIABLE in the original TABLO Input file, a COEFFICIENT with the same name as the levels VARIABLE is declared in the associated linearized TABLO Input file. It is important to realise that the rest of TABLO (the last part of the CHECK and all of the CONDENSE and CODE stages) proceed as if the associated linearized TABLO Input file were the actual TABLO Input file. This means that o warnings and error messages given by TABLO may refer to statements in this associated linearized file rather than in your original TABLO Input file. o when you carry out simulations by running GEMSIM or the TABLO-generated program from your model, you must refer to variables on the associated linearized file rather than the levels variables. (For example, when working with the mixed version of Stylized Johansen in section 3.3.2 above, you must say the p_XFAC is exogenous, not XFAC.) Other features of this conversion are explained in sections 2.2.1 to 2.2.3 of GPD-2. ___________________ * Actually this is not entirely accurate. If the levels VARIABLE is declared via a VARIABLE(LEVELS,CHANGE) statement (see section 4.3 below), the associated linear VARIABLE has "c_" at the start. BUILDING OR MODIFYING MODELS Page 3-45 Condensing Models 3.9 Condensing Models In many cases models need to be reduced in size before it is practical to solve the linearized equations C.z=0 (as in equation (1) of section 2.5.1 above). For example, with the ORANI model as in Dixon et al (1982), there are originally over a million equations, which it is impossible to solve directly even on large mainframe computers. The aim of condensation is to reduce the size (number of rows and/or columns) of this matrix C. There are two main ways of reducing the size of a model before attempting to solve it. The first is by substituting out variables (ones that are to be endogenous) and the second is by omitting variables (ones that are to be exogenous and not shocked in a group of simulations). We describe how you can use TABLO to do these in the subsections below. As you will have noticed, TABLO begins by checking your TABLO input file, reporting any errors it finds; we refer to this as the Check stage of TABLO. If there are no errors, you usually go on to the Code generation stage of TABLO. However, if you need to condense your model, you should choose to go on to Condensation (rather than Code generation) after the Check has been completed. Then go on to Code generation once you have carried out the condensation actions you desire. Note that, during the first stage of TABLO (the so-called Check stage), all levels EQUATIONs have been automatically linearized by TABLO and the resulting linearized equations only contain the associated linear variables (as described in section 3.8 above). All condensation is done in relation to these linearized equations and so involves only linear variables. 3.9.1 Substituting Out Variables Suppose you want to substitute out (linear) variable x (all components of it) using the (linearized) equation (ALL,i,COM) x(i) = A6(i)*y(i) + z(i). In carrying out the substitution for x, TABLO will replace every occurrence of a component of x in the other (linearized) EQUATIONs and any UPDATEs of the model by an expression of the form A6(i)*y(i) + z(i). For example, the equation (ALL,k,COM) B5(k)*(x(k) + y(k)) = 0 becomes (ALL,k,COM) B5(k)*([A6(k)*y(k)+z(k)] + y(k)) = 0. BUILDING OR MODIFYING MODELS Page 3-46 Substituting Out Variables An equation you nominate to be used in the substitution of a variable may need to be manipulated by TABLO into the form x = .... For example, in order to use it to substitute out variable x, TABLO rewrites the equation (ALL,i,COM) z(i) + A8(i)*x(i) = A10(i)*t3(i) as (ALL,i,COM) x(i) = [1/A8(i)]*[A10(i)*t3(i)-z(i)]. Of course this substitution would lead to a division by zero error if A8(i) were equal to zero for any commodity i. TABLO alerts you to this potential problem. o If you are running interactively, you are asked to confirm that coefficient A8(i) is never zero. If you answer that A8 can be zero the substitution is not made. o If you are running in batch mode (as defined in section 5.3.2 below), a warning message asking you to check that A8(i) cannot be zero is written to the terminal and to the Information file, and TABLO continues with the substitution. If you proceed with the substitution and some value of A8 is indeed zero, the error will be detected when you run the TABLO-generated program. In order to perform a substitution when running TABLO, you merely say which variable to substitute out and which equation to use; you can nominate the equation by giving its name or its number. Then TABLO automatically rewrites all the remaining EQUATIONs and UPDATEs. If you substitute out a variable with k components, this reduces by k the number of rows and the number of columns of the matrix in the system Cz=0 of equations to be solved. Because the variable substituted out no longer appears in any equations, it must be an endogenous variable. Also, you cannot see its values in any simulation, since it does not appear in the resulting Equations or Solution files. Example - Condensing Stylized Johansen A possible condensation of Stylized Johansen is given in Exercise 3.5 of DPPW, where, in the notation of our TABLO Input file in section 3.3.2 above, they suggest substituting out the variables p_XH, p_XC and p_XF using the equations House, Comin and Facin respectively. Since these variables have 2,4 and 4 components respectively, this reduces the number of rows and columns in the system each by 10, resulting in a 17 x 19 system. [The GEMPACK mixed implementation of the uncondensed model is of size 27 x 29, as shown in Table 2.5.1 above. In DPPW, the ten equations connecting dollar values to prices and quantities - that is, the equations (E8), (E9) and (E10) in section 3.1.1 above - are not shown explicitly. This is why Table E3.5.1 in DPPW, showing the Equations Matrix for the condensed system, only has size 7 x 9.] BUILDING OR MODIFYING MODELS Page 3-47 Substituting Out Variables We suggest that you make these substitutions with Stylized Johansen and then carry out a simulation with the resulting condensed model. Perhaps carry out the same simulation as in section 2.2 above and compare your results with those there. Of course, the results for endogenous variables remaining in the condensed system should be the same, except for possible rounding errors. Your responses in running TABLO could be as follows. User Input to TABLO to Condense Stylized Johansen __________________________________________________________________ (First the Check) ! Default options sj ! Name of TABLO Input file sjcond ! Name of Information file ('COND' for condense) (Next Condensation) c ! do condensation s ! substitute p_xh ! variable p_XH (case does not matter here) house ! using equation House s ! substitute p_xc ! variable p_XC comin ! using equation Comin s ! substitute p_XF ! variable p_XF facin ! using equation Facin e ! exit from condensation (Finally, Code generation) a ! Automatic Code generation pgs ! Prepare output for GEMSIM ! other default code options sjcond ! Name of GEMSIM Auxiliary files ______________________________________________________________________ End of User Input to TABLO to Condense Stylized Johansen Notice that we suggest using SJCOND as the name of the GEMSIM Auxiliary files (to distinguish them from the ones called SJ produced from Step 1 in section 2.2 above).** Then continue with Steps 2 and 3 as in section 2.2 above. However, you may find it best to use SJCOND (rather than SJ) for the names of various files, such as the Equations file, to avoid confusion with the corresponding files for the uncondensed model. Of course you must not specify p_XH to be printed when running GEMPIE (see section 2.2.4 above) since p_XH is not present in the condensed version of the model. More details about substituting out variables in general can be found in section 2.3 of GPD-2. In particular, this states the precise _________________ ** Indeed, if you give the name SJ here, on many machines the new files SJ.GSS and SJ.GST will overwrite (that is, delete) the original ones produced in Step 1 of section 2.2. Similar considerations apply to our choice of SJCOND as the Information file name. BUILDING OR MODIFYING MODELS Page 3-48 Substituting Out Variables conditions under which a given equation can be used to substitute out a particular variable. 3.9.2 Backsolving for Variables When you substitute out a (linear) variable, it is eliminated from all (linearized) equations in the condensed system and its values are not calculated (and so cannot be reported) when you carry out a simulation. In principle, the values of a variable substituted out could be calculated after each step of a multi-step simulation by substituting the values of variables in the condensed system into the expression used to substitute out the variable in question. For example, if variable x has been substituted out using the equation (ALL,i,COM) x(i) = A6(i)*y(i) + z(i) and if variables y and z remain in the condensed system, after each step of a multi-step simulation, we could calculate the values of x(i) by substituting in the known values of A6(i), y(i) and z(i) into the right-hand side of the equation above. This is known as backsolving for variable x. When you substitute out a variable, you can indicate that you may want to backsolve for its simulation values. Follow the same procedure as described in section 3.9.1 above except that you initiate the substitution by responding 'b' (backsolve) rather than 's' (substitute); then you give the name of the variable and of the equation to use, as before. When you do this, the variable and equation in question are still eliminated from the condensed system. However, when you carry out a simulation using GEMSIM or the relevant TABLO-generated program, you can elect (when choosing the cumulatively-retained endogenous variables) to have the values of the variable in question calculated (by backsolving). Backsolving, which is done at each step of a multi-step simulation, is carried out after the LU decomposition and after values of variables in the condensed system have been solved for, but before the updates of the data are done. Of course variables to be backsolved for must be endogenous. When you choose the closure and shocks, these variables are not available (and must not be referred to). But, when you choose the set of cumulatively-retained endogenous variables, these are present and you can say (for each simulation) which components (if any) of these variables you want retained on the Solution file. If no components of a backsolved variable are retained, the calculation is speeded up slightly since the calculations to backsolve for it are omitted at each step. Note that variables marked for backsolving are eliminated from the condensed system and so do not appear in the Equations file. For this reason, if you carry out a Johansen simulation using SAGEM, the values of such variables cannot be calculated (or reported). They are only available if the simulation is carried out using GEMSIM or the appropriate TABLO-generated program. BUILDING OR MODIFYING MODELS Page 3-49 Backsolving for Variables Example - Stylized Johansen We suggest you carry out again the condensation of Stylized Johansen described in section 3.9.1 above, but this time indicate that you may want to backsolve for variables p_XH and p_XC. To do this, proceed as above but replace the relevant two 's' responses by 'b'. When you run GEMSIM, if you select all available variables to be cumulatively-retained endogenous, you will see that the values of the backsolved variables appear on the Solution file (and on the Extrapolation Accuracy file). Should All Substitutions be Backsolves? When you substitute out a variable, this reduces the size of the condensed system irrespective of whether you say you want to be able to backsolve for it. The calculations to backsolve for it are only done if you choose to have at least one of its components retained on the Solution file. From these points of view there is little cost in saying you want to retain the possibility of backsolving for all variables substituted out. However you should be aware that marking a variable for backsolving rather than straight substitution does increase the amount of memory required by GEMSIM or, if you choose to use a TABLO-generated program, the size of the program and the memory it requires. For this reason, it is best to mark for backsolving only variables you think you will need to report. 3.9.3 Omitting Variables If, in a group of simulations, all components of a (linear) variable x(i) are to be exogenous and not shocked, all values (changes or percentage changes) in the linearized equations will be zero. Hence all terms in this variable could be omitted from all the linearized equations of the model. This is the idea behind omitting variables. If you omit a variable with k components, this reduces the number of columns in the matrix C by k (but does not change the number of rows). To omit several variables during the condensation stage of TABLO, just respond 'o' (Omit) at the appropriate stage, then, when prompted, give the names of the variables to be omitted, one per line. When you come to the end of the list of variables to omit, enter a (further) carriage-return. TABLO automatically rewrites all EQUATIONs (and UPDATEs) by omitting all occurrences of this variable.* _________________ * TABLO also offers you the option of "absorbing" variables (as described in section 2.3.3 of GPD-2). In our view this option is essentially redundant since omitting them should be preferred. Although we have left absorption as an option to provide upwards-compatability from older versions of GEMPACK, we encourage users who may have used it in the past to switch to omitting the variables which they previously absorbed. BUILDING OR MODIFYING MODELS Page 3-50 Omitting Variables If, in another group of simulations, these omitted variables are to be shocked (or made endogenous), simply carry out a different condensation in which these are not omitted (but perhaps others are). When you decide to omit a group of variables, we suggest that you make this omission the first condensation action when you run TABLO. This will make the rest of your condensation actions simpler and so they will run slightly more quickly than if you had left the omissions until later.** 3.9.4 Stopping and Restarting TABLO Although it is usual to carry out all processing (Check, Condense, if required, and Code generation) of a TABLO Input file in a single run of TABLO, it is possible (and sometimes desirable) to stop after one of these stages and, later, to rerun TABLO starting from where you left off. When you stop after one of these stages, TABLO saves the results so that, when you resume, you do not have to repeat the processing already carried out. The savings are only worthwhile for large models; for small models it is best to always start from the Check. For example, for a very large model, it may be desirable to carry out different condensations for different groups of simulations. In this case, it is a good idea to exit from TABLO after the Check. Then restart TABLO (telling it to start at the Condensation stage), carry out the first condensation and then generate code for this version of the model. Finally, repeat this for the second condensation. When you exit from TABLO after the Check or Condensation stages, TABLO saves the results on two binary files (a TABLO Record file and a TABLO Table file). Together these make up what TABLO refers to as an implementation. These two files take their names from that of the Information file but they have different suffixes; the TABLO Record file usually has suffix '.TBR' while the TABLO Table file usually has suffix '.TBT'. You can further condense a model that has been partly condensed if you exited from TABLO after Condensation the first time. Simply start again at Condensation and carry out the extra condensation actions (using the implementation saved after the first condensation). _________________ ** As part of the fine print associated with omitting variables, note that TABLO may carry out some substitutions automatically as a result of an omission. For example, suppose that there is an equation saying (all,i,COM) x(i) = A(i)*y(i) If you tell TABLO to omit variable 'y' then, after this omission, this equation reads x(i) = 0 for all commodities; in this case TABLO recognises that all components of variable 'x' must also be zero and TABLO automatically makes this substitution in the rest of the equations (without waiting for you to say whether you want this done). In such cases, the Information file makes it clear that this substitution has been carried out. BUILDING OR MODIFYING MODELS Page 3-51 Stopping and Restarting TABLO Example Suppose you have a large model with TABLO Input file MODEL.TAB and you want to have two different condensations. First run TABLO, giving the inputs shown below, exiting after the Check.* User Input to Carry Out Just the Check _______________________________________________________________ ! Default options model ! TABLO input file name model ! Information file and Implementation name e ! Exit after the Check _________________________________________________________________ End of User Input to Carry Out Just the Check After this you will have files MODEL.TBR and MODEL.TBT. Then you can carry out the first condensation as follows. Notice that you tell TABLO to start at Condensation by selecting option 'F2' from the options presented at the start of TABLO. User Input to Do Just Condensation and Then Code Generation ____________________________________________________________________ F2 ! Start at Condensation ! End of option selection model ! Implementation name (see above) (TABLO checks to see that MODEL.TBR and MODEL.TBT exist and have the expected form.) model_c1 ! Information file for condensation 1 (hence 'c1') c ! Start Condensation s ! Substitute (for example) (We omit the actual condensation actions, which may consist of several substitutions and/or omissions. When the last one has been done, continue as shown below.) e ! Exit from Condensation a ! Go on to Code generation pgs ! Prepare output for GEMSIM ! Other default code options model_c1 ! Name of GEMSIM Auxiliary files ____________________________________________________________________ End of User Input to Do Just Condensation and Then Code Generation Note that the name of the GEMSIM Auxiliary files (or of the TABLO-generated program if you choose that option) should reflect the _________________ * Alternatively you could tell TABLO to stop after Check by selecting option 'L1' (last stage is Check) as your first response. Then you would not need the 'e' response at the end. BUILDING OR MODIFYING MODELS Page 3-52 Stopping and Restarting TABLO condensation you have carried out, which is why we used the name 'MODEL_C1' above. Then, for the second condensation, proceed as above except that you should choose different names (perhaps 'MODEL_C2') for the Information file and GEMSIM Auxiliary files or TABLO-generated program produced. Note that you can only start at Condense or Code generation if you have already carried out and exited after the previous stage(s) and have retained the TABLO Record and Table files produced. Otherwise you will have to start again from the Check. CHAPTER 4 GEMSIM AND TABLO-GENERATED PROGRAMS 4.1 Actions in GEMSIM and TABLO-generated Programs When you build a model in GEMPACK you write down the theory in the TABLO Input file for your model. When you run TABLO, you can choose either to produce output for GEMSIM (the GEMPACK Auxiliary files) or to produce the Fortran program which we call the TABLO-generated program for your model. When you run GEMSIM or this TABLO-generated program and attach the data, it can carry out various actions (see Figure 4.1). If the TABLO Input file for your model contains levels EQUATIONs, levels VARIABLEs and/or UPDATE statements, the most important action is that of carrying out a (possibly multi-step) simulation with the model (the first case illustrated in Figure 4.1). This also produces updated data files and other potentially useful files (including Equations and Base Coefficient Values files). For example, for the TABLO Input file for the Stylized Johansen Model given in section 3.3.2, the database on file "iodata" is updated to contain the new values after the simulation. If, on the other hand, the TABLO Input file for your model contains linearized EQUATIONs but no levels EQUATIONs, levels VARIABLEs or UPDATE statements (so that you are only able to carry out Johansen simulations with the model), the most important action is that of creating the Equations file for the model (the second case illustrated in Figure 4.1). This Equations file is then the starting point from which you can carry out Johansen simulations by running the program SAGEM. Of course, in this case, when there are no UPDATEs either explicit or generated by levels variables, you do not get any updated data files. Note that, in this case, GEMSIM or the TABLO-generated program do not carry out the simulation but only create the Equations file. You must then run SAGEM to carry out a simulation. In either of the two cases above, other possible actions are those of doing the DISPLAYs or WRITEs (if there are any) in your TABLO Input file. Unless you directed otherwise (via the options menu at the start of the CODE stage of TABLO - see section 5.10 of GPD-2), GEMSIM and/or the TABLO-generated program are capable of carrying out all the actions in the TABLO Input file. When you run either GEMSIM or the TABLO-generated program, it will normally carry out all of these actions. However, by selecting one or more of the options from the menu presented when you start it running, you can choose to do only GEMSIM AND TABLO-GENERATED PROGRAMS Page 4-2 Program Actions Figure 4.1 goes on this page GEMSIM AND TABLO-GENERATED PROGRAMS Page 4-3 Program Actions some of the possible actions. For example, you may wish to ignore the DISPLAY statements and just carry out a multi-step simulation. If so, select the option NDS when you run GEMSIM or the TABLO-generated program. Of course, equations are essential for a simulation and so, if you select the option NEQ ("Do no equations"), this means that no simulation will be carried out either, and the only actions possible are WRITEs or DISPLAYs. Sometimes TABLO Input files are created for data manipulation rather than for modelling (see section 3.4.3 above for an example). In this case there are no EQUATIONs (and hence no VARIABLEs or UPDATE statements) and the only possible actions are DISPLAYs and WRITEs (the third case illustrated in Figure 4.1). The WRITEs are usually the main actions since they can produce new (or modified) data files. Again, if the program is capable of doing some WRITEs and some DISPLAYs, you can elect, in any one run of the program, to do just the WRITEs or just the DISPLAYs. We describe in section 4.2 below how GEMSIM and TABLO-generated programs carry out multi-step simulations. In section 4.3 we tell you how you can carry out simulations on machines on which GEMPACK is not installed, and, in section 4.4, we say a little about the amount of memory required by TABLO-generated programs. More information about GEMSIM and TABLO-generated programs can be found in chapter 5 of GPD-2. 4.2 How These Programs Carry Out Multi-step Simulations Each step of a single multi-step simulation consists of five main parts: (i) reads and calculations of formulas, (ii) calculation of equations (one submatrix at a time), (iii) the simulation part, (iv) backsolving (if required), (v) updating the data. (See Figure 4.2 for these parts, some of which are shown there in a little more detail.) For a Johansen simulation, each of the above is done just once. For a single N-step simulation, each is done N times if you are using Euler's method or the midpoint method while each is done (N+1) times if you are using Gragg's method.* If you are extrapolating on the basis of two or more multi-step solutions, each solution is calculated (first the one with the smaller number of steps, then the one with the next most, and so on). _______________________ * The output from GEMSIM and TABLO-generated programs distinguishes between "steps" and "passes". Thus a 6-step Gragg does 7 passes. GEMSIM AND TABLO-GENERATED PROGRAMS Page 4-4 How These Programs Carry Out Multi-step Simulations Figure 4.2 goes on this page GEMSIM AND TABLO-GENERATED PROGRAMS Page 4-5 How These Programs Carry Out Multi-step Simulations Finally, the extrapolation is carried out. This involves taking an appropriate linear combination of the different solutions (and updated data bases). Normally DISPLAYs and WRITEs are only done during part (i) of the first step of the first multi-step solution, when values written or displayed reflect values in the original data. In an N-step simulation, the shocks are broken into N equal parts. In step number K, the formulas and equations are calculated on the basis of the data as updated after step K-1 (if K is at least 2, or the original data if K=1), and the effect of applying just the part of the shock relevant to this step is calculated; this gives a solution, say y(K) for just these shocks. (See below for more explanation as to how y(K) is calculated.) This solution y(K) is added to the combined solution x(K-1) before this step to produce the combined solution x(K) after K steps. [x(K) reflects the movements in the endogenous variables corresponding to just K Nths of the total shocks.] Thus, x(1) = y(1) step 1 x(2) is obtained from x(1) and y(2) x(3) is obtained from x(2) and y(3), and so on. We give a concrete example in section 4.2.1 below. At the end of each step the data is updated on the basis of the step solution y(K). Specifically, the solutions in y(K) are applied to the updated data after step K-1 to produce the updated data after step K. This data is the starting point for step K+1 (or is the final updated data at the end of this multi-step simulation if this is the last step). At step K, the linear equations (based on the data at the start of this step) are formed up as C(K).z = 0 much as in equation (1) of section 2.5.1 above. Note that, in a multi-step simulation, the Equations Matrix C changes from step to step reflecting the changes in the data as it is updated, which is why we use the notation C(K) above. Then, taking account of the closure and of the shocks for this step, the equations are expressed as A(K).y(K) = b(K) much as in equation (3) of section 2.5.2 above. Here the LHS matrix A(K) and the RHS vector b(K) depend on K as does the solution y(K) for this current step. These equations are solved as described in section 7.5 below: first the LU decomposition of A(K) is carried out (this is the time-consuming part) and then the values of y(K) are calculated. The solution y(K) is normally made as accurate as possible by using iterative refinement (see section 7.5 below). Note that, if you condensed your model, some backsolving may be done even if you didn't explicitly ask for the values of any eliminated (endogenous) variables to be calculated. These are done if they appear to speed up the updates (which are done after backsolving). GEMSIM AND TABLO-GENERATED PROGRAMS Page 4-6 Results of a 4-step Simulation Looked at in Detail 4.2.1 Results of a 4-step Simulation Looked at in Detail In this section we look at the results of the 4-step version of the simulation carried out in section 2.2 above. This is the simulation with Stylized Johansen in which the supply of labor is increased by 10%. We show how the shock for each of the steps is calculated, and show how the final results for certain endogenous variables are built up from the results of the individual steps. Note that it is not necessary to understand this in order to carry out multi-step simulations with GEMPACK, so you may well prefer to skip this section at present. The results discussed in this section are those obtained using Euler's method. (Gragg's method or the midpoint method would give different results.) (a) How the Shock is Broken Up Imagine that the initial supply of labor is 100 units; we show how the 10% shock to it is broken up into the shock for each of the 4 steps.* Over the whole simulation, the labor supply must increase by 10%, that is, from 100 to 110, which is an overall increase of 10 units. The shocks at each step are always calculated to ensure that the same increase (in levels) occurs at each step. Thus, at each step, the supply must increase by 2.5 (=10/4) units. In step 1, supply must increase from 100 to 102.5 which is an increase of (25/100)x100=2.5%. In step 2, supply must increase from 102.5 (its value after step 1) by a further 2.5 units to 105 units; this is an increase of (25/102.5)x100=2.439%. Similarly in step 3 the increase is (2.5/105)x100=2.381% while in step 4 it is (2.5/107.5)x100=2.326%. Supply Supply Step at start Increase at end % Increase 1 100 2.5 102.5 2.5 2 102.5 2.5 105 2.439 3 105 2.5 107.5 2.381 2 107.5 2.5 110 2.326 _____________________________ * The assumption about the initial supply being 100 is, in fact, irrelevant here. You can easily check this by replacing 100 by some other number (perhaps 4, which would be the supply for the data in Table 2.2.1a if the price is one dollar per unit). GEMSIM AND TABLO-GENERATED PROGRAMS Page 4-7 Results of a 4-step Simulation Looked at in Detail (b) Calculation of Results for Endogenous Variables Consider first what happens to just one of the endogenous variables, namely p_XH("s1"), as these four partial shocks are applied to the model. In the first step, the levels variable XH("s1") increases by 1.5%. For simplicity (again this makes no difference to the final outcome) we suppose that the initial value of the Levels variable XH("s1") = 100 as well. After the first step, XH("s1") = 101.5 units.** In the second step, in response to the 2.439% shock to XF("s1"), the increase in XH("s1") = 1.463%, the updated value of the levels variable XH("s1") is calculated from XH("s1") = 101.5 * (1 + 1.463/100) = 102.985 units an increase in the combined solution of 2.985%. In the third step, in response to the 2.381% shock to XF("s1"), the increase in XH("s1") = 1.429%, and so the levels variable XH("s1") is updated to XH("s1") = 102.985 * (1 + 1.429/100) =104.457 In the fourth step, in response to the 2.381% shock to XF("s1"), the increase in XH("s1") = 1.395%, and so the levels variable XH("s1") is updated to XH("s1") = 104.457 * (1 + 1.395/100) =105.914 an overall increase in the four steps of 5.914%. Using the notation from section 4.2 above, namely letting y(K) denote the step solution at the Kth step, and x(K) the combined solution after K steps, the results for p_XH("s1") are summarised in the following table. Step y(K) x(K) 1 1.5 1.5 x(1) = y(1) 2 1.463 2.985 x(2) calculated from x(1) and y(2) 3 1.429 4.457 x(3) calculated from x(2) and y(3) 4 1.395 5.914 x(4) calculated from x(3) and y(4) Thus the 4-step simulation result for the variable p_XH("s1") (in response to the 10% shock to XF("s1")) is 5.914%. This is the result for the 4-step Euler solution (not the extrapolated solution) as shown on the Extrapolation Accuracy file SJLB.XAC produced in section 2.2.3 above. ___________________________ ** Note that, as you would expect, in the first step, the 1.5% increase in XH("s1") is exactly one quarter of what it would be in the corresponding 1-step simulation (namely 6.0%, as you can see by looking at the 1-step column in the Extrapolation Accuracy file SJLB.XAC produced in section 2.2.4 above) since the shock is exactly one quarter. GEMSIM AND TABLO-GENERATED PROGRAMS Page 4-8 Results of a 4-step Simulation Looked at in Detail The table below shows the same information for the endogenous variable p_XH("s2"). Step y(K) x(K) 1 1.75 1.75 x(1) = y(1) 2 1.707 3.487 x(2) calculated from x(1) and y(2) 3 1.667 5.212 x(3) calculated from x(2) and y(3) 4 1.628 6.925 x(4) calculated from x(3) and y(4) Thus the 4-step Euler simulation for the variable p_XH("s2") (in response to the 10% shock to XF("s1")) is 6.925%. 4.3 Carrying out Simulations on Other Machines Once you have built a model, you can move it and the software for carrying out simulations with it, to other machines with the same operating system but on which GEMPACK is not installed. For a model solved using GEMSIM, this means that you must copy the executable image of GEMSIM and the model's Auxiliary Statement and Table files (these usually have suffixes '.GSS' and '.GST') to the other machine. For a model solved with a TABLO-generated program, you must copy the executable image of the program (this often has suffix '.EXE') and also copy the Auxiliary Statement and Table files (these usually have suffixes '.AXS' and '.AXT' respectively) to the other machine since the TABLO-generated program will not run without them. Of course you will also need to copy any data files used in the simulation, and any relevant Command files or Stored-input files. You can also copy the executable image of GEMPIE to the other machine in order to produce human readable output from your simulation. However you cannot move other GEMPACK programs to a machine on which GEMPACK is not installed because these programs need to access the GEMPACK Licence file and to have other operating system features set up appropriately. Note that, because the Auxiliary Statement and Table files are binary files, you cannot move TABLO-generated programs produced on one type of machine (for example, a Unix machine) directly to another type of machine (for example, a Macintosh). Rather, to move a model from one type of machine to another on which GEMPACK is installed, follow the procedure described in section 8.4 below (which involves transferring the TABLO Input file and the data files). 4.4 Memory Required by TABLO-generated Programs Memory constraints may become a problem on PCs. If so, TABLO has options (documented in section 5.10.2 of GPD-2) for reducing the amount of memory required by TABLO-generated programs, usually at the cost of increasing their execution time. Suggestions for dealing with memory constraints are given under the heading "Advice on Which of These to Select" near the end of section 5.10.2 of GPD-2. There are not corresponding "low memory" options for GEMSIM. CHAPTER 5 COMMON FEATURES OF GEMPACK PROGRAMS Although the different GEMPACK programs are designed for carrying out different tasks, they all follow certain conventions and operate in similar ways, as explained in this chapter. For example, they process your responses to prompts in a consistent way (see section 5.1), they all allow comments starting with a single exclamation mark in input from the terminal (see section 5.2), and they all offer standard options (such as the ability to direct output to a Log file) as explained in sections 5.3 and 5.4. The procedure by which you increase the amount of memory available to a program is explained in section 5.5 while section 5.6 describes the GEMPACK error reporting scheme. Section 5.7 gives advice about identifying and correcting syntax errors in GEMPACK Command files. 5.1 Responding to Prompts When you are asked to respond to a prompt or to make a choice from a menu, the case (upper or lower) of your response usually makes no difference. For example, if you are asked to say which variable you have in mind, responses of 'p_xf' or 'p_XF' or 'P_XF' will have the same effect. Similarly, if you are asked to respond [y/n] it does not matter whether you respond "y" or "Y". On most systems (but not on Unix systems), the case in which you enter file names makes no difference. Some input to GEMPACK programs (such as the "verbal description" of a simulation) is case-sensitive, of course. (In such cases the normal mix of upper and lower case letters as in a document such as this one seems the best and most readable.) 5.1.1 Default Response to Questions and Prompts Many of the questions asked by the programs have a default response. Often this is indicated by one possible choice shown as a capital letter as in Do you wish to try again? [Y/n] where the default choice is 'Y' (meaning yes). Sometimes the default choice is mentioned explicitly in the prompt. In all cases where a default is offered (either explicitly or via a response shown as a capital letter) you can accept this default by entering a carriage-return. COMMON FEATURES OF GEMPACK PROGRAMS Page 5-2 Comments in Input from the Terminal 5.2 Comments in Input from the Terminal In processing terminal input, all GEMPACK programs ignore any part of an input line starting with a single exclamation mark '!'. Since input on a Stored-input file is treated as if it were input from the terminal, this also applies to Stored-input files. We recommend a liberal use of comments (beginning with a single '!') to make Stored-input files self-documenting (and also easier to modify). Since terminal input is echoed exactly (that is, including any comments) by the programs, this also makes any LOG file self-documenting. Note that, unlike TABLO Input files, a comment in terminal input does not need a finishing !. Each comment finishes at the end of the line it starts on (though it can be continued by putting ! at the start of the next line). When the program is expecting character input (such as a file name or choice of one of a set of options), it ignores any line with ! in the first column. But if you put one or more spaces at the start of the line and then '!', the program treats this as input of one or more blank characters as in ! default program options If you actually want an exclamation mark (for example, in the verbal description), just put in a pair !!, which will be treated as one and the rest of the line will still be read. 5.3 Interactive and Batch Operation, Stored-input and Log Files By default all GEMPACK programs operate in an interactive mode in which the program prompts you for information and you respond by typing at the terminal. If your input is judged by the program to be invalid, the program offers an explanation and then gives you a chance to input a different response. This is most appropriate when the program in question requires only a relatively small amount of user input. When large amounts are required, responding at the terminal can be time-consuming and error prone. Equally importantly, it can then be difficult (perhaps impossible) to reproduce your results or be sure after the event as to exactly what your results mean. For these reasons it is often important to be able to run the programs by first preparing (on a Stored-input file) all the input required and then using this file to run the program. We refer to this as running the program in batch mode. Most operating systems provide their own ways of running programs in batch mode. (For example, on DOS PCs or on Unix machines, you can use input redirection such as sagem < sjlb.sti to run the program SAGEM, taking input from file 'sjlb.sti'.) COMMON FEATURES OF GEMPACK PROGRAMS Page 5-3 Interactive and Batch Operation, Stored-input and Log Files GEMPACK contains a facility (independent of the operating system) whereby any of its programs can be instructed to take their input from a Stored-input file. This is done via the options which are presented at the start of the run of every GEMPACK program. When you start a program running you can select one of several options including the following: ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ GEMPACK OPTIONS ( --> indicates those in effect ) BAT Run in batch STI Take inputs from a Stored-input file BPR Brief prompts SIF Store inputs on a file LOG Output to log file ASI Add to incomplete Stored-input file Select an option : Deselect an option : - Help for an option : ? Help on all options : ?? Redisplay options : / Finish option selection : Carriage return Your selection > _____________________________________________________________________ Options Screen for GEMPACK Programs To take inputs from a Stored-input file, respond (upper or lower case is fine) sti Then you will be asked for the name of the Stored-input file. Once you have entered this, the program takes all of its input from this file and only returns control to the terminal once it has finished running. As you can see from the menu above, GEMPACK programs also offer you an operating-system-independent way of creating a Log file of your run. Just select option log after which you will be prompted for the name of the Log file. If you are running the program interactively, screen output from the program will come to the terminal screen as well as going to the Log file. Note that GEMPACK programs always echo your input so that this will also show on the Log file. If you are also taking your input from a Stored-input file, you can select option 'log' first and then option 'sti' second (or, alternatively, put 'log' followed by the Log file name at the start of your Stored-input file). In this case where both log and sti are chosen, you also must choose whether output from the program will only go to the Log file, or to both the Log file and to the screen. Full details are given in section 5.3.3. When a program requires large amounts of input it can be difficult to anticipate the order of the responses required, making the preparation of Stored-input file difficult. GEMPACK provides two options to assist you in this. Firstly the option COMMON FEATURES OF GEMPACK PROGRAMS Page 5-4 Interactive and Batch Operation, Stored-input and Log Files sif which stores your inputs on a file (which can be reused as a Stored-input file) as you run the program interactively. Secondly there is the option asi which lets you add to an incomplete Stored-input file. In this case the program takes its inputs from the Stored-input file you specify and then, when it comes to the end of this file, transfers control to you so you can continue running the program interactively. While this is going on, all your interactive responses are added to the Stored-input file. (Suppose,for example, you have a Stored-input file that runs a multi-step simulation with a model and you wish to change the shocks. Just edit this file to remove the shock part of the file. Then run the program under option 'asi'. When it comes to the shock part of the input you will be able to add it interactively and have your responses recorded on the new Stored-input file.) When you are running from a Stored-input file (or, more generally, in any form of batch mode), you are not in a position to correct input the program judges to be invalid. It is appropriate for the program to stop with an error message whenever invalid input is encountered (rather than running to completion and possibly producing results which may be quite different from what you wanted). All the programs stop after invalid input if the option 'sti' has been selected. If you are running in batch mode in some other way (perhaps operating-system-dependent) you will probably want the program to stop if it encounters invalid input. To achieve this you should select the option bat when starting the run. (If you select option 'sti', option 'bat' is selected automatically. Option 'bat' is also selected automatically if you select option 'cmf' when running SAGEM or a TABLO-generated program. But if you are running in batch mode via an operating-system-dependent means such as DOS or Unix redirection of input, 'bat' is not selected automatically; you must select it if you want its properties.) 5.3.1 Invalid Input When Using Options 'sif' or 'asi' When you are storing inputs on a file (option 'sif') or adding to an incomplete Stored-input file (option 'asi'), the file you are creating is intended for use as a Stored-input file (under option 'sti') and so must not contain invalid input (as explained above). Accordingly, when you select either of the options 'sif' or 'asi', option 'bat' is also selected automatically. This means that, if you enter input judged by the program to be invalid, the program will stop with an error (probably "Unexpected input in batch mode"). To continue, proceed as follows. (a) Edit the Stored-input file partly created, taking out the last line (the one containing the invalid input). COMMON FEATURES OF GEMPACK PROGRAMS Page 5-5 Invalid Input When Using Options 'sif' or 'asi' (b) Rerun the program this time selecting option 'asi' (even if you were previously running under 'sif'). When the program reaches the place just before it stopped, it will transfer control to you and you can give a valid response this time and continue running it. 5.3.2 Differences Between Batch and Interactive Program Dialogues In this subsection, batch mode means once one of the GEMPACK options 'bat', 'sti', 'sif' or 'asi' has been selected. (It does not include cases such as DOS redirection of input when 'bat' is not selected in the Stored-input file.) In most cases the dialogue between you as user and the program is exactly the same whether you are running the program interactively or in batch mode. However the dialogue is different in a small number of clearly identified cases, all of which follow the idea that, in batch mode, the programs do not ask you to confirm something that has been set in train by your previous responses. The main examples you should be aware of are as follows. o In MODHAR once you have given the new history information, you will not be asked in batch mode whether this is what you want. o In TABLO-generated programs or GEMSIM, when the closure choice is begun, if you respond 'g' to give up, you will not be asked to confirm this when in batch mode. o In the condensation phase of TABLO, if the coefficient of the substituted variable is a complicated expression, you will not be asked in batch mode whether you are sure this coefficient will never be zero. o In the condensation phase of TABLO, if you are omitting or absorbing several variables, you will not be asked in batch mode to confirm that you want to continue with this omission/absorption. 5.3.3 Terminal Output and Log Files When output is going to a Log file and input is being taken from a Stored-input file or a GEMPACK Command file, you may or may not want output also to go to the terminal. GEMPACK allows you to specify this as described below. COMMON FEATURES OF GEMPACK PROGRAMS Page 5-6 Terminal Output and Log Files (1) If, during the Options selection, you select option 'log' and later select option 'sti' or option 'cmf'*, before you are asked for the name of the Stored-input file or Command file to take input from, you will be asked if you want output to go to the terminal as well as to the Log file. (The default response is 'B' meaning output to both the terminal and log file.) (2) If, during the Option selection, you select option 'sti' and later select (in your Stored-input file) option 'log', before you are asked for the name of the Log file you will be asked if you want output to go to the terminal as well as to the Log file. (The default is again 'B' meaning output to both.) Hence in your Stored-input file you should have the following lines log ! Output to go to Log file B ! B (both terminal and Log file) or L (log only) ! specify the name of the Log file (3) If, during the Options selection, you select option 'cmf' and have previously not selected option 'log', then you can direct output to a Log file by putting the command log file = ; in your command file. In this case, by default, output will also go to the terminal. However, if you put the command log only = ; into the Command file, this will suppress terminal output and output will go only to the Log file. 5.4 Other Program Options The final standard option common to all GEMPACK programs is bpr for selecting brief prompts. This affects the prompts in situations where sets of variables are being chosen (such as in SAGEM, GEMSIM or TABLO-generated programs), and in MODHAR, as well as in a few other places. You might like to select this option once you are familiar with the various operations of the program in question. Some GEMPACK programs have other options (which vary from program to program). The meaning of these options should be clear from the brief description of the option (at least once you are familiar with _________________ * Option 'cmf' is the option which indicates that you wish to take input from a GEMPACK Command file (see sections 2.2.3, 2.3.1 and 2.4 above). It is only available when running SAGEM, GEMSIM or a TABLO-generated program. COMMON FEATURES OF GEMPACK PROGRAMS Page 5-7 Other Program Options the operation of the program in question). You can obtain Online Help screens about these options when running the program interactively from the options Menu. If you respond '??' you get information about all options. If you respond with a '?' followed by the 3-character abbreviation of an option, you receive information about that option. For example to get help on option LOG, type '?LOG'. Options for GEMSIM and TABLO-generated programs are documented in sections 5.3-5.9 of GPD-2. Options for SAGEM and GEMPIE are described in section 7.6 of this document. Some of the options for other GEMPACK programs are documented in chapter 8 below. The method of selecting options is the same for all programs (and the same whether the option is one of those common to all programs or specific to just one program). You select options by typing in their 3-character abbreviation, for example type "LOG" to select the option LOG. You can deselect an option by typing a minus sign '-' followed by its 3-character abbreviation, for example type "-LOG" to deselect LOG. You can display the current options selected by typing '/'. Once you have finished option selection you continue to run the program proper by entering a carriage-return. In fact this is usually all you will do since the default options are the most commonly used. 5.5 Increasing Parameters When you run one of the programs, you may receive a message such as that shown below saying that the value of one of the program parameters must be increased. ** STOP because must increase the parameter 'MMTVEC' from its current value of 170 to at least 193. (ERROR RETURN FROM ROUTINE: INCPAR) (ERROR RETURN FROM ROUTINE: SAGEM) This message indicates that some aspect of your model has become too large for the program you were running (as this program is currently configured). Provided you have a source-code licence for GEMPACK* and there is enough memory on your computer, it is easy to reconfigure the program. All you have to do is edit the source code of the main program in question, changing the relevant value, and then recompile and relink the program. For the example above, edit the source code of SAGEM (usually called SAGEM.FOR), looking for the line (or part of line) of the form _________________ * If you only have executable images of the GEMPACK programs, you will not be able to reconfigure the programs. Either you must reduce the size of the relevant part of your model, or else upgrade to a source-code licence for GEMPACK. COMMON FEATURES OF GEMPACK PROGRAMS Page 5-8 Increasing Parameters PARAMETER(MMTVEC=170) and change the '170' to '193' or a larger value. (If the message says to increase the parameter by at least one, you should increase it by more since the program probably cannot tell exactly how much it needs to be increased.) To recompile and relink the program, consult your machine-specific GEMPACK documentation (or consult your GEMPACK Manager). (On multi-user systems, your GEMPACK Manager may have to do the editing, recompiling and relinking.) Note that the programs TABLO and GEMSIM are different from the others in this respect. The parameters are set in the TABLO and GEMSIM INCLUDE files (rather than in the source of TABLO or GEMSIM themselves); for details, see section 2.4 of GPD-2 for TABLO and section 5.13.1 of GPD-2 for GEMSIM. Recompiling and relinking TABLO or GEMSIM is more complicated than for the other programs; again consult your machine-specific documentation and/or your GEMPACK Manager. The procedure for increasing parameters in a TABLO-generated program is described in section 5.13.2 of GPD-2. 5.6 Error Messages When a GEMPACK program encounters an error it regards as fatal, it gives some explanation and then stops with a trace-back which shows the error message and the subroutines active when the error was encountered. Usually you can concentrate on the explanation and disregard the trace-back. (You should take note of the trace-back information if you think the fatal error indicates a bug in the program.) An example is given below. (ERROR RETURN FROM ROUTINE: ANSCK) (E-Unexpected choice in batch) (ERROR RETURN FROM ROUTINE: CHSSL) (ERROR RETURN FROM ROUTINE: SAGEM) (The traceback shows that the error "E-Unexpected choice in batch" occurred in subroutine ANSCK which had been called by subroutine CHSSL which had been called in turn by the main program SAGEM.) GEMPACK programs contain many internal cross-checks to guard against coding errors. If one of these fails, you will see the following message. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% A fatal error has occurred while running this program. This is probably the result of an internal program error. Please notify the suppliers of the code about this error. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% If this happens, it probably indicates a bug in one of the GEMPACK routines or programs. Please record all relevant details (such as the program you are running, the inputs you made, which files were accessed) and preserve copies of all files (including Stored-input and Command files) exactly as they were at the time of the error. Then report this information to us at the Impact Project. We will attempt to reproduce the error and then fix the bug (if indeed it is a bug). COMMON FEATURES OF GEMPACK PROGRAMS Page 5-9 Error Messages In order to do this, we may need to ask you to send us copies of the relevant files, so please keep the copies until we notify you that they are no longer needed. Information about errors that may occur while running GEMSIM or TABLO-generated programs can be found in section 5.12 of GPD-2. 5.7 Eliminating Syntax Errors in GEMPACK Command Files When you run GEMSIM, a TABLO-generated program, or SAGEM, and take input from a GEMPACK Command file, the whole Command file is checked to see that the syntax of all statements (or commands) in it is as expected (that is, conforms to the syntax laid down in Appendix A). Any syntax errors are pointed out; the message always includes '%%' at the start. For example, if a GEMSIM Command file contains the statement "somution file = sjlb ;" (a typing slip), you will see the message %% Unknown keyword 'somution' The program only begins to process (that is, act on) the commands in the Command file if no syntax errors are found. While this syntax checking is going on, the whole Command file is echoed to the screen, together with any syntax error messages. If you have a large Command file, syntax errors may get lost as the Command file flashes past on the screen. If so, we recommend that you create a Log file to capture the output, including syntax error messages. Then you can search this Log file for '%%' to identify all syntax errors, which you can then correct by editing the Command file. When your Command file contains syntax errors, the only way to get a Log file is to select the option 'log' (see section 5.3 above) and then the option 'cmf' as follows: log ! select log first cmf ! select cmf second B ! for both terminal and log file output (A statement "log file = ... ;" in the Command file has no effect when there are syntax errors in the Command file, since the program stops before this statement is acted upon.) CHAPTER 6 CHOOSING THE CLOSURE, SHOCKS, AND OTHER SETS OF VARIABLES In this chapter we tell you in more detail about choosing the closure for a simulation (section 6.1), choosing other sets of variables such as the variables to shock or the endogenous variables to print (section 6.2) and specifying the shocks for a simulation (section 6.3). All of this chapter applies to multi-step simulations run via GEMSIM or a TABLO-generated program or to Johansen simulations run via SAGEM. Section 6.2 also applies to other programs such as GEMPIE where you are choosing a set of variables from a larger set. 6.1 Specifying the Closure In the economic models solved via GEMPACK, the number of variables* exceeds the number of equations (as we have seen in section 2.5.1 above). In order to solve the equations, some of the variables must be predetermined - the exogenous variables - by giving them actual numerical values. This is done by specifying the shocks. From these shocks, the equations of the model can be solved to determine the remaining variables - the endogenous variables. The closure of the model, or alternatively the economic environment in which we are carrying out a simulation, is the partition (split) of the set of variables into exogenous and endogenous. For the closure to be valid, the number of endogenous variables must be equal to the number of equations. In addition, the exogenous variables must be an independent set with no equations between them. For example, consider a set of (scalar) variables x,y,z with an equation between them x + y + z = 0. Given x and y as exogenous variables, z cannot also be chosen as exogenous since it is already determined by the equation z = - x - y. _________________ * As explained in section 2.5.1 above, here the number of variables is obtained by adding up the number of components in each vector variables. (The VARIABLEs in the TABLO Input file are these vector variables; each has a number of components determined by the sizes of the sets over which their arguments range.) CHOOSING THE CLOSURE, SHOCKS, AND OTHER SETS OF VARIABLES Page 6-2 Specifying the Closure The actual choice of exogenous variables depends on what the simulation represents. In general terms variables determined by factors outside the system are often made exogenous, and the remaining variables which are determined by the system being modelled are the endogenous variables. We recommend that you use GEMPACK Command files (see sections 2.2.3 and 2.3.1 above) for carrying out simulations with TABLO-generated programs or SAGEM. In section 6.1 below we discuss the different ways of specifying the closure on a Command file. For the corresponding ways of doing this if you are not using a Command file (that is, if you are running the program interactively or via a Stored-input file), see section D.1 of Appendix D. Note that, if you have levels VARIABLEs in your TABLO Input file, you must use the names of the associated linear variables (these have "p_" or "c_" added at the start) when giving names to specify the closure (or when you choose other sets of variables). 6.1.1 Miniature ORANI Model Throughout this chapter, examples used are taken from a version of the Miniature ORANI model documented sections 3-9 of Dixon et al (1982). For this chapter, the only things you need to know about this model are the names of the sets in this model and the names of the variables in this model, and the number of components each has. These are shown in the tables below. SETS Name Size Description Element names COM 2 commodities c1,c2 IND 2 industries i1,i2 SOURCE 2 source of commodities domestic,imported FAC 2 primary factors labor,capital VARIABLES Number of Arguments Name components (if any) Description XHOUS 4 (COM,SOURCE) household consumption CHOUS 1 - nominal total household consumption PCOM 4 (COM,SOURCE) commodity prices PDOT 2 (COM) unit cost of Armington aggregate XDOT 2 (COM) Armington aggregate over source U 1 - consumption mix ratio (household) PEXP 2 (COM) export prices (foreign dollars) PIMP 2 (COM) import prices (foreign dollars) XEXP 2 (COM) export demands FEXP 2 (COM) export demand shifters Z 2 (IND) industry activity YCOMIND 4 (COM,IND) industry output XINTCOM 8 (COM,SOURCE,IND) intermediate commod ... XINTFAC 4 (FAC,IND) intermediate factor inputs PLAB 1 - wage rate PCAP 2 (IND) price of capital PFAC 2 (FAC,IND) price of primary factors XINTCOM_CD 4 (COM,IND) Cobb-D combination of inputs com PCOM_CD 4 (COM,IND) price of Cobb-D combination of com CHOOSING THE CLOSURE, SHOCKS, AND OTHER SETS OF VARIABLES Page 6-3 2 Miniature ORANI Model XINTFAC_CD 2 (IND) Cobb-D combination of factors PFAC_CD 2 (IND) price Cobb-D combination factors V 2 (COM) power of export subsidy T 2 (COM) power of import duty XLAB 1 - total demand for labor XCAP 2 (IND) industry demand for capital M 1 - total imports (foreign or over... E 1 - total exports (foreign or over... CPI 1 - consumer price index FWAGE 1 - wage rate shifter CR 1 - real household consumption XIMP 2 (COM) import quantities INTCOM 8 (COM,SOURCE,IND) intermediate input of com... INTFAC 4 (FAC,IND) intermediate input of factor... HOUSE 4 (COM,SOURCE) household consumption of com... EXPCOM_DOMV 2 (COM) exports of (domestic) commodity... IMPCOM_DOMV 2 (COM) imports of commodity (Aust $) COMPROD 4 (COM,IND) production of commodity i by ind j PHI 1 - exchange rate B_A 1 - Aust dollar change in trade bal.. B_F 1 - foreign dollar change in trade... EXPSUB 2 (COM) export subsidies on exports of com DUTY 2 (COM) duty levied on imports of com i If you want to know more about the model, note that the TABLO Input file MO.TAB for this model is included in the model files which accompany GEMPACK - see Appendix B. To run Miniature ORANI, run TABLO with the TABLO Input file MO.TAB, in the usual way as described in chapter 2. You can then run the program GEMSIM using the Command file MOTAR.CMF (which is also included in the model files examples) to carry out a tariff simulation with this version of the model. 6.1.2 Specifying the Closure via a Command File The three main ways of specifying the closure using a Command file are (i) starting from scratch by giving the closure as a list of variable names and components, (ii) starting from an existing closure saved on a file and using this closure unchanged, or (iii) starting from an existing closure saved on a file and modifying it. Specifying the closure from scratch The simplest way of specifying a closure is to give a list of exogenous variables and then specify that the rest of the variables are endogenous. The Command file statements for this are exogenous ; rest endogenous ; where the is a list of variable names, optionally followed by set/element arguments or component numbers separated by spaces. (Note CHOOSING THE CLOSURE, SHOCKS, AND OTHER SETS OF VARIABLES Page 6-4 Specifying the Closure via a Command File that these are the names of the associated linearized variables at this stage, since TABLO has already linearized any levels equations into expressions containing percentage changes or ordinary changes of levels variables.) Individual component numbers can follow the variable names; for example "p_XINTCOM 2-4 6 8" would mean components 2,3,4,6,8 of p_XINTCOM, the percentage change in the variable XINTCOM. Alternatively, components can be indicated using set and/or element names* where available; for example, p_XINTFAC("labor",IND) would specify all components of p_XINTFAC with first argument "labor" and second argument in the set IND (that is, all labor inputs to all industries - these are components numbered 1 and 3 of p_XINTFAC). If a variable name has no set/element arguments and no component numbers following it, this means that all components are being set exogenous. For example, the following statements specify the usual closure: exogenous p_PIMP p_FEXP p_XEXP("c2") p_PHI p_V 1 p_FWAGE p_CR p_T p_XCAP ; rest endogenous ; Conversely you can list the endogenous variables and make the rest exogenous as in the following statements: endogenous p_XHOUS p_CHOUS p_PCOM p_PDOT p_XDOT p_U ; endogenous p_PEXP p_XEXP("c1") ; endogenous p_Z p_YCOMIND p_XINTCOM p_XINTFAC ; endogenous p_PLAB p_PCAP p_PFAC p_XINTCOM_CD p_PCOM_CD ; endogenous p_XINTFAC_CD p_PFAC_CD ; endogenous p_V 2 p_XLAB p_M p_E p_CPI p_XIMP ; endogenous p_INTCOM p_INTFAC p_HOUSE p_EXPCOM_DOMV ; endogenous p_IMPCOM_DOMV p_COMPROD ; endogenous c_B_A c_B_F c_EXPSUB c_DUTY ; rest exogenous ; This would give exactly the same closure as in the first method. Note that you can continue one statement over several lines (as in the "exogenous ..." statement in the first example above). You can also have several "exogenous ..." or "endogenous ..." statements (as in the second example above). If you want to save this closure on an Environment file so that you can use it later in another simulation, the command save Environment file mo ; can be included. This saves an Environment file MO.EN4 containing the closure specified. _________________ * Subset names can also be used. In the example that follows, if there were a subset IND2 of IND declared in the TABLO Input file, then you could write p_XINTFAC("labor",IND2) to indicate all components of INTFAC with first argument "labor" and second argument in IND2. CHOOSING THE CLOSURE, SHOCKS, AND OTHER SETS OF VARIABLES Page 6-5 Specifying the Closure via a Command File Using a Saved Closure If the closure used in a simulation has been saved on an Environment file, this file can then be used to specify the closure for a new simulation by using the command in the Command file use Environment file ; For example, using the Environment file MO.EN4 from the example above, we can reuse exactly the same closure by the command use Environment file mo ; The closure is also written on the Solution file. This file can be used to give the closure instead of the Environment file. For example, take closure from Solution file ; is one way of specifying the closure.** Modifying a Saved Closure If in a simulation you want to have a closure which is very similar to another closure which you have saved, you can start with the old closure and modify it as in the following example from Miniature ORANI. modify closure from Environment file mo ; swap p_PHI = p_CPI ; swap p_XEXP("c2") = p_V("c2") ; This starts with the closure on file MO.EN4. In this closure as given in the first example above, p_PHI is exogenous and p_CPI is endogenous. The first swap statement makes p_CPI exogenous and p_PHI endogenous. Similarly the second swap statements makes the previously exogenous component p_XEXP("c2") to be endogenous and the previously endogenous component p_V("c2") to be exogenous. Another example is the swapping of several components of one variable with several components of another variable as in the following: modify closure from Environment file mo ; ________________________________ ** An LU file stores the closure and the LU decomposition of the left-hand side matrix (see section 7.5 below). The statement take closure from LU file ; is another way of specifying the closure. This should be compared with the similar statement use LU file ; which means that the LU decomposition is taken from this file, as well as the closure. CHOOSING THE CLOSURE, SHOCKS, AND OTHER SETS OF VARIABLES Page 6-6 Specifying the Closure via a Command File swap p_PIMP 1 2 = p_PCOM 1 4 ; Note that, in a "swap" statement, if all components on one side are exogenous, those on the other side must all be endogenous (and vice versa). The total number of components on each side must be the same. These components are interchanged by "swapping" the sets to which they belong. You can also use "exogenous ... ;" and "endogenous ... ;" statements to modify a closure. For example, the following statements would specify the same modified closure as those in the first example above. modify closure from Environment file mo ; endogenous p_PHI p_XEXP("c2") ; exogenous p_CPI p_V("c2") ; The full syntax for these commands and other similar commands is given in Appendix A. Examples of complete Command files are given in sections 2.3.1 and 2.4, Appendix A and in the model files listed in Appendix B. 6.1.3 Component Numbers for a Variable You will need to know the order of the components of a VARIABLE if you want to specify component numbers in the statements giving the closure (as above) or in selecting sets of variables (section 6.2 below) or in specifying shocks (section 6.3 below). A VARIABLE with no arguments has just one component. A VARIABLE with one argument (for example, p_PEXP(i) in Miniature ORANI) has as many components as the size of the set over which the argument runs; and these components are in the same order as the elements of this set. For VARIABLEs with 2 or more arguments, the order of the components is determined by the rule that the first argument varies fastest, then the second varies next fastest, and so on. The examples below (all taken from Miniature ORANI as described in section 6.1.1 above) should make this clear. Examples 1. p_XEXP has one argument ranging over the set COM. Component 1 p_XEXP("c1") Component 2 p_XEXP("c2") 2. p_YCOMIND has two arguments ranging over COM and IND. Component 1 p_YCOMIND("c1","i1") Component 2 p_YCOMIND("c2","i1") Component 3 p_YCOMIND("c1","i2") Component 4 p_YCOMIND("c2","i2") CHOOSING THE CLOSURE, SHOCKS, AND OTHER SETS OF VARIABLES Page 6-7 Component Numbers for a Variable 3. p_XINTCOM has three arguments ranging over COM, SOURCE and IND respectively. The first 4 components correspond to the first industry "i1" and the last 4 to the second industry "i2" since the last argument varies slowest. Component 1 p_XINTCOM("c1","domestic","i1") Component 2 p_XINTCOM("c2","domestic","i1") Component 3 p_XINTCOM("c1","imported","i1") Component 4 p_XINTCOM("c2","imported","i1") Component 5 p_XINTCOM("c1","domestic","i2") Component 6 p_XINTCOM("c2","domestic","i2") Component 7 p_XINTCOM("c1","imported","i2") Component 8 p_XINTCOM("c2","imported","i2") CHOOSING THE CLOSURE, SHOCKS, AND OTHER SETS OF VARIABLES Page 6-8 Choosing Other Sets of Variables 6.2 Choosing Other Sets of Variables There are many situations in which you must choose a set of variables. For example, (i) when carrying out a multi-step simulation, you must choose the endogenous variables to be retained on the Solution file (the so-called "cumulatively-retained endogenous variables"), or (ii) when printing totals results via GEMPIE, you must choose the endogenous variables to be in the printout. In such situations, there is always a "big" set and you are choosing a subset of this big set. In example (i) above, the big set is the set of all endogenous variables (including any backsolved for if you condensed the model) while in (ii) above it is the set of cumulatively-retained endogenous variables. In GEMSIM, TABLO-generated programs and SAGEM, you can choose sets of variables using a Command file. This method is illustrated in section 6.2.1. In choosing sets of variables in other programs, in particular GEMPIE, Command files are not available. However in all programs including GEMPIE, SAGEM, GEMSIM and TABLO-generated programs, you can choose variables interactively (or by using a Stored-input file). Some details about this are given in section 6.2.2 below. Complete details of interactive choice of sets of variables are given in section D.2 of Appendix D. Note that, if you have levels VARIABLEs in your TABLO Input file, you must use the names of the associated linear variables (these have "p_" or "c_" added at the start) when choosing sets of variables. 6.2.1 Choosing Sets of Variables via a Command File There are two choices of sets of variables for GEMSIM or TABLO-generated programs, namely: 1. Cumulatively-retained endogenous variables which are chosen from the set of all endogenous variables (including any backsolved for if you condensed the model), 2. The set of variables which are on the Extrapolation Accuracy file (that is, the XAC-retained variables), chosen from the set of all endogenous variables (including any backsolved for if you condensed the model). For SAGEM, there are various choices to make, including: 1. Individually-retained exogenous variables from the set of all shocked exogenous variables, CHOOSING THE CLOSURE, SHOCKS, AND OTHER SETS OF VARIABLES Page 6-9 Choosing Sets of Variables via a Command File 2. Individually-retained endogenous variables from the set of all endogenous variables, 3. Cumulatively-retained endogenous variables from the set of all endogenous variables. The meanings of individually-retained and cumulatively-retained are explained in detail in chapter 7. Here we will just assume that in each choice, we have a "big" set and are choosing a subset of this set. The Command file statements are similar for all these choices so we will give them all together and illustrate by examples the form of the used in specifying them: cumulatively-retained endogenous ; XAC-retained ; individually-retained exogenous ; individually-retained endogenous ; In each case, the must consist of variables and components in the "big" set. The things in the can be (1) a variable name followed by set and/or element arguments, for example p_XINTFAC("labor",IND)* which means all components of p_XINTFAC with first argument "labor" and second argument in the set IND (that is, all labor inputs to all industries - these are components numbered 1 and 3 of xINTFAC); this means that the components indicated are to be included in the subset. (They must all be in the "big" set.) (2) a variable name followed by certain components of it (these must all be in the big set), for example, "p_XINTCOM 2-4 6", which means that just these components are to be included in the subset. (3) a variable name not followed by set/element arguments or component numbers, which means that all components of this variable which are in the big set are to be included in the subset. (4) abbreviations such as %all (meaning all variables in the big set), or %macro or %scalar (meaning all macro or scalar variables in the big set are to be included in the subset). (5) abbreviations such as (FAC), meaning that all variables with one argument ranging over the set FAC which are in the big set are to be included in the subset, or (COM,SOURCE), meaning the same for variables with two arguments, the first ranging over COM and the second ranging over SOURCE. ________________________________ * There must not be a space between the end of the variable name and the '('. For example, "p_PEXP(COM)" and "p_PEXP (COM)" mean quite different things - see (5) below for the meaning of "(COM)" in the second case. CHOOSING THE CLOSURE, SHOCKS, AND OTHER SETS OF VARIABLES Page 6-10 Choosing Sets of Variables via a Command File Example using SAGEM Suppose shocks are to be applied to the following exogenous variables. (We are assuming the closure is as saved on the Environment file MO.EN4 - see the section headed "Specifying the closure from scratch" in section 6.1.2 above.) p_PHI, component 2 of p_T, p_FWAGE and p_CR. ! ! Command file for running SAGEM for the Miniature ORANI model ! from TABLO Input file MO.TAB ! use equations file mo ; solution file = mosagem ; ! ! Closure ! use environment file mo ; ! ! Shocks ! shock p_T 2 = 1 ; ! or 'shock p_T("c2") = 1 ;' shock p_PHI = 1 ; shock p_FWAGE = -2.38 ; shock p_CR = 2.76 ; ! ! Choosing sets of variables ! individually-retained exogenous %all ; individually-retained endogenous p_Z p_YCOMIND(COM,"i2") p_XINTFAC 1-3 %macro ; cumulatively-retained endogenous p_Z p_YCOMIND (COM) (FAC,IND) ; ! ! verbal description = MO Standard closure. Shocks p_phi p_t 2 p_fWAGE p_cR ; ! ! End of Command file !_____________________________________________________________ The three commands above choosing sets of variables determine what is on the Solution file and hence what we can print out later using GEMPIE. The first two commands - see (1) and (2) below - refer to individual solutions on the Solution file while command (3) refers to the totals solution. (1) The command individually-retained exogenous %all ; means that the Solution file will show results for all shocks. There will be a separate column for each of the shocks. (The big set here is the set of all shocked variables.) CHOOSING THE CLOSURE, SHOCKS, AND OTHER SETS OF VARIABLES Page 6-11 Choosing Sets of Variables via a Command File (2) The command individually-retained endogenous p_Z p_YCOMIND(COM,"i2") p_XINTFAC 1-3 %macro ; means that the Solution file will contain results of these shocks on variable p_Z (all components) components (c,"i2") for all 'c' in COM of p_YCOMIND (these are components numbered 1 and 2) components 1,2,3 for variable p_XINTFAC all endogenous macro variables (that is, variables with just one component) - p_CHOUS, p_U, p_PLAB, p_XLAB, p_M, p_E, p_CPI, c_B_A, c_B_F (The big set here is the set of all endogenous variables.) (3) The command cumulatively-retained endogenous p_Z p_YCOMIND (COM) (FAC,IND) ; means that the Solution will contain the cumulative effect of all the shocks on the following. variables p_Z and the specified components of p_YCOMIND. (COM) chooses all (endogenous) components of all variables in the model having one argument ranging over the set COM - p_PDOT, p_XDOT, p_PEXP, p_XEXP, p_V, p_XIMP, p_EXPCOM_DOMV, p_IMPCOM_DOMV, c_EXPSUB and c_DUTY. (FAC,IND) chooses all variables in the model having two arguments ranging over the sets FAC and IND (in that order) - p_XINTFAC, p_PFAC and p_INTFAC. (The big set here is the set of all endogenous variables.) CHOOSING THE CLOSURE, SHOCKS, AND OTHER SETS OF VARIABLES Page 6-12 Interactive Choice of Sets of Variables 6.2.2 Choosing Sets of Variables Interactively You will recognise the choice situations we are describing in this section because you will be presented with a menu looking something like that shown below.** (In the menu below, the words "shocked exogenous" and "individually-retained exogenous" will be replaced, more generally, by words describing the big set and the subset being chosen.) CHOICE OF WHICH shocked exogenous VARIABLES YOU WANT TO BE individually-retained exogenous. Make ONE of the following choices: L LISTS of variables, all or some of whose components are to be individually-retained exogenous. a ALL components of ALL shocked exogenous variables to be individually-retained exogenous. n NO shocked exogenous variables to be individually-retained exogenous. m All shocked exogenous MACRO variables to be individually-retained exogenous. 1 All components of ONE shocked exogenous variables to be individually-retained exogenous. f All components of a FEW shocked exogenous variables to be individually-retained exogenous. s SOME components of SOME shocked exogenous variables to be individually-retained exogenous. w WHICH are the shocked exogenous variables. Enter your choice now. ('L' is the default.) Example of the Menu Presented for Choosing a Subset Sometimes your choice will be simple and easily expressed. For example, you may wish to choose all variables or none, or all "macro" variables (that is, variables with just one component), or just a few variables. Procedures for doing these are described in section 6.2.3 below. On the other hand, you may need to describe a fairly complicated set - perhaps many variables and only some of the components of some of them. Procedures for making such choices are described in section 6.2.4 below. The rest of this section is a description of the most important ways of choosing a set of variables interactively. A fuller treatment can be found in section D.2 of Appendix D. _________________ ** This is the menu if you are using full prompts. If you have chosen brief prompts, the menu will be compressed considerably. CHOOSING THE CLOSURE, SHOCKS, AND OTHER SETS OF VARIABLES Page 6-13 Simple Choices 6.2.3 Simple Choices The simple choices, and their meanings are shown below. Select a (ALL) if the subset is identical to the big set. n (NO) if the subset contains no variables. m (MACROS) if the subset consists of all macro variables which are in the big set. A macro variables has exactly one component. If you select one of these menu items, this completes the choice of subset. (If you want to choose all macro variables and some other variables, choose 'L' as in section 6.2.4.) Select 1 (ONE) to choose all components (which are in the big set) of just one variable. You will then be asked for the name of this one variable. Note that only the components of a variable which are in the big set are available for the subset. If, for example, a variable 'x1' has 10 components of which only numbers 1-5 and 10 are in the big set and you select '1' and then nominate 'x1', only these 6 components will be in the subset. Select f (FEW) to choose all components (which are in the big set) of a few variables. You will then be asked how many variables and then for the names of these variables (one per line). w (WHICH) for a description of which components of which variables are in the big set. Then you can choose again from the menu above. CHOOSING THE CLOSURE, SHOCKS, AND OTHER SETS OF VARIABLES Page 6-14 Choosing Using the Lists Option 6.2.4 Choosing Using the Lists Option The option 'L' ("Lists") is the best way of choosing complicated sets of variables interactively. (The option 's' is another way - see section D.2.3 of Appendix D for details.) Once you have chosen 'L' from the main menu, you can use several commands, shown in the menu below to specify the chosen set. Note that, as you issue more commands, you keep adding to the subset until you choose 'f' to finish. COMMAND MEANING a Choose ALL components of the listed variables. s Choose SOME components of the listed variables. m Choose all available MACRO variables. w Which are available components of variables to choose from? c Which components of which variables have I already chosen? f Finish. q Quit.(Give up this attempt to choose a set of variables.) ? Help. ? Detailed help for the specified commands. Subcommands Available When Choosing via the Lists Option Example of choosing interactively after choosing L In the Miniature ORANI model, suppose we wish to choose 1. all components of p_Z, 2. just components p_YCOMIND(c,"i2") for all 'c' in COM, 3. components 1,2,3 of variable p_XINTFAC, components 1 and 4 of p_XINTCOM, 4. all macro variables, and 5. all variables with one argument where this argument belongs to the set COM. Also all variables with two arguments, the first belonging to set IND and the second to FAC. The responses for these choices are as follows: 1. To choose all components of p_Z (that are in the big set), enter a p_Z 2. The response a p_YCOMIND(COM,"i2") will choose the desired components of p_YCOMIND. 3. After this, a response of s p_XINTFAC p_XINTCOM CHOOSING THE CLOSURE, SHOCKS, AND OTHER SETS OF VARIABLES Page 6-15 Choosing Using the Lists Option followed by, (responding to prompts about p_XINTFAC and p_XINTCOM) 3 (for 'p_XINTFAC') 1-3 2 (for 'p_XINTCOM') 1 4 will say that just components numbered 1-3 of 'p_XINTFAC' and components 1 and 4 of 'p_XINTCOM' are to be chosen. 4. To choose macro variables, enter m 5. You can choose whole classes of variables by indicating their arguments and the sets over which they range. For example a (COM) (IND,FAC) chooses all (available) components of o all variables in the model having one argument ranging over the set COM (this is what (COM) means), and o all variables in the model having two arguments ranging respectively over the sets IND and FAC (this is what (IND,FAC) means). (Of course, in such cases, the sets and arguments are as contained on the TABLO Input file for the model.) The set name or names must be enclosed in brackets '(' and ')' in this type of command. 6. Then the command f (to finish) completes the choice of the subset. CHOOSING THE CLOSURE, SHOCKS, AND OTHER SETS OF VARIABLES Page 6-16 Specifying the Shocks 6.3 Specifying the Shocks If you are using a Command file, you specify the variables to be shocked and the numerical values of the shocks at the same time, as explained in section 6.3.1 below. If you are running interactively, you specify the variables to be shocked following the procedure described in section 6.2.2 above and then specify the numerical values of the shocks separately, as explained in section 6.3.2 below. (As before, always use names of linear VARIABLEs when specifying variables to be shocked.) Note that the shocks to a particular variable are said to be uniform if all shocked components of this variable are given the same numerical shock. 6.3.1 Specifying the Shocks via a Command File To specify the shocks to exogenous variables using a Command file, you must have one shock command for each variable to be shocked. All or some components of this variable can be shocked. If only a few shocks are involved, a simple list of components and corresponding shocks can be given. One example of this type of command is given in the Command file in section 6.2.1. ! ! Shocks ! shock p_T 2 = 1 ; ! or 'shock p_T("c2") = 1 ;' shock p_phi = 1 ; shock p_fWAGE = -2.38 ; shock p_cR = 2.76 ; You can specify shocks to several numbered components of a variable. For example if p_XINTFAC were exogenous and we wanted to shock components 1, 2 and 4, the command shock p_XINTFAC 1 2 4 = 0.2 0.4 -3.9 ; means that component 1 of xINTFAC is shocked by 0.2, component 2 by 0.4 and component 4 by -3.9. Alternatively the components to shock can be indicated using sets and/or elements as arguments. For example, shock p_XINTFAC("capital",IND) = 4 6 ; means shock p_XINTFAC("capital","i1") by 4 per cent and shock p_XINTFAC("capital","i2") by 6 per cent. For a uniform shock applied to just components 1, 2, 4 of p_XINTFAC, the command is shock p_XINTFAC 1 2 4 = uniform 3.0 ; or to shock just components relating to capital inputs uniformly, CHOOSING THE CLOSURE, SHOCKS, AND OTHER SETS OF VARIABLES Page 6-17 Specifying the Shocks via a Command File shock p_XINTFAC("capital",IND) = uniform 3.0 ; or, if all components of xINTFAC are shocked uniformly, shock p_XINTFAC = uniform 3.0 ; When you are giving a large number of shocks to a variable, you can use a shock file. For example, shock p_XINTFAC = file FACTOR.SHK ; tells the program to read the shocks from the file FACTOR.SHK into the components of variable p_XINTFAC. The method of preparing shock files is discussed in section 6.3.3. There are situations in which you have computed on a file (perhaps a file written by GEMSIM or a TABLO-generated program) possible shocks to all components of a variable, but only want to apply some of these shocks in the current simulation. In such a case, you do not have to edit the file to remove the values corresponding to the non-shocked components; instead you can direct the program to select the values on the file corresponding to the components of interest. For example, the statement shock p_XINTFAC("capital",IND) = select from file FACTOR.SHK ; will shock only the two components ("capital","i1") and ("capital","i2") of p_XINTFAC and read the relevant values from the file FACTOR.SHK. In this case, the file FACTOR.SHK must have 4 values on it, and the second and fourth are read (since the components mentioned are components number 2 and 4 of variable p_XINTFAC - see section 6.1.3 above). The words "select from file" are what distinguishes this from other cases. Similarly you can use "select from" followed by a list of values, as in, for example, shock p_XINTFAC("capital",IND) = select from 3 4 5 6 ; Here components ("capital","i1") and ("capital","i2") of XINTFAC will be shocked by 4 and 6 per cent respectively. 6.3.2 Specifying the Shocks Interactively The steps involved in specifying shocks interactively are shown in Figure 6.3.2. Prompts are given at all steps. You are first asked Are all shocks are equal to 1? [y/n] If you respond 'y' (yes), this completes the specification of the shocks. If you respond 'n', you are presented with a list of the relevant variables (namely, those with at least one component shocked) in turn, one at a time. They are presented in the order in which the variables are declared in the TABLO Input file for the model. CHOOSING THE CLOSURE, SHOCKS, AND OTHER SETS OF VARIABLES Page 6-18 Specifying the Shocks Interactively Figure 6.3.2 goes on this page CHOOSING THE CLOSURE, SHOCKS, AND OTHER SETS OF VARIABLES Page 6-19 Specifying the Shocks Interactively For a variable with only one component shocked, you are asked to enter the numerical shock. For a variable with more than one component shocked, the choice is a little more complicated. You are first asked if you want to give uniform shocks (that is, the same shock to each shocked component). If you respond 'y' (yes), you are next asked to enter the value of this uniform shock. If you respond 'n' (not uniform shocks), you are asked whether you want to read the shocks from a file (a text file) or the terminal. In the case of a file, you are then asked for the name of the file, after which the program reads the values from that file; see section 6.3.3 below for advice about preparing these files. In the case of the terminal, you are then asked to enter the appropriate number of shock values. This is repeated for each variable with at least one component shocked. 6.3.3 Shock Files If you specify a file from which to read the shocks for one variable, this file must be a GEMPACK text file. It must begin with the "how much data" information which, on shock files, can usually take the simple form ; where is the number of numerical values of shocks on the file and the ending semicolon ';' is required. In general, is the number of shocked components of the variable in question. However when you are selecting shocks from a file using the "select from file.." statement as described in section 6.3.1, is the total number of components for the variable. Then, on the subsequent line (or lines, as you please) must come real numbers, being the values of the shocks.* For example, to give 5 shocks, the file could contain 5 ; 1.2 13.0 4 -5 7.0 These numbers can be separated by spaces or commas. Repeated shocks of the same size can be abbreviated using the syntax * _________________ * (i) If the variable in question has shocked components, the data on the shock file can actually be that for an array of size x x... where the product of the sizes n1,n2,... equals . (ii) The "how much data" information was not required before Release 5 of GEMPACK. It is included now as a further check that the shocks are as you intend. CHOOSING THE CLOSURE, SHOCKS, AND OTHER SETS OF VARIABLES Page 6-20 Shock Files so that, for example, '20*1.3' means 20 values each equal to 1.3. (There should be no space before or after the '*'.) For example to give 100 shocks with the first 20 equal to 1.3 and the remainder equal to -15.0, the file could contain 100 ; 20*1.3 80*-15.0 Note that each such file can only contain the shocks for one variable. For each variable, if you specify a file from which to read the shocks, the file is read from the top. To shock a multi-dimensional variable, for example X(i,j) where i varies from 1 to 3, j varies from 1 to 5 enter 15 shocks (with i running fastest) that is, in the order X(1,1), X(2,1), X(3,1), X(1,2), X(2,2),..... X(3,5) In this example, the file might be as below. 15 ; 1.1 2.1 3.1 1.2 2.2 3.2 1.3 2.3 3.3 1.4 2.4 3.4 1.5 2.5 3.5 Shock files must conform to the syntax of GEMPACK text data files, as documented in Appendix C. CHAPTER 7 MORE ABOUT SIMULATIONS AND SOLUTION FILES In this chapter we go into more detail about the contents of Solution files, both those produced by SAGEM and those produced after a multi-step simulation. In doing so for SAGEM, we introduce the idea of a subtotal solution. We also describe in a little more detail how the linearized equations are solved, and give information on and advice about choosing the Harwell parameter required by the sparse matrix routines used by GEMPACK. In section 7.6 we describe the Options available for SAGEM and GEMPIE. 7.1 Several Simultaneous Johansen Simulations via SAGEM As explained in section 2.4 above, it is possible to calculate the results of several Johansen simulations in one run of SAGEM. In this section we explain this in a little more detail. As we have seen in section 2.5.2 above, once the exogenous/endogenous split has been chosen, the system of linearized equations of a model with n equations and m variables Cz = 0 (1) becomes A.z1 = - D.z2 (2) where z1 and z2 are respectively the vectors of endogenous and exogenous variables in the system, A is n x n and D is n x (m - n). The columns of A and D are those columns of C corresponding respectively to endogenous and exogenous variables. If k of the m - n exogenous variables are given nonzero shocks, the problem of finding the change in each of the n endogenous variables resulting from each of these k shocks reduces to solving, for X, the matrix equation AX = B (3) where B is an n x k matrix, the jth column of which is obtained by multiplying the column of D corresponding to the jth shocked variable by the negative of the shock given to this variable. MORE ABOUT SIMULATIONS AND SOLUTION FILES Page 7-2 Several Simultaneous Johansen Simulations via SAGEM When the closure is economically sensible, the matrix A is invertible and the equation (3) can be solved. The n x k matrix X is the "solution" of the simulation: its entry x(i,j) (in row i and column j) shows the percentage change (or change) in the ith endogenous variable resulting solely from the shock given to the jth shocked variable. Because we are dealing with a system of linear equations in (3), the sum of all entries in any row i of X can be taken as the percentage change in the ith endogenous variable resulting from all of the k shocks given. The elasticity of the ith endogenous variable with respect to the jth shocked variable can be obtained by dividing x(i,j) by the shock given to the jth shocked variable. (The first two columns of results in Table 2.4a in section 2.4 above are the X matrix, of size 27 x 2, for the simulation carried out there.) The Solution Matrix X and Totals Column T Shocked variables 1 2 ... k Totals column Endogenous variables 1 [ x(1,1) x(1,2) ... x(1,k) ] [ t(1) ] 2 [ x(2,1) x(2,2) ... x(2,k) ] [ t(2) ] : : : ... : : : : : ... : : n [ x(n,1) x(n,2) ... x(n,k) ] [ t(n) ] Solution matrix X Totals column T When SAGEM is used in this way, the Solution file produced contains selected portions of the solution matrix X. The exogenous variables corresponding to the columns of X retained on the Solution file are called the individually-retained exogenous variables. (There may be none of them.) The endogenous variables corresponding to the rows of X retained in the Solution file are called the individually-retained endogenous variables. If any of the individual columns of the matrix X are retained on the Solution file (that is, if there are any individually-retained exogenous variables), we say that the Solution file contains individual column results. It is also possible for the Solution file to contain all or some of the rows of the n x 1 vector T whose ith entry (for i between 1 and n) is obtained by adding up all the entries in row i of the matrix X. The endogenous variables corresponding to the rows of T (if any) retained on the Solution file are called the cumulatively-retained endogenous variables since the ith entry of T is the cumulative effect on the ith endogenous variable of all the shocks applied. If some of T is retained on the Solution file, we say that the Solution file contains cumulative (or row totals) results. (The third column of results in Table 2.4a in section 2.4 above is the T vector for the simulation carried out there.) MORE ABOUT SIMULATIONS AND SOLUTION FILES Page 7-3 Several Simultaneous Johansen Simulations via SAGEM Figure 7.1 goes on this page MORE ABOUT SIMULATIONS AND SOLUTION FILES Page 7-4 Several Simultaneous Johansen Simulations via SAGEM When running SAGEM, if you choose to retain some of the rows of the totals vector T, you can also store on the Solution file selected subtotals which are the cumulative effect of several (but not necessarily all) of the shocks. We call these subtotal solutions. Each of these can be thought of as an n x 1 vector whose ith value is obtained by adding all entries in row i of X which are in columns corresponding to the shocks in question. The rows kept on the Solution file for each subtotal are the same rows as those kept from T, namely those corresponding to the cumulatively-retained endogenous variables. More details about obtaining subtotals results (which can also be obtained when running GEMPIE) are given in section 7.3 below. A Solution file produced by SAGEM may contain both individual column and totals/subtotals results, or just one of these two types, according to the instructions you issue while running SAGEM. In summary, the Solution file produced by SAGEM contains o selected rows and columns of the solution matrix X, showing the effects on selected endogenous variables of selected shocks, and/or o selected row totals (or subtotals) across all (or some) columns of X, showing the total effect, accumulated over all (or some) of the shocks, on selected endogenous variables. You control the contents of the Solution file (when running SAGEM) by specifying (i) whether the Solution file contains individual results, totals/subtotals results or both types of results, (ii) the individually-retained exogenous variables, (iii) the individually-retained endogenous variables, (iv) the cumulatively-retained endogenous variables, (v) which subtotals (if any) and the effects of which shocks are included in each subtotal solution. Figure 7.1 illustrates the user inputs required to run SAGEM. 7.2 Printing the Results of a Simulation When you run GEMPIE you can translate to printable form any results stored on the Solution file you access. If the Solution file contains both individual column results and totals/subtotals results, you can only convert part of one of these in any one run of GEMPIE. If you want to print both sorts of results, you must run GEMPIE twice. Alternatively, if the Solution file contains individual column results, you can use these to form up subtotals results (the results of all or some of the shocks whose individual effects are stored) and then convert these subtotals results to printable form. More details of this are given in section 7.3 below. MORE ABOUT SIMULATIONS AND SOLUTION FILES Page 7-5 Printing the Results of a Simulation Note that GEMPIE distinguishes between results which are identically zero and those which have been rounded to zero; it puts an asterisk '*' after the former, as in "0.0000*". For example, a result of 0.000023 will be rounded to zero if GEMPIE is reporting results to 4 decimal places and will be shown as "0.0000" (no asterisk). An example is in Table 2.2.4, in which the result for p_PC("s1") is exactly zero while the result for p_XF("capital","s1") is only rounded to zero. 7.3 Subtotals There are two ways of forming subtotals results; the first is when running SAGEM and the second is when running GEMPIE. We elaborate on these below. First we give in section 7.3.1 an example and use it to illustrate these two different ways. Then, in sections 7.3.2 to 7.3.4, we give more general information relevant to subtotals. 7.3.1 Subtotals - An Example Suppose you shock o the foreign currency prices [p(i),i=1,...,10] for the imports of each of the 10 commodities by 5 per cent, o the real wage rate [w] by 2 per cent, and o household consumption [c] by 1 per cent. Then X would have 12 columns (10 for the p(i) shocks and one each for the w and c shocks). The combined effect of just the p(i) shocks would be given by adding just the first 10 columns of X - this is one subtotal you may wish to calculate and print. A second subtotal solution of the model would be the combined effects of the w and c shocks. FIRST METHOD - VIA SAGEM When you run SAGEM you can ask it to store on the Solution file all of the following: (i) the 12 individual columns, (ii) the cumulative total T, (iii) the subtotal solution showing the combined effect of the 10 p(i) shocks, (iv) the subtotal solution showing the combined effect of the w and c shocks. Then, when you run GEMPIE, you will be able (in one run) either to (i) print some or all of the individual columns, or (ii) print the cumulative solution column T and 0, 1 or 2 of the subtotal solutions on the Solution file. MORE ABOUT SIMULATIONS AND SOLUTION FILES Page 7-6 Subtotals - An Example In this first method, the two subtotal solutions are permanently stored on the Solution file, where they can be easily printed via GEMPIE whenever required, simply by referring to their subtotal number. This method is suitable when you have a (small) number of subtotals that you want to refer to often. SECOND METHOD - VIA GEMPIE Alternatively, you may run SAGEM and just store the 12 individual columns (but no cumulative total or subtotals) on the Solution file. You can still obtain the same subtotal solutions by running GEMPIE and specifying two subtotals to be printed, the first summing over the 10 price shock columns and the second over the w and c shocks. In the second method, the subtotals are not stored on the Solution file but must be defined when running GEMPIE. This method is suitable when you do not know in advance what subtotals you may require from a particular simulation. 7.3.2 Subtotals and Sets of Shocks in General For a given simulation, you can have several different subtotals. Each is associated with a subset of the shocks. To specify a subtotal, you must say which of the shocked variables you want the subtotal to reflect. (This specifies which columns of the solution matrix X are to be added up to produce the subtotals column.) Whenever you specify a new subtotal you will be asked to supply a short description (no more than one line of text) to remind you and others what the subtotal shows. 7.3.3 Storing Subtotals on Solution Files When Running SAGEM If you choose to keep any cumulatively-retained endogenous variables, you will be asked if you want to store any subtotals on the Solution file. Note that if you do not keep any cumulatively-retained endogenous variables, you will NOT be able to store any subtotals. If you respond 'y' (yes) you will be asked to describe the first subtotal you have in mind by specifying exactly which shocks to sum over. (You do this by the Lists method, as introduced in section 6.2.4 above and described fully in section D.2.2 of Appendix D.) Then you will be asked for a one-line description of this subtotal. By now you have specified just one subtotal. After this (and any subsequent subtotals) you will be asked if you want any more subtotals. You can repeat the above procedure for as many subtotals as you require. Note that the endogenous variables retained in each and every subtotal solution are the same as those kept in the cumulative column, namely the cumulatively-retained endogenous variables. Any subtotals stored on the Solution file can be printed when running GEMPIE (as described below). MORE ABOUT SIMULATIONS AND SOLUTION FILES Page 7-7 Printing Subtotals or Individual Column Results using GEMPIE 7.3.4 Printing Subtotals or Individual Column Results using GEMPIE In any one run of GEMPIE, you can do one of the following. (1) Print* any subtotals solutions (and the cumulative solution) stored on the Solution file. (2) Print any individual column results stored (by SAGEM) on the Solution file. (3) Setup and print new subtotals calculated from the individual column results stored (by SAGEM) on the Solution file. If the Solution file you access via GEMPIE has both individual column and totals/subtotals results, you will be presented with the following choice selection. CHOICE MEANING t Print TOTALS/SUBTOTALS already stored on the Solution file i Print INDIVIDUAL COLUMN solutions already on the Solution file s SETUP and print new SUBTOTALS from the individual column solutions already on the Solution file (The choices 't','i','s' correspond respectively to (1),(2),(3) above.) If the Solution file you are accessing only contains individual column results, choice 't' will be omitted from the above menu. If the Solution file only contains totals/subtotals results, GEMPIE will tell you this and the menu above will not appear. (1) If you choose to print subtotals already stored on the Solution file, you will be asked which ones you wish to print. If you only want some of the subtotals stored to be printed, you indicate which ones by number (for example, 1-3, 5 to indicate 4 of the 6 available subtotals solutions). The subtotals you select will be printed in columns side-by-side and the cumulative solution will be printed as the last column. (2) If you choose to print individual column results, you will be asked to specify the columns (which are a subset of the individually-retained exogenous variables) and the rows (which are a subset of the individually-retained endogenous variables) to print. (3) If you choose to setup and print new subtotals, you will first be asked for the endogenous variables to be printed in each subtotal. (These are a subset of the _________________ * When we say "print" in this section, we actually mean "put on the GEMPIE Print file". Once GEMPIE has written the solutions you desire on this Print file, you can choose whether to actually print this file (or view it in an editor etc). MORE ABOUT SIMULATIONS AND SOLUTION FILES Page 7-8 Printing Subtotals or Individual Column Results using GEMPIE individually-retained endogenous variables.) Then you specify the subtotals, one at a time, following essentially the same method as that used for creating subtotals when running SAGEM (see section 7.3.3 above). Note that, when running GEMPIE, the subtotals are summed over some or all of the individually-retained exogenous variables (the only ones available on the Solution file) whereas in SAGEM they are summed over some or all of the shocked variables. Thus, in setting up one subtotal when running GEMPIE, you are choosing a subset of the individually-retained exogenous variables. Note that subtotals solutions you set up and print here are not stored on the Solution file by GEMPIE (which never alters a Solution file). 7.4 Solution Files from Multi-Step Simulations Although it is possible to carry out several Johansen simulations (all with the same closure) simultaneously in one run of SAGEM, it is not possible to carry out several multi-step simulations in one run of GEMSIM or the appropriate TABLO-generated program, as explained below. For Johansen simulations, the matrix A in (2) of section 7.1 above depends only on the closure and is not affected by the shocks. Since the main computing cost of a Johansen simulation is that of calculating the LU decomposition of A, it is possible to carry out several different simulations (all with the same closure but different sets of shocks) in one run of SAGEM. Certainly this increases the number of right-hand-sides to solve for, but the solution for each of these is relatively cheap to compute. In contrast, when you give a set of shocks in say a 2-step simulation (see Figure 2.5.3 in section 2.5.3), the program first applies half of each shock, then updates the data to reflect the effects of these, then (for the second of these steps) recomputes the matrix C (as in equation (1) in section 7.1 above) and solves for the effects of the next half of the shocks in question. For 2 different sets of shocks (that is, for two different multi-step simulations), you would get two different C matrices after the first half of each shock has been applied. (In the notation of Figure 2.5.3, if you have two sets of shocks you will reach two different points C2 after the first step and then move in two different directions from these in the second step.) This means that there are two different A matrices to LU decompose, and it is not feasible to carry on these two quite separate calculations side-by-side.* Of course, this problem would become even less tractable for larger numbers of steps. _________________ * Two different sets of shocks with the same closure give rise to the same A matrices in the first step of a multi-step simulation. When computing an extrapolated solution from, say 1-step and 2-step solutions, GEMSIM or TABLO-generated code takes advantage of this by computing the solution of the first step of the 2-step computation immediately after computing the solution of the first step of the 1-step computation, both using the same LU decomposition. MORE ABOUT SIMULATIONS AND SOLUTION FILES Page 7-9 Solution Files from Multi-Step Simulations For this reason, the Solution file from a multi-step simulation contains just one totals solution (the cumulative effect of all the shocks). No individual column (or other subtotal) results can be present. In summary, SAGEM can produce a lot of approximate results. But if you want accurate solutions to the (usually nonlinear) levels equations of your model, you can only calculate one solution at a time. 7.5 How SAGEM and TABLO-generated Programs Solve Linear Equations Whether you are doing a multi-step simulation via GEMSIM or a TABLO-generated program, or a Johansen simulation via SAGEM, a critical part of the calculation is to solve a system AX=B of linear equations, where A is the n x n matrix in equation (3) in section 7.1 above. In the case of SAGEM, B and X are n x k if you are solving for k individual column results, while, for TABLO-generated code, X and B always consist of a single column (since only one solution is being calculated). In a p-step simulation, p matrix equations like this must be solved, one at each step. In the systems of linear equations AX=B (see (3) in section 7.1) that arise from general equilibrium models, the matrix A is a sparse matrix in the sense that only a small proportion of its entries are nonzero. (This general property of CGE models is explained in section 8.1 below.) GEMPACK solves this matrix equation using the Harwell Laboratories sparse matrix routine MA28 (see Duff (1977)). This does not explicitly invert the matrix A but calculates the so-called LU decomposition (see, for example, section 8.1 of Atkinson (1989) or Stewart (1973)) of A. This is a very efficient procedure which allows very large models to be handled directly by GEMPACK. One feature of the Harwell sparse matrix routines is that there is a trade-off between maintaining sparsity during the calculation and minimising the effects of rounding errors, which are inevitable when doing a large computation on a computer. The Harwell routines ask you to supply the value of a parameter U, referred to as the Harwell parameter, which must be between zero and one. The precise consequences of choosing different values for this parameter are difficult to predict. However some general comments can be made. - Choosing U close to one minimises the rounding errors, so maximises the accuracy of the solution. However this also increases the time required to produce the solution. - Choosing U small (say equal to 0.1) decreases the time taken to calculate the solution but may slightly increase the rounding errors (and hence slightly reduce the accuracy of the results). We are often asked how many figures of accuracy will be lost if U is taken to be 0.1. Unfortunately, it is not possible to answer this precisely; all we can say is that, as far as we can tell, the loss of accuracy is not great (certainly taking U equal to 0.1 should not lose one figure of accuracy in all results but it may do so in some of the results). MORE ABOUT SIMULATIONS AND SOLUTION FILES Page 7-10 How SAGEM and TABLO-generated Programs Solve Linear Equations Fortunately, it is not of great importance since, in Release 5 of GEMPACK, both SAGEM, GEMSIM and TABLO-generated code use a well-known iterative refinement technique called residual correction of solutions (see, for example, section 8.5 of Atkinson (1989)) when solving AX=B. Our experience is that this compensates very effectively for any loss of accuracy that may have resulted in its absence from using small values of U.* Accordingly we are confident in recommending that U be taken as 0.1 in all but those very small models for which computation time is not an issue. (This is why U=0.1 is the default for Command files - see Appendix A.) 7.6 Special Options for SAGEM and GEMPIE Several options are available for SAGEM and GEMPIE apart from the basic options BAT, BPR, LOG, STI, SIF and ASI (which have been described in chapter 5). For SAGEM, these are CPU, CMF, NSM, NIR, NWE and KZC while for GEMPIE, there are options CPW, RPO and CPL, OSR, OSS, SNA, NBV, FBS. These extra options will be described below. However you will find that the default options (that is the program settings you get if you do not choose any options) are suitable in most standard cases. Note that, as for any other GEMPACK program, online help is available. For example, to find information about the SAGEM option NIR, just respond '?NIR' when prompted for your choice of options. Responding '??' will give online help for all options. 7.6.1 SAGEM Options SAGEM can be run using a GEMPACK Command file. This is a text file which consists of a sequence of brief commands to give details such as file names, closure and shocks, and a verbal description of the simulation. Select option CMF Input from a GEMPACK Command file and give the name of the Command file. Further details are given in section 2.4 and Appendix A.2 about preparing Command files for SAGEM and their syntax. Usually SAGEM carries out iterative refinement of the solutions to improve their accuracy. However you can turn iterative refinement off using option _________________ * In one spectacular instance, we tested a very large model whose homogeneity seemed uncertain judging by results produced with U=0.1 without using residual correction. When U was increased to 0.5, the results were as desired but the running time increased from hours to days. When we tested residual correction with this model, we found that, after residual correction, the U=0.1 solution was at least as accurate as the U=0.5 result; further, the residual correction added only a few seconds to the computation time. MORE ABOUT SIMULATIONS AND SOLUTION FILES Page 7-11 SAGEM Options NIR Don't do solution iterative refinement If you only wish to set up the closure for a simulation and then save it on an Environment file, select NSM No simulation (closure only) The Environment file created can then be used in later simulations to specify the closure. On most machines, it is possible to obtain details of the CPU time (actual machine or Central Processing Unit time). Select option CPU Report CPU times to obtain times for the five stages of a simulation: 1. User specification of the simulation, 2. Creation of the right-hand side matrix, that is, the matrix B in equation (3) of section 7.1, 3. Creation of the left-hand side matrix, that is, the matrix A in equation (3) in section 7.1, 4. LU decomposition of the left-hand side matrix, and 5. Calculation and writing of solutions. However, on some machines, CPU times are always reported as zero, which means that CPU reporting is not available within GEMPACK on this machine. Normally warnings are given to indicate how well the equations have been solved. Warnings are given if the left hand side of the equation differs from the right hand side, or if the Equations Matrix is ill-conditioned. Option NWE Don't warn how well equations solved suppresses these warnings. (See section 5.2.6 of GPD-2 for more information about these warnings.) The final option for SAGEM is KZC Keep zero coefficients Zero coefficients are entries in the Equations Matrix which are calculated to be zero from the current data base but may be non-zero for some other data base. Normally zero coefficients are not saved for SAGEM simulations. However it may help the LU decomposition in some models to save them. See also section 5.4.1 of GPD-2 for a further discussion of zero coefficients and similar options in GEMSIM and TABLO-generated programs. MORE ABOUT SIMULATIONS AND SOLUTION FILES Page 7-12 GEMPIE Options 7.6.2 GEMPIE Options The following two options let you choose the page width and page length of the GEMPIE Print file. CPW Change page width CPL Change page length When GEMPIE prints out simulation results, the order of the rows (that is, of the endogenous variables) is determined by the order in which the VARIABLEs were declared the TABLO Input file. If you wish to print out the variables in some other order, select RPO Choose row print order Then, when you choose the endogenous variables to print, use the method 'f'(few) or 'L'(lists). The rows of the solution will be written on the Print file in the order you choose the variables. By default, GEMPIE indicates identical solutions and shocks by messages saying they are "the same" as the previous ones. You can suppress these by choosing options OSR Omit "the same" messages in results OSS Omit "the same" messages in shocks By default, if you are only printing a single solution (for example, the cumulative solution from a multi-step simulation), GEMPIE puts several components of the same variable on the same line (that is, across the page). You can suppress this by choosing option SNA Single solution not across the page (Then the results for each component will be on a separate line.) By default GEMPIE puts blank lines in certain places to create "white space" in the Print file. You can suppress some of these by selecting either or both of the options NBV No blank line before each variable FBS Few blank lines for single solution across the page 7.7 Model Name, Version and Identifier When you create an Equations file, you must specify a model name (up to 8 characters), a model version number (an integer) and a model identifier (up to 60 characters). These are recorded on the Equations file and are also put on any Solution file produced from this Equations file. They then appear as a description of the model in simulation results (for example, on a GEMPIE Print file). The model identifier only has this descriptive role, but the model name and version number are also used for checking, as described below. MORE ABOUT SIMULATIONS AND SOLUTION FILES Page 7-13 Model Name, Version and Identifier If you use a closure stored on an Environment, Solution or LU file (see section 6.1.2 above), the model name and version number on this file are compared with those on the Equations file being used or created. If they are different a warning is issued, but you are still allowed to use the stored closure provided that the variables in the model, their names and numbers of components agree between the two files. You may wish to use an LU file - that is, to take both the closure and LU decomposition of the left-hand-side matrix (see section 7.5 above) from this file, perhaps via a "use LU file ... ;" statement in a Command file. This will be allowed if the model name and version number on the LU file agree with those on the Equations file being used.* If they do not agree, you will only be permitted to take the closure from the LU file and the LU decomposition will be calculated from scratch. Suggested Use We suggest that you use the model name to reflect the original TABLO Input file (that is, to reflect the theory and structure of the model). If you attach different base data for the same model, we suggest that you use a different model version number. (Changing base data changes the Equations file.) Then the checking above means that you will not inadvertently try to use the LU decomposition from one set of data with another set. (This would probably produce incorrect results.) Different condensations of the same model result in different numbers of variables in the condensed version, and hence produce different Equations files. You may like to use slightly different model names to reflect these different condensations. (For example, use SJ for the model name of uncondensed Stylized Johansen but use SJC1 and SJC2 for the model names of two different condensations of this model.) _________________ * You can only use an LU file (in the above sense) when you are using an existing Equations file. If you are creating a new Equations file via GEMSIM or a TABLO-generated program, you can take the closure from an old LU file but will not be allowed to read the LU decomposition itself from such a file. CHAPTER 8 THE OTHER GEMPACK PROGRAMS This chapter is a guide to the other GEMPACK programs (that is, those apart from TABLO, GEMSIM, SAGEM, GEMPIE, MODHAR and TABLO-generated programs). Section 8.1 describes how you can use the program SUMEQ to obtain information about the Equations file, while section 8.2 describes the GEMPACK programs for data management. In section 8.3 we describe how you can use the program SLTOHT to convert simulation results into a form suitable for preparing reports (perhaps via non-GEMPACK utilities such as spreadsheets). In section 8.4 we explain how you can transfer models to other machines. Section 8.5 mentions programs that may still be needed by modellers used to an earlier version of GEMPACK while section 8.6 outlines a couple of fairly specialised GEMPACK programs for comparing numerical results obtained on two different computers. 8.1 Information from Equations Files The Equations file for a model is essentially just a computer encoding of the Equations Matrix C in the system of linearized equations Cz = 0 (1) for the (condensed) model, as described in section 2.5.1 above. Here the Equations Matrix C is of size n x m where n is the total number of equations and m is the total number of variables in the (condensed) model. As we have seen in section 2.5.1 above, it is often useful to think of the matrix C as a rectangular array or tableau with the vector variables (that is, the VARIABLEs in the TABLO Input file) across the top and the equation blocks (that is, the EQUATIONs from the TABLO Input file) along the left-hand side. Each vector variable occupies as many columns as its number of components, and each equation block occupies as many rows as the number of actual equations in it. Together the groups of columns and rows divide the tableau into a block pattern. Part of the tableau for the 27 x 29 Equations Matrix C for Stylized Johansen is shown in Table 2.5.1 in section 2.5.1 above. Notice that this divides up the Equations Matrix C into rectangular submatrices, where the columns and rows of each submatrix correspond respectively to components of the vector variable and the equations in the equation block determining this submatrix. Only some of these submatrices can contain nonzero entries. For example, the equation THE OTHER GEMPACK PROGRAMS Page 8-2 Information from Equations Files block "House" only involves the vector variables p_XH, p_Y and p_PC, so the submatrices in these rows corresponding to the other vector variables must be filled with zeros. Indeed, this is why, in general, the Equations Matrix of a general equilibrium model is sparse (as stated in section 7.5 above). You have probably noticed that, when GEMSIM or a TABLO-generated program for a model is calculating the equations (that is, working out the numbers in the Equations Matrix for the model), it tells you how many nonzero entries are in each of the submatrices for each equation in turn. The program SUMEQ (SUMmarise an EQuations file) can be used to obtain various pieces of information about an Equations file. o It can produce a map of the Equations Matrix C, showing the variables and equations and the columns and rows in the Equations Matrix to which they correspond. This is described in more detail in section 8.1.1 below. o It can produce information about row and column sums (across selected columns or rows, if required). This can be especially useful since it turns out to be a very good way of checking the implementation of many models, as described in more detail in section 8.1.2 below. o You can use it to examine individual entries in the Equations Matrix. You specify the row and column and SUMEQ tells you the value of the entry in that row and column of the Equations Matrix. The map produced by SUMEQ (see section 8.1.1 below) will be helpful in deciding which rows and columns you are interested in. SUMEQ is easy to run interactively. Its output is always directed to a Print file. 8.1.1 Map of an Equations File Produced via SUMEQ One of the options in the program SUMEQ is for a map of the Equations file. This shows o the sets and their sizes, o the vector variables, the number of components in each and the corresponding columns in the Equations Matrix, o the equation blocks, the number of equations in each and the corresponding rows in the Equations Matrix. Below we show this map for the Stylized Johansen model (the version whose TABLO Input file is shown in section 3.3.2 above). Note that, in this map, the "descriptions" of the sets, variables and equation blocks are taken directly from the labelling information (between hashes '#') on the TABLO Input file; sometimes this is truncated in the map. THE OTHER GEMPACK PROGRAMS Page 8-3 Map of an Equations File Produced via SUMEQ MAP OF VARIABLES AND EQUATIONS FOR STYLIZED JOHANSEN SETS ---- No Name Size Description -------------------------------------- 1 SECT 2 Sectors 2 FAC 2 Factors 3 NUM_SECT 1 Numeraire sector - sector 1 VARIABLES --------- No Name Size Cols Arguments (if any) and Description --------------------------------------------------------------------- 1 p_Y 1 1 Total nominal household expenditure 2 p_PC 2 2-3 (SECT) Price of commodity i 3 p_PF 2 4-5 (FAC) Price of factor f 4 p_XCOM 2 6-7 (SECT) Total demand for commodity i 5 p_XFAC 2 8-9 (FAC) Total demand for factor f 6 p_XH 2 10-11 (SECT) Household demand for commodity i 7 p_XC 4 12-15 (SECT,SECT) Intermediate inputs of c ... 8 p_XF 4 16-19 (FAC,SECT) Factor inputs to industry j 9 p_DVCOMIN 4 20-23 (SECT,SECT) Dollar value of inputs o ... 10 p_DVFACIN 4 24-27 (FAC,SECT) Dollar value of factor f ... 11 p_DVHOUS 2 28-29 (SECT) Dollar value of household use ... EQUATIONS --------- No Name Size Rows Arguments (if any) and Description -------------------------------------------------------------------- 1 Comin 4 1-4 (SECT,SECT) Intermediate input ... 2 Facin 4 5-8 (FAC,SECT) Factor input f to in ... 3 House 2 9-10 (SECT) Household demand for com ... 4 Com_clear 2 11-12 (SECT) Commodity market clearing 5 Factor_use 2 13-14 (FAC) Aggregate primary factor ... 6 Consumer_demands 2 15-16 (SECT) Household expenditure fu ... 7 Intermediate_com 4 17-20 (SECT,SECT) Intermediate demand ... 8 Factor_inputs 4 21-24 (FAC,SECT) Factor input demand ... 9 Price_formation 2 25-26 (SECT) Unit cost index for indu ... 10 Numeraire 1 27 (NUM_SECT) Price of commodity 1 ... Map of Stylized Johansen Equations File Produced via SUMEQ You might like to look back at the tableau shown in section 2.5.1 above to see the significance of the entries listed under the headings "Cols" and "Rows" in the map just above. You might like to run SUMEQ on the Equations file (probably called SJ.EQ4) you produced in Step 3 in section 2.2 above. If you select the map option 'm', you should obtain the map shown above. Note that, if you have condensed your model, only VARIABLEs and EQUATIONs left in the condensed system appear on the Equations file and hence in the map produced by SUMEQ. THE OTHER GEMPACK PROGRAMS Page 8-4 Map of an Equations File Produced via SUMEQ In order to identify the column corresponding to a particular component of a variable, you will also need to know the order of the components, which is documented in section 6.1.3 above. To identify the row corresponding to a particular equation, you will also need to know the order of the equations in a block, which is documented in section 4.10.5 of GPD-2. 8.1.2 Homogeneity Simulations using SUMEQ Many general equilibrium models have various so-called homogeneity properties, for example that one solution of the model is obtained by increasing all nominals (such as domestic prices, domestic dollar values and the exchange rate) by 1 per cent, while holding all reals (such as physical quantities) unchanged. Checking such homogeneity properties is one important way of verifying that you have implemented your model correctly. To see if your model has this property, use SUMEQ to calculate all row sums of the Equations Matrix across just those columns which correspond to the variables which should increase by 1 per cent. (Use the map of the Equations file to identify which column numbers these are.) All row sums should equal zero (to within rounding errors). To identify a collection of columns, you can input 7-10, 30, 35-38 as an abbreviation for 7,8,9,10,30,35,36,37,38. Note that you could also check such homogeneity properties by actually carrying out the simulation in question (via SAGEM, for example). If you have made an error in implementing your model (for example, a typographical mistake in your TABLO Input file), the simulation results will tell you something is wrong, but you will not know where to look to correct the error. The advantage of using SUMEQ is that the printout of the row sums produced will identify the problem by showing you exactly which equation block(s) in your TABLO Input file are incorrectly specified (since only these row sums will not be as expected). (Use the map produced by SUMEQ to find which equation block each actual equation is in.) However, if you have condensed your model, it may be more difficult to spot which equation block is in error, since if an equation block with an error in it is substituted out, it may contaminate all equation blocks into which it is substituted. THE OTHER GEMPACK PROGRAMS Page 8-5 Looking at or Comparing Data on Header Array Files 8.2 Looking at or Comparing Data on Header Array Files This section describes how you can get information about the data on a Header Array file. The relevant programs are SUMHAR SUMmarise a Header ARray file SEEHAR SEE the data on a Header ARray file CMPHAR CoMP the data on two Header ARray files All 3 are easy to run interactively. 8.2.1 SUMHAR Run this to summarise the data on a Header Array file. For each array of data on the file, this tells you the associated header, the size of the array and whether the data is real, integer or character. The output from SUMHAR can be sent to the terminal or to a Print file or to both. To see how SUMHAR works, you could use it to obtain a summary of the data file (probably called SJ.DAT) for Stylized Johansen. 8.2.2 SEEHAR You can run this to send to a Print file the actual data associated with some or all of the headers on a Header Array file. (Then you can print this file if you wish.) You can choose one of 3 forms of output. (1) If no special options are chosen, the default is to have row and column labels which indicate the position of each piece of data in the whole array. (2) An alternative is to have the output in a form which allows you to import the arrays into a spreadsheet easily.* The separator between the data entries can be chosen to be a comma (the default) or a TAB character (or any other desired character). To obtain this type of output, select the SEEHAR option SS Spreadsheet output at the start of the program, after which you will be asked which separator you want. Most spreadsheet programs (on PCs, for example) will accept as input the kind of file produced. If you choose a comma as the separator, the output will be in what these spreadsheet programs call comma-separated values or CSV format. (3) The third alternative is for the output to be a GEMPACK text data file, from which the data can be read easily into other GEMPACK programs. Specifically, each array is output in the form required for text input to MODHAR, GEMSIM or to ________________________ * We are grateful to Kevin Hanslow for suggesting spreadsheet output and for providing us with a prototype implementation of this. THE OTHER GEMPACK PROGRAMS Page 8-6 Looking at the Data - SEEHAR TABLO-generated programs (as documented in Appendix C). To obtain this type of output, select the SEEHAR option ROW Unlabelled output (row order) or COL Unlabelled output (column order) at the start of the program. Arrays containing real or integer data will be output in row or column order respectively, at most 4 or 5 entries per line of the file. Arrays with character data will be output with each character string on a new line. With real or integer output, element name or number labels will make it clear where each number is placed in the array (though you can select option 'NEL' to suppress this labelling if you wish). To see how SEEHAR works, you could use it (choose the default options) to print all the data on the data file (probably called SJ.DAT) for Stylized Johansen. In all cases above, a three or higher dimensional array is output as several matrices. For example, a 3 x 10 x 6 x 4 array is output as 24 (=6x4) matrices each of size 3 x 10. In case (1) above, the labels specify clearly the position of each piece of data in the whole array. In case (2) above, the entries in each constituent matrix are in row order. In case (3) above, each matrix is output in row or column order and each new row or column starts on a new line. (For row order, each matrix will be output as 3 rows each containing 10 numbers, while for column order, each matrix will be output as 10 columns each containing 3 numbers.) In cases (2) and (3) above, if several arrays of data are on the output file, the header associated with each array is shown at the start of each array. In some cases you may need to split the output file into separate arrays (using a text editor) before using it as input into a spreadsheet or another GEMPACK program. 8.2.3 CMPHAR Run this program if you wish to compare the data at the same headers on 2 different Header Array files. The output is sent to a text file. For each header which is on both files, CMPHAR compares the data entry by entry if the arrays are of the same size (but ignores these arrays if they are of different size). Arrays associated with a header which is only on one of the files are ignored by CMPHAR. When two arrays are compared, they are compared entry by entry. For two entries a1 (on file 1) and a2 (on file 2) in the same position in the array, CMPHAR calculates and reports (i) the absolute difference |a1-a2|, (ii) (provided a1 and a2 are both different from zero), the difference ratio defined by |a1-a2| / MIN(|a1|,|a2|). THE OTHER GEMPACK PROGRAMS Page 8-7 Comparing Data - CMPHAR When the two entries are close together, the absolute difference and difference ratio will be close to zero. Two very large numbers (say in the hundreds or thousands of millions) may be relatively close together but still have a "large" absolute difference. For example, consider the values 210123456.6 and 210122456.6. Their absolute difference is 1000 but the associated difference ratio is only about 0.000005 which is quite small. In such cases, difference ratios may be more meaningful measures as to how "close" the two lots of data are than absolute differences. (On the other hand, two small numbers can be very close but have a large difference ratio, such as the numbers 0.000001 and 0.000002 whose difference ratio is 1.) For each pair of arrays compared, if their data is not identical, CMPHAR reports (a) the total of all absolute differences, the average of these, the largest one and the position in the array and the respective values where this maximum occurs, and (b) the total of all difference ratios, the average of these, the largest one and the position in the array and the respective values where this maximum occurs. It also gives the same information totalled and averaged across all arrays compared on the two files. Note that very small differences in the way two lots of data are calculated can make small differences in the numerical results obtained (even if the two different ways of doing the calculation should theoretically give the same answers). This is because of rounding errors which are inevitable on computers. For example, small changes such as different condensations of the model (or even condensation actions carried out in a different order) can make small changes in simulation results and in the updated data files. On many machines, difference ratios less than 0.000001 or even 0.00001 can be thought of as insignificant because of these considerations. CMPHAR normally reports all differences. However, via option 's' in the main menu, you can tell it to report only "significant" differences, that is, places where the absolute difference exceeds a number you nominate (for example, 0.00001) and the difference ratio exceeds a second number you nominate (for example, 0.00005). CMPHAR can also be used to compare the values on two Solution files from the same model. To do this, you must first convert the Solution files to Header Array files using the program SLTOHT (see section 8.3 below). Then select CMPHAR option SOL Compare solution files when starting the run. You will need to give CMPHAR the names of the original Solution files as well as of the Header Array versions produced by SLTOHT. When used in this way, CMPHAR reports summaries of the differences in the numerical results for each variable in turn. THE OTHER GEMPACK PROGRAMS Page 8-8 Processing and Reporting Simulation Results - SLTOHT 8.3 Processing and Reporting Simulation Results using SLTOHT The program SLTOHT (SoLution TO Header or Text) can be used to convert any solutions on a Solution file 1. to a Header Array file or 2. to a text file in one of several formats, including one which makes it easy to import the solution values into a spreadsheet program.* The idea of SLTOHT is to make the solution values available for processing or reporting (for example, for producing tables and graphs). SLTOHT breaks up the solutions into several arrays, one corresponding to each variable in the model. For example, if a Solution file from a set of Johansen simulations with Stylized Johansen contains 2 individual column solutions, one subtotal solution and a cumulative solution, making 4 solutions in all, SLTOHT will create o a 2 x 4 array for the variable 'p_XH' showing the values of its 2 components in these 4 different solutions, o a 1 x 4 array for the variable 'p_Y' showing the value of its only component in each of these 4 solutions, o a 2 x 2 x 4 array for variable 'p_XC' showing the values its 4 components in these different solutions (for example, the (1,2,3) entry in this array is the value of p_XC("s1","s2") in the third of these solutions, namely the subtotal solution), and so on. Header Array file output For Header Array file output (this is the default for SLTOHT), SLTOHT writes a Header Array of solution values for each variable in the model. The solutions are selected from solutions on the Solution file. For example, for a variable with 3 arguments, of size (3 x 2 x 4), if you select t solutions from the Solution file, then the Header array written is an 4-dimensional array of size (3 x 2 x 4 x t). The last (that is, the fourth) dimension represents the different solutions you choose in the order (i) any individual solutions, (ii) any subtotal solutions and ________________________ * We are grateful to Kevin Hanslow for suggesting spreadsheet output and for providing us with a prototype implementation of this. THE OTHER GEMPACK PROGRAMS Page 8-9 Processing and Reporting Simulation Results - SLTOHT (iii) the cumulative solution. Each array is associated with a different header on the Header Array file written. You can specify the headers to be used, using an SLTOHT Header Mapping file as described below. If you do not supply such a Mapping file, SLTOHT chooses the headers for you, namely "0001" for variable number 1, "0002" for the next one and so on. SLTOHT Options In addition to the basic SLTOHT function of converting solution values to Header arrays, other options available from the SLTOHT menu ('VAI','SIR','SIC','SS') enable you to create two dimensional arrays with all components of the variable listed on one axis and the different solutions on the other axis. These arrays can be used for tables or graphs, or can be used as input for spreadsheets for further processing, or as shock files in future simulations. Alternative Header Array file output - Variable arguments ignored The alternative form of Header array file output ignores the arguments of variables, treating each variable as if it were a one-dimensional variable. To obtain this output, select option VAI Variable arguments ignored (har output) in the option choice at the start of SLTOHT. In the example above the 3 x 2 x 4 variable would be considered as if it were a one-dimensional variable with 24 components. For a variable z(i,j,k), the order of variable elements is with the first index changing most rapidly (see section 6.1.3). So the 24 components come in the order z(1,1,1), z(2,1,1), z(3,1,1), z(1,2,1), z(2,2,1).... [For example, this is the same order as on a GEMPIE Print file.] As before, you can choose different solutions from the Solution file and output the different solution values as the columns of a 2-dimensional Header array for each variable. In the example above, if t solutions are chosen and option 'VAI' is selected, the Header array for this variable z is of size (24 x t). Text file output To produce a text file, select from the options menu, presented when SLTOHT starts, one of the options below: SIR Solutions in rows (text output) SIC Solutions in columns (text output) SS Spreadsheet (Sols in cols - text) 'SIC' and 'SS' produce as output arrays for each variable in which THE OTHER GEMPACK PROGRAMS Page 8-10 Processing and Reporting Simulation Results - SLTOHT (i) each column specifies a different solution, and (ii) the rows specify the components in turn for a given variable. In the example above of a (3 x 2 x 4) variable, and t different solutions, this will result in output on the text file of an array with 24 rows by t columns for this variable. The variable arguments are ignored (as in option VAI for Header arrays), effectively collapsing the first 3 dimensions into a single dimension to allow the columns to represent different solutions. 'SS' output optionally allows you to specify exactly which variables and which components you wish to output as described below under the heading "Spreadsheet Mapping File". 'SIR' (solutions in rows) is similar to 'SIC' except that (i) each row specifies a different solution, and (ii) columns specify different components of the variable. This, for the example above, gives an array of t rows and 24 columns. In each case for text file output, "how much data" information is output before the data values of the array. Details of the "how much data" information and structure of text files are described in Appendix C. 'SIR' and 'SIC' outputs have only four or five (real) values per line. If the array to be output has more values than this the entries are continued on to the next line until the end of the row is reached. Each row starts on a new line. Option 'SS' allows longer lines, continued to the maximum record length, and is suitable for input to a spreadsheet. The separator between data values can be chosen to be a comma or some other character such as a TAB character. Either no options can be chosen (giving the default Header array output) or only one of 'VAI', 'SIR', 'SIC', 'SS' may be chosen. Below is a section of output from SLTOHT for the variables p_XH and p_XC of Stylized Johansen with the option 'SS' (spreadsheet) chosen. 'SIC' would give similar output. Comments following the exclamation mark ! are output by SLTOHT as a guide to the form of output. THE OTHER GEMPACK PROGRAMS Page 8-11 Processing and Reporting Simulation Results - SLTOHT Sample of spreadsheet text output ! For each variable below columns represent the following solutions: ! 2 INDIVIDUAL column(s), each one giving the solution ! for an individual shock. ! 1 SUB-TOTALS column(s) giving cumulative solutions ! across sub-sets of the complete set of shocks. ! 1 TOTALS column, giving cumulative solutions across ALL shocks. ! For details about the shocks relevant to each column, run GEMPIE. ! ************************ SOLUTIONS ************************ ! Variable p_XH # Household demand for commodity i # ! Showing this as an array of size 2x4 ! Solutions in columns, each row is a different component 2,4, real spreadsheet ; ! The (%1, %2, 1, 1, 1, 1, 1) submatrix with %1=1-2, %2=1-4. +++++++ 0.600000 , 0.400000 , 1.00000 , 1.00000 , 0.700000 , 0.300000 , 1.00000 , 1.00000 , ! Variable p_XC # Intermediate inputs of commodity i to industry j # ! Showing this as an array of size 4x4 ! Solutions in columns, each row is a different component 4,4, real spreadsheet ; ! The (%1, %2, 1, 1, 1, 1, 1) submatrix with %1=1-4, %2=1-4. ++++++ 0.600000 , 0.400000 , 1.00000 , 1.00000 , 0.700000 , 0.300000 , 1.00000 , 1.00000 , 0.600000 , 0.400000 , 1.00000 , 1.00000 , 0.700000 , 0.300000 , 1.00000 , 1.00000 , End of sample Spreadsheet output Choosing solutions for output After you have chosen the initial options, SLTOHT prompts for the Solution file name, reports the contents of the Solution file to the screen and presents a menu of possible solutions to be written to arrays. The range of choices depends on what SLTOHT finds on the Solution file. For example, if the Solution file contains only individual solutions, then the only choice is to write all these solutions, or exit. If the Solution file contains individual, subtotal and cumulative solutions, then the choice is to THE OTHER GEMPACK PROGRAMS Page 8-12 Processing and Reporting Simulation Results - SLTOHT (i) write all of these solutions, (ii) write just the totals (that is, subtotals and cumulative solution), (iii) write just the cumulative solution. The solutions represented by the final dimension in an array have the order: the individual solutions (if chosen), then any subtotals chosen, then the cumulative solution (if present on the Solution file). Shocks and undefined solution values In the solutions, for shocked components of variables, the appropriate shock value (for that solution) is given as the value of the shocked variable in the output array. The solution for any exogenous variable, none of whose components were shocked, is an array of zeros. Some variables may be undefined for a solution if not all endogenous variables were retained on the Solution file. Any component which is undefined for a solution has a very big number entered in its position in the array. This number is currently set at 10**10 (that is, 10 to the power 10). When SLTOHT writes the arrays to the output file, it reports at the screen for each array written (i) the variable name, (ii) the header name, (iii) the size of the array and (iv) the number of such undefined values found. Mapping file There are two types of Mapping files, a Header Mapping file and a Spreadsheet Mapping file. Header Mapping file A Header Mapping file can be used for cases which produce Header Array file output. It is a text file, which maps 4-letter headers to variable names, and also provides some details about the number and size of the dimensions of the variable. Each line of a Header Mapping file must have the following format:
[ ] where
is a 4-letter Header is up to 15 characters long is the number of dimensions for this variable is a list of the number of components in each dimension For example, using the default headers 0001, 0002,... the Header Mapping file for Stylized Johansen solutions is as follows: THE OTHER GEMPACK PROGRAMS Page 8-13 Processing and Reporting Simulation Results - SLTOHT Sample Header Mapping file for Stylized Johansen 0001 p_Y 1 1 0002 p_PC 1 2 0003 p_PF 1 2 0004 p_XCOM 1 2 0005 p_XFAC 1 2 0006 p_XH 1 2 0007 p_XC 2 2 2 0008 p_XF 2 2 2 0009 p_DVCOMIN 2 2 2 0010 p_DVFACIN 2 2 2 0011 p_DVHOUS 1 2 End of Sample Header Mapping file SLTOHT checks the syntax of the Header Mapping file when it is first opened and reports comprehensively on any syntax errors. SLTOHT will also check whether there are any inconsistencies between the details on the Mapping file and the actual solutions found on the Solution file. Usually the Solution file contains information about the dimensions of variables and set sizes involved, and this information is taken into account. If you supply a Header Mapping file containing headers for only some of the variables, only solutions for these variables will be put on the Header Array file produced by SLTOHT. The easiest way of producing such a Mapping file is to edit one produced by SLTOHT. If a Header Mapping file is not chosen, then SLTOHT will create one using a default set of Headers for the variables and using whatever dimensioning information is available on the Solution file to determine the variable dimensions. With Solution files that contain no variable or set information (such as all those created prior to GEMPACK Release 4.2.02), the best that SLTOHT can do is to assume that all variables are one-dimensional with size equal to the total number of components in the variable. The user can then edit this file and use it for subsequent runs of SLTOHT. For example, you can change the headers associated with each vector variable to ones more meaningful than the "0001" and so on used by SLTOHT as a default. Spreadsheet Mapping File It is often useful to flexibly choose variables and components. In the spreadsheet option, you will be asked whether you want to use an existing SPREADSHEET MAPPING file. This file specifies the variables to be output and their components as shown below: THE OTHER GEMPACK PROGRAMS Page 8-14 Processing and Reporting Simulation Results - SLTOHT Sample Spreadsheet Mapping file for Stylized Johansen p_xH p_XC 2-3 1 1 1 ; p_PF 1 2 ; End Sample Spreadsheet Mapping file For a case in which four solutions were requested, this results in the output as shown below (except that, below, the headings for variables p_XC and p_PF have been omitted). Sample of spreadsheet text output using mapping file ! ************************ SOLUTIONS ************************ ! Variable p_XH # Household demand for commodity i # ! Showing this as an array of size 2x4 ! Solutions in columns, each row is a different component. ! First column must be removed before using array as GEMPACK input 2 , 4 , real spreadsheet ; p_XH(1), 0.600000 , 0.400000 , 1.00000 , 1.00000 , p_XH(2), 0.700000 , 0.300000 , 1.00000 , 1.00000 , 5 , 4 , real spreadsheet ; p_XC(2), 0.700000 , 0.300000 , 1.00000 , 1.00000 , p_XC(3), 0.600000 , 0.400000 , 1.00000 , 1.00000 , p_XC(1), 0.600000 , 0.400000 , 1.00000 , 1.00000 , p_XC(1), 0.600000 , 0.400000 , 1.00000 , 1.00000 , p_XC(1), 0.600000 , 0.400000 , 1.00000 , 1.00000 , 2 , 4 , real spreadsheet ; p_PF(1), -0.400000 , 0.400000 , 0.000000E+00, 0.000000E+00, p_PF(2), 0.600000 , -0.600000 , 0.000000E+00, 0.000000E+00, End of sample spreadsheet output The rules for a Spreadsheet Mapping file are as follows. o Variable names must start in the first position in a line. o Components are listed in one or more lines immediately following the variable name. All such lines must be indented at least one space to the right and the final line terminated with a semi-colon. THE OTHER GEMPACK PROGRAMS Page 8-15 Processing and Reporting Simulation Results - SLTOHT o Variables with no components specified will have all components output. o Variables not specified will not appear on the output. o Components may be repeated and may be in any order. o Multidimensional arrays are treated as linear; thus p_XC(3) above refers to p_XC("s1","s2"). o Fatal errors occur if you don't indent, specify a component outside the range or leave out the semi-colon. Description File You can also elect, by choosing the option DES Write description file at the start of SLTOHT, to produce a Description file. This is a file which contains the following information, in the stated order : (a) The verbal description of the simulation as entered originally when you ran SAGEM, GEMSIM or the TABLO-generated program to create the Solution file. The description is terminated by a line beginning with '*'. (b) If individual solutions are chosen, for each individual solution, the name and component number of the shock which gave rise to that solution. Each such individual description is terminated by a line beginning with '*'. The component number is reported as if the shocked variable were one dimensional. (c) If subtotal solutions are chosen, for each subtotal solution, the description of that subtotal, as entered by the user in SAGEM, terminated by a line beginning with '%'. Then a list of the names (one name per line) of those variables of which there is at least one shocked component that contributed to this subtotal. Each such subtotal description is terminated by a line beginning with '*'. (d) If the cumulative solution is on the Solution file, a list of the names (one name per line) of the variables of which there is at least one shocked component. The cumulative totals description is terminated by a line beginning with '*'. THE OTHER GEMPACK PROGRAMS Page 8-16 Transferring Models Between Machines 8.4 Transferring Models Between Machines Once you have implemented a model using GEMPACK, you or a colleague may wish to transfer the model to a different machine also running GEMPACK. The essential ingredients of a model are (1) the TABLO Input file, and (2) the data file(s). Also helpful in using the model on a different machine are (3) any relevant Stored-input or GEMPACK Command files, such as those for running TABLO (especially if condensation is required), for specifying the closure, or for carrying out simulations. The idea is to transfer these files and then to re-implement the model by running GEMPACK on the new machine. Alternatively, you may wish to transfer just the ability to carry out Johansen simulations with the model. In this case you need to transfer (4) the Equations file and any relevant Stored-input or GEMPACK Command files. If you are transferring to a machine with the same operating system (for example, from one DOS 80386 machine to another), you can probably just copy the relevant files to this machine.* If, however, your target machine has a different operating system (for example, you are transferring from an 80386 DOS machine to an Apple Macintosh or to a mainframe), copying files will not succeed. GEMPACK contains several programs (namely MKHAR, RWHAR, MKEQ, RWEQ and SPJNTX) which make it easy to transfer models by following the procedures described below. The rest of this section is devoted to transferring between different operating systems. When transferring between different operating systems, there are two basic principles. (1) Text files can be transferred directly. (2) Binary files must be converted to text files first. TABLO Input, Stored-input and GEMPACK Command files are all text files. But data files for models can be either binary (if they are Header Array files) or text. Equations files are binary files. _________________ * However, this may not always be appropriate. The strict test is whether or not the machines are "binary compatible". For example, it is possible to have two different Unix machines which are not binary compatible. In such a case, follow the procedure in the rest of this section, first converting binary files to text files. THE OTHER GEMPACK PROGRAMS Page 8-17 Transferring Models Between Machines Note that text files can be transferred between different machines in several ways including o between mainframes and PCs by utilities such as Kermit, o between any two computers by electronic transfer utilities such as FTP, o between DOS PCs and Apple Macintosh PCs using Apple File Exchange (a utility on most recent Macintoshes), o between mainframes using tapes (or using Kermit or some similar program if a PC is an intermediary). 8.4.1 Transferring the Whole Model Suppose that you wish to transfer a model from Machine 1 to Machine 2. Step 1. On Machine 1, convert any Header Array data files for the model to text files by running the GEMPACK program RWHAR. (Run it once for each such Header Array file. The program requires just two inputs, firstly the name of the existing binary Header Array file and secondly the name of the text file to be created.) Step 2. Transfer the TABLO Input file, the text versions of any data files and any Stored-input or GEMPACK Command files to Machine 2. Step 3. On Machine 2, convert any text versions of Header Array files back to binary files by running the GEMPACK program MKHAR. (Run it once for each Header Array file. The program requires just two inputs, firstly the name of the text version of the Header Array file and secondly the name of the binary Header Array file to be created.) Step 4. Reimplement the model on Machine 2 by running TABLO etc. Below we illustrate this for a model with just one data file MODEL.DAT which is a Header Array file. In this diagram "--->" indicates file transfer between the machines. Machine 1 Machine 2 TABLO Input file (text) MODEL.TAB -------> MODEL.TAB Header Array data file MODEL.DAT (binary) | (run RWHAR) | MODEL.HAF --------> MODEL.HAF | (run MKHAR) | MODEL.DAT Stored-input or MODEL.STI --------> MODEL.STI GEMPACK Command files MODEL.CMF --------> MODEL.CMF THE OTHER GEMPACK PROGRAMS Page 8-18 Transferring Johansen Simulation Capability 8.4.2 Transferring Johansen Simulation Capability Because each Equations file is a binary file, it must be converted to a text file on Machine 1, then transferred, and finally converted back to a binary file on Machine 2. The GEMPACK program RWEQ converts a binary Equations file to a text file while the program MKEQ converts the text version of an Equations file back to a binary file. Machine 1 Machine 2 Equations file (binary) MODEL.EQ4 | (run RWEQ) | MODEL.EQF --------> MODEL.EQF | (run MKEQ) | MODEL.EQ4 Stored-input or SIM1.STI --------> SIM1.STI GEMPACK Command files SIM2.CMF --------> SIM2.CMF 8.4.3 Handling Large Data Files The data files for models can be quite large, which may present a problem in transferring the model. This is exacerbated for Header Array files since the text version (produced by RWHAR) is always much larger than the binary version. Because of this, it may be necessary to split a text file into several parts before transferring it (perhaps to fit them onto disks if a PC is involved). This is what the GEMPACK program SPJNTX (SPlit or JoiN TeXt files) is designed to do. For example, if you have a text file MODEL.HAF of size 4 megabytes (approximately 4 million characters), you can use SPJNTX on Machine 1 to split this into 6 files each of which will fit onto a 720K disk (that is, a disk holding about 720,000 characters). Then you can transfer these files (each on one disk) to Machine 2 and then run SPJNTX on Machine 2 to joint the files together again. Splitting a File Run SPJNTX, and select the default program options. (1) Respond 's' to the first prompt to indicate you want to split a file. (2) Respond '80' (the default) to the prompt asking the "maximum number of characters per line". (3) Your answer to the third prompt about the "maximum number of characters in each output file" will be determined by the size of output files you can handle. If, for example, you want each output file to fit onto one 720K disk, respond say '700000' (to allow a little safety margin from the maximum of THE OTHER GEMPACK PROGRAMS Page 8-19 Handling Large Data Files - SPJNTX about 720,000 characters per disk). (4) Respond 'n' (the default) to the prompt about omitting trailing blanks. (5) Give the name of the input file (the file to be split). (6) SPJNTX will produce as many output files as required, and will prompt you for the names of these one at a time. It will help you to put them back together if you give names which indicate their order, such as MODEL.1, then MODEL.2, and so on. Joining Files (1) Respond 'j' to the first prompt to indicate you want to join files. (2) Respond '80' (the default) to the prompt asking the "maximum number of characters per line". (3) Respond 'n' (the default) to the prompt about omitting trailing blanks. (4) Give the name of the output file (the joined file). (5) When prompted, give the name of the next file to be added (for example, MODEL.1, MODEL.2, and so on). After the last one has been joined in, respond to the next prompt with a carriage-return to indicate that there are no more files. 8.5 Submatrix Data and Set-up Files The programs ASSEQ, AMST, SEESMD, SUMSMD and SEEST are provided for models spread over several TABLO Input files or needing to be split into submodels (perhaps because of memory limitations*). Only Johansen simulations can be carried out in such cases. We expect that these features will not be needed by new users of GEMPACK. However we have retained these programs in Release 5 purely for users of earlier versions of GEMPACK who have models still relying on them. Accordingly, we say nothing more here about these programs, as we expect that those using them will already be familiar with their use and features. We encourage users with models implemented via these programs to update their models into a single TABLO Input file, and to add UPDATE statements so that they can carry out multi-step simulations. This will also mean that variable and component labelling will automatically appear on GEMPIE Print files. _________________ * Now that memory for PCs has become relatively cheap and that PCs can access much more than 8 megabytes of memory, memory limitations are unlikely to be the serious problem they were a couple of years ago. THE OTHER GEMPACK PROGRAMS Page 8-20 Comparing Results from Different Machines 8.6 Comparing Results from Different Machines The programs COMPEQ, RWSL and CMPSOL were developed to check that, when GEMPACK is moved to machines other than those on which it was developed, it is producing correct numerical results. The different arithmetic on different machines is almost certain to produce slightly different results but we need to check that any differences found are within the limits expected. COMPEQ is for comparing two Equations files (usually one produced on the machine in question and the other moved from our VAX/VMS machine after first converting it to a text file using the program RWEQ). It tells how different the numerical values are. RWSL is for converting simulation results (on a Solution file) to a text file. Then they can be moved to another machine and compared (using CMPSOL) with the results obtained on the new machine. As with CMPHAR (see section 8.2.3 above) these programs report totals, averages and largest absolute differences and difference ratios. It is unlikely that modellers will need to use these programs. Any user requiring more information about them should consult us at the Impact Project. CHAPTER 9 A GUIDE TO THE REST OF THE DOCUMENTATION This document is the first of the GEMPACK documents most users should read.* The other documents are o a User's Guide to TABLO, GEMSIM and TABLO-generated programs (GPD-2), o documentation of MODHAR (GPD-3) and o machine specific documentation (GPD-5,GPD-5B for Macintosh PCs and GPD-6,GPD-6B for 386/486 DOS PCs).** Users of GEMPACK on VAX/VMS, DEC Alpha/VMS and Unix machines should also be able to obtain machine-specific information from their GEMPACK Managers. (These are brief documents not included in the GPD series.) Later there may be a replacement for the pre-Release-5 GED-12 to describe how to install GEMPACK on machines other than VAX/VMS, DEC Alpha/VMS, Unix, DOS 386/486 and Macintosh. 9.1 Other Relevant Publications Background about the rationale for the development of GEMPACK can be found in Pearson (1988) and Codsi and Pearson (1988); these both describe GEMPACK before multi-step solutions were incorporated. An earlier version of just the Johansen simulation parts (SAGEM and GEMPIE) of GEMPACK published for use with DPPW is Pearson (1992). The procedure for implementing and solving intertemporal models via GEMPACK is given in Codsi et al (1992). A discussion of the pros and cons of implementing models via levels or linearized representations can be found in Hertel et al (1992). Suggestions about the desirability of working with mixed representations of models (that is, some levels and some linearized equations) can be found in Harrison et al (1993a) and (1993b). ____________ * The numbering of GEMPACK Documents has been re-started with Release 5 of GEMPACK, when the abbreviation "GPD" was first used. Previous editions of these documents did not have the same numbers as the current editions. Pre-Release-5 documents are numbered "GED-xx". ____________ ** Document GPD-4, Implementing Levels Models Directly Using GEMPACK (First edition, April 1993) is now superseded. (Its contents are included in the current versions of GPD-1 and GPD-2.) APPENDIX A APPENDIX A - GEMPACK COMMAND FILES FOR SIMULATIONS Command files were introduced in sections 2.2.3, 2.3.1 (Figure 2.3.1) and 2.4 (Figure 2.4b); they can be used to run simulations with GEMSIM, TABLO-generated programs or SAGEM.* In this appendix we give a complete list of the commands which can be used in GEMPACK Command files for running GEMSIM or TABLO-generated programs (see section A.1 below) and SAGEM (see section A.2 below). Section 5.7 contains advice about identifying and eliminating syntax errors in Command files. In this appendix, the actual commands are shown in bold; the surrounding text is commentary. A.1 Command Files for GEMSIM and TABLO-generated Programs The detailed rules for preparing Command files for running GEMSIM and TABLO-generated programs are set out below. In the commands listed below, note the following. (1) "|" indicates alternatives. For example, 'method = johansen|euler|midpoint|gragg ;' means that any of 'method = johansen ;', 'method = euler ;', 'method = midpoint ;' or 'method = gragg ;' is accepted. (2) < > shows user-selected text. All other text is required (but may be abbreviated as explained under "General Points" below). (3) [ ] indicates optional user-selected text. (4) If a default is specified, this is the value if no such command is given. ____________ * We are grateful to Peter Wilcoxen for suggesting the use of Command files and for providing us with a prototype implementation. We are also grateful to Darren Condon (La Trobe University) who wrote much of the current GEMPACK software for handling these files. Appendix A - GEMPACK Command Files Page A-2 Command Files for GEMSIM and TABLO-generated Programs LIST OF COMMANDS ACCEPTED ON GEMPACK COMMAND FILES FOR RUNNING GEMSIM OR TABLO-GENERATED PROGRAMS METHOD AND STEPS method = johansen|euler|midpoint|GRAGG ; ! gragg is the default ! EXAMPLE. method = gragg ; steps = ; ! There is no default ! EXAMPLE. steps = 2 4 6 ; ! (There is no longer automatic ! doubling of step numbers, since this is unnecessary.) ! If you specify just one step number, a single multi-step ! simulation is done. ! If you specify two or three, extrapolation is done also. subintervals = ; ! Default is 1. ! EXAMPLE. subintervals = 10 ; ! (See section 5.8 of GPD-2 for information about this.) DATA FILES file = ; ! for original data files or for ! new (WRITE) files ! This is not necessary if the actual file ! name is given in the TABLO Input file ! EXAMPLE. file iodata = sj.dat ; ! include suffix updated file = ; ! for final updated data ! EXAMPLE. updated file iodata = sjlb.upd ; ! include suffix updated terminal data = ; ! for the updated version of ! data read initially from the terminal ! EXAMPLE. updated terminal data = sjlb_term.upd ; intermediate file = ; ! For intermediate updated versions. ! NO SUFFIX in ; '.UD3', '.UD4' etc will be added. ! On most machines, if you use a suffix of length 3 (such as ! '.UPD') for the updated version, the default is to use the ! name minus this suffix. Then no 'intermediate file' commands ! need to be included. ! See section 5.14.1 of GPD-2 for the default if an "intermediate ! file" statement is not included for any logical file. ! EXAMPLE. intermediate file iodata = sjlb ; intermediate extra data = ; ! For intermediate updated versions of data read initially from ! the terminal or from text files, or whose initial values are ! assigned via FORMULA(INITIAL) statements. ! NO SUFFIX. As above, suffixes '.UD3' etc will be added. ! Default is "GPXXX" - see section 5.14.1 of GPD-2. ! EXAMPLE. intermediate extra data = sjlb_term ; ! NOTE. Often no 'intermediate file ...' or 'intermediate extra ...' ! commands are necessary since the defaults will usually suffice. ! (See section 5.14 in GPD-2 for advice on choosing names for ! updated data files so that defaults for intermediate updated ! file names give valid file names and for information as to ! when an 'intermediate extra' file is needed.) Appendix A - GEMPACK Command Files Page A-3 Command Files for GEMSIM and TABLO-generated Programs EQUATIONS AND BCV FILES Equations file = ; ! To create a new Equations file ! Then new BCV file is given same name (but different suffix) ! EXAMPLE. Equations file = sj ; ! omit suffix '.eq4' model = ; ! to specify the model name in a new Equations file ! EXAMPLE. model = sj ; version = ; ! to specify the version number on a new ! Equations file. DEFAULT is 1. ! EXAMPLE. version = 3 ; identifier = ; ! to specify the model identifier ! on a new Equations file ! DEFAULT is all blanks ! EXAMPLE. identifier = SJ, standard data ; use Equations|BCV file ; ! To use existing Equations ! and BCV files ! If you specify an Equations file to use, the ! default is to use a BCV file with the same name ! (unless you have a separate 'use BCV file' command) ! EXAMPLE. use Equations file sj ; ! no suffix BCV file = ; ! To specify the name of the (new) BCV (Base Coefficient Values) ! file to be created. ! Only needed when an Equations file is not going to be ! created (perhaps because you using option NSE - see ! section 5.6.1 of GPD-2 - when running GEMSIM or a ! TABLO-generated program). ! EXAMPLE. BCV file = sj ; ! omit suffix '.bcv' Appendix A - GEMPACK Command Files Page A-4 Command Files for GEMSIM and TABLO-generated Programs OTHER FILES Solution file = ; ! EXAMPLE. Solution file = sjlb ; ! omit suffix '.sl4' display file = ; ! include suffix ! EXAMPLE. display file = sj.dsp ; Extrapolation Accuracy file = yes|NO ; ! default is NO ! Use 'yes' to get one. ! One is not created unless you are extrapolating ! from two or three multi-step solutions. ! (In Release 4.2.02 of GEMPACK, these were ! called 'formatted solution' or 'SLX' files.) ! EXAMPLE. extrap acc file = yes ; Auxiliary files = ; ! (a) GEMSIM (see section 5.9.2 of GPD-2) ! This statement is mandatory. ! It specifies the names of the GEMSIM Statement and ! Table files. ! EXAMPLE. Auxiliary files = sj ; ! no suffix ! (b) TABLO-generated programs (see section 5.9.1 of GPD-2) ! This is for name of Auxiliary Statement and Table files. ! Your TABLO-generated program contains a default name which ! is usually ok. Only use this if you need to change it ! (perhaps to indicate the directory these are in). ! This corresponds to option NAX (see section 5.9.1 of GPD-2). ! EXAMPLE. Auxiliary files = \sj\sj ; ! no suffix Submatrix Data file = ; ! if your program produces ! a Submatrix Data file ! EXAMPLE. Submatrix Data file = sj ; ! no suffix Set-up file = ; ! if your program produces a Set-up file ! EXAMPLE. Set-up file = sj ; ! no suffix Appendix A - GEMPACK Command Files Page A-5 Command Files for GEMSIM and TABLO-generated Programs CLOSURE RELATED ! The use of these commands is discussed in section 6.1.2. use Environment|LU file ; ! EXAMPLE. use Environment file sjxfac ; ! omit suffix '.en4' ! If 'use Environment file', just the closure is read from it. ! If 'use LU File', the closure AND LU decomposition are read ! from it. ! You cannot 'use LU file' unless you are also using ! existing Equations and BCV files. take closure from Environment|LU|Solution file ; ! EXAMPLE. take closure from LU file sjxfac ; ! omit suffix '.lu4' ! If 'take closure from LU File', the closure is read from it, ! but the LU decomposition is calculated from scratch. ! Note that 'take closure from Environment file' has exactly the ! same effect as 'use Environment file'. modify closure from Environment|LU|Solution file ; ! The closure is read from this file. Then you use 'swap', ! 'exogenous' and/or 'endogenous' commands (see below) to ! modify this closure. ! If 'modify closure from LU file', the LU decomposition ! on the file is not used. swap = ; ! v1 v2 are variables ! EXAMPLES. swap v1 1-3 = v2 6-8 ; swap p_XF("labor","s1") = cR ; exogenous|endogenous ... ; rest exogenous|endogenous ; ! EXAMPLE. exogenous xfac p_XF("labor",SECT) facind 3-15 phi ; ! rest endogenous ; save Environment|LU file ; ! EXAMPLE. save LU file sj1 ; ! omit suffix '.lu4' Appendix A - GEMPACK Command Files Page A-6 Command Files for GEMSIM and TABLO-generated Programs HARWELL PARAMETER Harwell parameter = ; ! default is 0.1 ! EXAMPLE. Harwell parameter = 0.4 ; SHOCK RELATED ! The use of these commands is discussed in section 6.3.1. ! Default is that all exogenous variables are shocked ! with all shocks equal to 1.0 shock = file ; ! read shocks from this file ! EXAMPLE. shock v1 = file v1.shk ; shock = uniform ; ! all components (in list) given the same shock ! EXAMPLE. shock v1 = uniform 0.3 ; shock = ; ! If present, the component numbers in ! component_list must be in increasing order. ! EXAMPLES. shock v1 2 4 6 = 0.2 0.4 -0.1 ; ! shock p_XF("labor",SECT) = 0.2 0.4 ; shock = select from file ; ! Read shocks from this file and select ! values corresponding to components listed ! EXAMPLE. shock v1(IND) = select from file v1.shk ; shock = select from ; ! Select shock values corresponding to ! components listed ! (If present, the component numbers in ! component_list must be in increasing order.) ! EXAMPLE. shock v1 2 4 = select from 0.1 0.2 0.4 -0.1 ; ! This shocks components 2 and 4 by 0.2 and -0.1 respectively. ! You need one 'shock' command for each variable all ! or some of whose components are shocked. Appendix A - GEMPACK Command Files Page A-7 Command Files for GEMSIM and TABLO-generated Programs CUMULATIVELY-RETAINED ROWS ! The use of these commands is discussed in section 6.2.1. cumulatively-retained endogenous ; ! default is: all endogenous variables ! (including any variables backsolved for) where the things in can be any of %all ! this means all (endogenous) %macro ! this means macros [i.e. variables with 1 component] ! (which are endogenous) %scalar ! this means the same as '%macro' ... such as (COM) (COM,IND) ... ! EXAMPLE. ! cum endog p_XFAC p_XF("labor",SECT) %macro (SECT,FACT) pcom 1-2 ; VERBAL DESCRIPTION verbal description = etc, until ; ! last line ENDS with ; ! (There can be other ';' earlier, as long as they are not ! at the end of their line.) ! EXAMPLE. verbal description = Stylized Johansen; standard data. Labor shock. ; VARIABLES ON EXTRAPOLATION ACCURACY FILE XAC-retained ; ! default is all endogenous variables ! (including any variables backsolved for) ! Things in as for 'cumulatively-retained endogenous' ! Only has effect if 'Extrapolation Accuracy file = yes ;' ! command is included (see above) Appendix A - GEMPACK Command Files Page A-8 Command Files for GEMSIM and TABLO-generated Programs GEMSIM AND TABLO-GENERATED PROGRAM OPTIONS log file|only = ; ! default is no log file ! EXAMPLE. log file = sjlb.log ! include suffix ! Use 'log file = ... ;' to direct output to both the ! terminal and a Log file. ! Use 'log only = ... ;' to direct output to just the ! Log file (not to the terminal). ! For more details, see section 5.3.3 above. simulation = YES|no ; ! default is YES. Use 'simulation = no ; to ! just create an Equations file, for example. ! This corresponds to option NSM - see section 5.6 of GPD-2. ! The commands below correspond to some of the options ! offered at the start of TABLO-generated programs or ! the "Further Options" screen for GEMSIM. (Unless ! stated otherwise, these options are documented ! in sections 5.3-5.9 of GPD-2.) CPU = yes|NO ; ! default is NO. Use 'CPU = yes ;' to ! get CPU times reported. (This may not produce ! meaningful results on some machines - see ! section 5.7 of GPD-2.) EAA = yes|no ; ! See section 5.7 of GPD-2 to see what ! "echoing activity" means. ! (a) If you are carrying out a simulation, the default is NO ! which means activity is only echoed during the first step. ! In this case, use "eaa = yes ;" to have activity echoed ! during all steps of a multi-step calculation. ! (b) If you are not carrying out a simulation, the default ! is YES which means all activity is echoed. In this case, ! use "eaa = no ;" to have no activity echoing. NRP = yes|NO ; ! default is NO. Use 'NRP = yes ;' to not ! reuse pivots. NSC = yes|NO ; ! default is NO. Use 'NSC = yes ;' to delete ! new BCV (Base Coefficient Values) file. NSE = yes|NO ; ! default is NO. Use 'NSE = yes ;' if you ! do not want to save an Equations file - see ! section 5.6.1 of GPD-2 for details. NEQ = yes|NO ; ! default is NO. Use 'NEQ = yes ;' to do no ! equations, only formulas etc (hence no simulation). NDS = yes|NO ; ! default is NO. Use 'NDS = yes ;' to do no displays. NWR = yes|NO ; ! default is NO. Use 'NWR = yes ;' to do no writes. NUD = yes|NO ; ! default is NO. Use 'NUD = yes ;' to do no FINAL ! updates. Intermediate ones will still be done. Appendix A - GEMPACK Command Files Page A-9 Command Files for GEMSIM and TABLO-generated Programs NIR = yes|NO ; ! default is NO. Use 'NIR = yes ;' to turn off ! iterative refinement of solutions. IZ1 = YES|no ; ! default is YES. Use 'IZ1 = no ;' to keep ! coefficients which are zero at step 1.* KZ2 = yes|NO ; ! default is NO. Use 'KZ2 = yes ;' to keep ! coefficients which are zero at steps 2,3,... NWE = yes|NO ; ! default is NO. Use 'NWE = yes ;' to suppress ! any warnings about equations not being solved ! accurately. RQF = ; ! to change the default number of figures agreement ! required for '"machine accuracy" on ! Extrapolation Accuracy files. ! (See section 5.6.2 of GPD-2 for details about the options below.) DWS = yes|NO ; ! default is NO. Use 'DWS = yes ;' to do terminal ! writes and displays at all steps. TWC = yes|NO ; ! default is NO which means writes to the ! terminal will be done in row order. ! Use 'TWC = yes ;' to do such writes in column order. display width|length|decimals = ; ! to change page ! width or length, or number of figures after ! decimal point, in display files. ! Width must be between 70 and 200, length at ! least 20 and decimals between 0 and 10. ! (These correspond to options DPW,DPL,DDC - see ! section 5.6.2 of GPD-2.) DPN = yes|NO ; ! default is NO. ! Use 'DPN = yes ;' to ensure that new pages are ! started in display files only when needed. D1C = yes|NO ; ! default is NO, which means that a 1-dimensional ! array is displayed as a row (across the page). ! Use 'D1C = yes ;' to have each such array displayed ! as a column (down the page). DOI = yes|NO ; ! default is NO. ! Use 'DOI = yes ;' to suppress "identical" row ! messages on display files. NEL = yes|NO ; ! default is NO. ! Use 'NEL = yes ;' to suppress element name/number ! labels on row_order or col_order text files. __________________ * This is a change from Release 5.0 when "IZ1 = NO ;" was the default - see section 5.4.1 of GPD-2. Appendix A - GEMPACK Command Files Page A-10 Command Files for GEMSIM and TABLO-generated Programs GENERAL POINTS 1. Input is free-form and case-independent. In particular, statements can extend over more than one line, such as exogenous pfac xcom xfacin 1-4 6-19 yfacin z ; It doesn't matter if your command is 'Equations file = ... ' or 'equations FILE = ... '. 2. "|" indicates alternatives. 3. < > shows user selected text; all other text is required, but words in it can be abbreviated once they become unique. (For example, 'sol fil = sjlb ;' is an acceptable abbreviation for 'solution file = sjlb ;' but 's file = sjlb ;' is not accepted since 's' is too short to distinguish between possible first words such as 'solution', 'swap', 'shock', for example. However you cannot abbreviate user-selected input such as the names of variables or '%macro'.) 4. [ ] indicates optional user-selected text. 5. If a default is specified, this is the value if no such command is given. When a default is specified, the default action will take place if you omit the command. For example, if you have no command 'Harwell parameter = ... ', the parameter will be set to 0.1. If the command is mandatory and has no default, the program will stop with an error, telling you the input is missing. 6. COMMENTS. A single exclamation mark ! in a line causes all the rest of that line to be ignored (and so can be used as a comment). This is true everywhere in the input. Note that (unlike TABLO Input files) a comment does not need a finishing !. Each comment finishes at the end of the line it starts on (though it can be continued by putting ! at the start of the next line). If you actually want an exclamation mark (for example, in the verbal description), just put in a pair !!, which will be treated as one and the rest of the line will still be read. For example, Shocks only given to domestic inputs!! Foreign ones given no shock. 7. Although the idea is to have order-independent input, the order of the statements can be important in choosing a closure. Then the relevant statements (those beginning 'exogenous', 'endogenous' or 'swap') are processed in the order they appear in the command file. [Clearly the order can affect the result and/or validity of the commands, as the following example makes clear: exogenous y ; endogenous y 1 ; swap y 1 = z 5 ; ] Appendix A - GEMPACK Command Files Page A-11 Command Files for GEMSIM and TABLO-generated Programs 8. Specifying all or some components of a variable. In the statements above, the notation or covers three possibilities, as described below.* (a) Components can be indicated by number, for example x3 2-12 15-20 (b) The variable name can be followed by sets and/or element names as arguments, for example p_XF("labor", SECT) In this case there must be no space between the end of the variable name and the "(" starting the arguments. (c) If a variable name is not followed by component numbers as in (a) above or by arguments as in (b) above, this means all components of the variable. 9. SHOCKS. The components must be specified in increasing order, as in shock v1 3 4 8 10 = 1.1 4.4 3.3 2.4 ; 10. Shocks can be input using the repeated value format as described in section 6.3.3. For example, shock v1 3 4 8 10 12-16 = 3*1.345 4.4 5*-2.1 ; 11. To shock some components of a multi-dimensional variable, remember that the first index varies fastest (see section 6.1.3) and specify component numbers accordingly. For example, for a 3x5 variable V, to shock V(2,1), V(3,1), V(2,2), shock v 2 3 5 = 4.5 2.0 1.0 ; ___________________ * Possibility (b) is new for Release 5.1. Appendix A - GEMPACK Command Files Page A-12 Command Files for GEMSIM and TABLO-generated Programs COMPLETE EXAMPLE !__________________________________________________________________ ! ! The following GEMPACK Command file will run the TABLO-generated ! program for the Stylized Johansen model to carry out a ! multi-step simulation. ! ! Solution method information ! method = gragg ; ! could be omitted as this is the default steps = 2 4 6 ; file iodata = sj.dat ; updated file iodata = sjlbg.upd ; extrapolation accuracy file = yes ; ! ! Simulation part ! equat file = sj ; ! creates a new Equations file model = sj ; version = 1 ; ! (Could be omitted as this is the default) identifier = Stylized Johansen. Standard data ; solut file = sjlbg ; use Environment file sjxfac ; shock p_xfac 1 = 10 ; harwell parameter = 1 ; verbal description = Increase labor by 10 per cent. Standard closure. Gragg's method - 2,4,6 steps ; ! ! Options (just examples) ! log file = sjlbg.log ; ! output goes to log file and ! also to terminal CPU = yes ; ! report CPU times !_________________________________________________________ Appendix A - GEMPACK Command Files Page A-13 Command Files for Running SAGEM A.2 Command Files for Running SAGEM The commands in Command files for running SAGEM are similar to the relevant ones (dealing with closure, shocks etc) for GEMSIM and TABLO-generated programs. The details are given below. LIST OF COMMANDS ACCEPTED ON SAGEM COMMAND FILES use Equations file ; ! MANDATORY ! EXAMPLE. use Equations file sj ; ! omit suffix '.eq4' Solution file = ; ! MANDATORY ! EXAMPLE. Solution file = sjlb ; ! omit suffix '.sl4' save Environment|LU file ; ! EXAMPLE. save LU file sj1 ; ! omit suffix '.lu4' Harwell parameter = ; ! default is 0.1 ! EXAMPLE. Harwell parameter = 0.4 ; CLOSURE RELATED ! The use of these commands is discussed in section 6.1.2. use Environment|LU file ; ! EXAMPLE. use Environment file sjxfac ; ! omit suffix '.en4' ! If 'use LU File', the closure AND LU decomposition are read ! from it. ! If 'use Environment file', just the closure is read from it. take closure from Environment|LU|Solution file ; ! EXAMPLE. take closure from LU file sjxfac ; ! omit suffix '.lu4' ! If 'take closure from LU File', the closure is read from it, ! but the LU decomposition is calculated from scratch. ! Note that 'take closure from Environment file' has exactly the ! same effect as 'use Environment file'. modify closure from Environment|LU|Solution file ; ! The closure is read from this file. Then you use 'swap', ! 'exogenous' and/or 'endogenous' commands (see below) to ! modify this closure. ! If 'modify closure from LU file', the LU ! decomposition on the file is not used. swap = ; ! v1 v2 are variables ! EXAMPLES. swap v1 1-3 = v2 6-8 ; swap p_XF("labor","s1") = p_cR ; exogenous|endogenous ... ; rest exogenous|endogenous ; ! EXAMPLE. exogenous xfac pcom facind 3-15 phi ; ! rest endogenous ; Appendix A - GEMPACK Command Files Page A-14 Command Files for Running SAGEM SHOCK RELATED ! The use of these commands is discussed in section 6.3.1. ! Default is that all exogenous variables are shocked ! with all shocks equal to 1.0 shock = file ; ! read shocks from this file ! EXAMPLE. shock v1 = file v1.shk ; shock = uniform ; ! all components (in list) given the same shock ! EXAMPLE. shock v1 = uniform 0.3 ; shock = ; ! If present, the component numbers in ! component_list must be in increasing order. ! EXAMPLE. shock v1 2 4 6 = 0.2 0.4 -0.1 ; shock = select from file ; ! Read shocks from this file and select ! values corresponding to components listed ! EXAMPLE. shock v1(IND) = select from file v1.shk ; shock = select from ; ! Select shock values corresponding to ! components listed ! (If present, the component numbers in ! component_list must be in increasing order.) ! EXAMPLE. shock v1 2 4 = select from 0.1 0.2 0.4 -0.1 ; ! This shocks components 2 and 4 by 0.2 and -0.1 respectively. ! You need one 'shock' command for each variable all ! or some of whose components are shocked. Appendix A - GEMPACK Command Files Page A-15 Command Files for Running SAGEM INDIVIDUALLY-RETAINED AND CUMULATIVELY-RETAINED ROWS/COLUMNS ! The use of these commands is discussed in section 6.2.1. individually-retained exogenous|endogenous ; ! default for individually-retained exogenous is: none ! default for individually-retained endogenous ! is: all endog variables cumulatively-retained endogenous ; ! default is: all endogenous variables where (in all cases) the things in can be any of %all ! this means all of the appropriate set (shocked ! or endogenous) %none ! this means none of the appropriate set %macro ! this means macros [i.e. variables with 1 component] ! in the appropriate set) %scalar ! this means the same as '%macro' ... such as (COM) (COM,IND) ... ! EXAMPLE. cum endog p_XFAC %macro (SECT,FACT) pcom 1-2 ; SUBTOTALS subtotal ... = ; ! The shocks to sum over to produce the subtotal are ! those given to all the variables and components ! listed before the '=' sign. ! EXAMPLE. subtotal fe 1-10 15-20 pm = subtotal 2 ; VERBAL DESCRIPTION (MANDATORY) verbal description = etc, until ; ! last line ENDS with ; ! (There can be other ';' earlier, as long as they are not at ! the end of their line.) ! EXAMPLE. verbal description = Stylized Johansen; standard data. Labor shock. ; Appendix A - GEMPACK Command Files Page A-16 Command Files for Running SAGEM SAGEM OPTIONS ! These correspond to some of the options offered at the start ! of SAGEM. log file|only = ; ! default is no log file ! EXAMPLE. log file = sjlb.log ! include suffix ! Use 'log file = ... ;' to direct output to both the ! terminal and a Log file. ! Use 'log only = ... ;' to direct output to just the ! Log file (not to the terminal). ! For more details, see section 5.3.3 above. simulation = YES|no ; ! default is YES. Use 'simulation = no ;' to ! just specify closure. ! (This corresponds to option NSM - see ! section 7.6.1.) CPU = yes|NO ; ! default is NO. Use 'CPU = yes ;' to get CPU ! times reported. (This may not produce meaningful ! results on some machines - see section 7.6.1.) NIR = yes|NO ; ! default is NO. Use 'NIR = yes ;' to turn off ! iterative refinement of solutions. KZC = yes|NO ; ! default is NO. Use 'KZC = yes ;' to have SAGEM ! keep coefficients which are zero. NWE = yes|NO ; ! default is NO. Use 'NWE = yes ;' to suppress ! any warnings about equations not being solved ! accurately. GENERAL POINTS [These are just as for Command files for GEMSIM and TABLO-generated programs.] Appendix A - GEMPACK Command Files Page A-17 Command Files for Running SAGEM COMPLETE EXAMPLE. !__________________________________________________________________ ! ! The following GEMPACK Command file will run SAGEM to carry out ! a simulation with Stylized Johansen, specifying the ! standard closure and shocking labour supply by 10 per cent. ! Only macro variables and those with one argument ranging over ! the set SECT or FAC are retained on the Solution file. ! use equat file sj ; solut file = sjlb ; harwell parameter = 0.8 ; ! ! Closure ! exogenous p_xfac ; rest endogenous ; save env file sjxfac ; ! ! Shocks ! shock p_xfac 1 = 10 ; ! ! Cumulatively-retained endogenous ! cum endog %macro (SECT) (FAC) ; ! ! Verbal description ! verbal description = This is a simple sim with SJ; Standard closure and data. Labor supply increased by 10 per cent. ; ! ! Options (just examples) ! log file = sag1.log ; ! output goes to log file and also to terminal CPU = yes ; ! report CPU times !__________________________________________________________________ APPENDIX B MODELS USUALLY SUPPLIED WITH GEMPACK The models usually supplied with GEMPACK are listed in section 1.3 of the main text. Here we give a list of the associated files, with their usual file names (which may be different on some machines). The files referred to in this appendix are often contained in a subdirectory called EXAMPLES attached to the other GEMPACK files on your computer. If in doubt, consult your machine-specific documentation or ask your GEMPACK Manager. For each of the models, we provide files which you can use to carry out certain simulations with these models. Of course, you can also carry out different simulations (varying the closures and/or shocks, and also the number of steps and/or solution method in multi-step simulations) and can also work with different condensations of the models. When you start working with one of these models, we suggest that you create a new subdirectory for just this model (separate from the EXAMPLES subdirectory and from the directories containing the GEMPACK source and/or executable files); copy the relevant files from the examples subdirectory into it. (This avoids cluttering up the EXAMPLES directory and the directories containing the other GEMPACK files with model-specific files.) The suggestions in Appendix E for hands-on computing (which you might like to try to familiarise yourself with GEMPACK) use some of the models and files described here. Stylized Johansen This is the small example general equilibrium model designed as an introduction to the issues involved in building and solving such models (see Chapter 3 of DPPW), and used for many of the examples in this document. In Chapter 3, there are three different TABLO Input files for Stylized Johansen: the mixed version described in section 3.3, the linearized version in section 3.5 and the levels version in section 3.6. In the following 'LN' in a file name means that this file is for the linearized version. Similarly 'LV' implies the file is for the levels version. The files are Mixed Linear Levels TABLO Input file SJ.TAB SJLN.TAB SJLV.TAB All versions use the same Header Array file as data file. MODELS USUALLY SUPPLIED WITH GEMPACK Page B-2 Header Array data file SJ.DAT Text data file (input to MODHAR) SJDAT.TXT SJDAT.TXT is the text file shown in section 3.4.1 for creating the Header Array file via the 'at' command of MODHAR. The following table summarises Command files used to run the various versions of the Stylized Johansen model. The simulation carried out is for a 10 percent increase in labor while capital is held fixed. Either the GEMPACK program GEMSIM or the TABLO-generated program can be used to run a multi-step simulation, and the GEMPACK program SAGEM is used to run a Johansen simulation. Command Files Mixed Linear Levels Program GEMSIM or TABLO-generated SJLB.CMF SJLNLB.CMF SJLVLB.CMF SAGEM SJLBJ.CMF - - GEMSIM or TABLO-generated SJEQ.CMF - - SJENV.CMF - - SJLBE.CMF - - For example, run TABLO with the TABLO Input file SJ.TAB to produce GEMSIM Auxiliary files (see section 2.2.2) or to produce the TABLO-generated program (see section 2.6.2). You can then use the Command file SJLB.CMF to run the multi-step simulation (section 2.2.3 or 2.6.4). Alternatively, you can use SJEQ.CMF, SJENV.CMF and SJLBE.CMF in turn to carry out the same simulation, as explained in section 2.7 above. The following table summarises the Stored-input files and their uses. Only the files for the mixed version of Stylized Johansen are supplied in the model examples. Program Stored-input Files Use Reference GEMSIM SJLB.STI multi-step simulation 2.3.3 GEMPIE SJLBG.STI print out results 2.2.4 SAGEM SJLBJ.STI Johansen simulation 2.4 TABLO SJCOND.STI condense SJ model 3.9.1 An example of a TABLO Input file used to check whether the data base is balanced and all data is non-negative is given in SJCHK.TAB. This carries out data manipulation but does not carry out any simulation. Miniature ORANI This is a pedagogical model designed to introduce some of the essential ideas behind the ORANI model of the Australian economy (see sections 3-9 of Dixon et al (1982)). The files are Mixed Linear TABLO Input file MO.TAB MOLN.TAB Header Array data file MO.DAT (same) Command file MOTAR.CMF MOLNTAR.CMF Stored-input file (condense) MOCON.STI Command file (condensed) MOCONTAR.CMF MODELS USUALLY SUPPLIED WITH GEMPACK Page B-3 Run TABLO with the TABLO Input file MO.TAB to produce GEMSIM Auxiliary files or the TABLO-generated program. You can then use the Command file MOTAR.CMF to carry out the tariff simulation described in section 8.4 of Dixon et al (1982). Alternatively run TABLO with the linearized TABLO Input file MOLN.TAB. The Command file MOLNTAR.CMF carries out the same simulation on the linear model. The Stored-input file MOCON.STI will enable you to run TABLO to condense the mixed version of the model. With this condensed version, use Command file MOCONTAR.CMF to carry out the same simulation. TRADMOD This is a flexible multi-country trade model documented in Hertel et al (1992). The relevant files are TABLO Input file TRADMOD.TAB Header Array data file TRADMOD.DAT GEMPACK Command file TRADSIM.CMF The TABLO Input file is as in Appendix B of Hertel et al (1992) and the data file is as described in Table 2 and Appendix A there. The Command file TRADSIM.CMF can be used with GEMSIM or the corresponding TABLO-generated program to carry out the simulation introducing a 20% subsidy on the output of US food (see section V and Table 3 of Hertel et al (1992)). This model is usually not condensed. ORANIF This is a 22-sector version of the ORANI-F model of the Australian economy which has been used over several years by Peter Dixon and colleagues for forecasting and policy analysis. This model contains limited dynamics, in that it tracks accumulation of capital and national debt over the period (often 6 years) of a simulation. There are two versions supplied with GEMPACK. The model is documented in Horridge et al (1993) [HPP] which gives the linearized TABLO Input file ORANIF.TAB. A second version is a mixed levels/linear version; this TABLO Input file ORANIFM.TAB is listed in Harrison et al (1993b) and discussed in Harrison et al (1993a). The files are Linear Mixed TABLO Input file ORANIF.TAB ORANIFM.TAB Header Array data file ORANIF.DAT (same) Stored-input files ORANIF.STI ORANIFM.STI ORFJ8.STI ORFJ8MIX.STI ORFG8.STI ORFG8MIX.STI GEMPACK Command files ORFJ8.CMF ORFJ8MIX.CMF ORFG8.CMF ORFG8MIX.CMF ORANIF.STI is the Stored-input file for TABLO to carry out the condensation of the linearized version of the model used for the MODELS USUALLY SUPPLIED WITH GEMPACK Page B-4 simulations reported in section 7 of HPP. The GEMPACK Command files ORFJ8.CMF and ORFG8.CMF (used via the associated Stored-input files ORFJ8.STI and ORFG8.STI which also contain the data required "from the terminal") carry out, with this condensation of the linearized version, the Johansen and Gragg versions of the forecasting simulation reported in section 7 of HPP. In particular they produce the results in columns VIII and IX of Tables 4 and 5 of HPP. Similarly ORANIFM.STI is the Stored-input file for the condensation of the mixed version. GTAP This is the Global Trade Analysis Project's model, which can be used to analyse trade issues. It is a multi-regional model and is described in Hertel and Tsigas(1993). Several different aggregations (of commodities and/or countries) are available from the Project. Three of these aggregations are usually supplied with GEMPACK; these are the 3x3, 5x6 and 10x7 aggregations. The relevant files are 3x3 5x6 10x7 TABLO Input files GTAP3X3.TAB GTAP5X6.TAB GTAP10X7.TAB Header Array IO data files GDAT3X3.HAR GDAT5X6.HAR GDAT10X7.HAR Header Array set data files GSET3X3.HAR GSET5X6.HAR GSET10X7.HAR Text Parameter files GPAR3X3.DAT GPAR5X6.DAT GPAR10X7.DAT Condensation files TP33RS.STI TP56RS.STI TP107RS.STI Command files TP33RSA.CMF TP56RSA.CMF TP107RSA.CMF Also supplied are TABLO Input files GTAPCHK.TAB and SHOCKS.TAB. The first is for checking and reporting various features of the data base, while the second can be used to compute shocks for certain simulations of interest to trade modellers. Command files GTAPCHK.CMF and SHOCKS.CMF can be used with these TABLO Input files. The TABLO Input files and data files are those used in the 1993 Short Course in Global Trade Analysis, and are as documented in Hertel and Tsigas (1993). Modellers interested in using the GTAP Model for serious policy work are advised to contact Professor Tom Hertel at Purdue University for more information about the Global Trade Analysis Project and up-to-date versions of this model and associated data. DMR This is the well-known Dervis, De Melo, Robinson model of Korea, as documented in Chapter 4 of DPPW. The relevant files are TABLO Input file DMR.TAB Header Array data files (see below) GEMPACK Command files DMREQ.CMF, DMRSIM.CMF For this model there are three Header Array data files, namely DMRIO.DAT, DMRPAR.DAT and DMREXTRA.DAT. MODELS USUALLY SUPPLIED WITH GEMPACK Page B-5 The TABLO Input file is a direct implementation of the linearized equations of the model as documented in Chapter 4 of DPPW. This implementation contains no UPDATE statements and so can only be used for Johansen simulations. The data files contain the data in Appendix 4.1 of DPPW. Run TABLO with the TABLO Input file DMR.TAB. Then to produce an Equations file, run GEMSIM or the TABLO-generated program DMR taking input from the Command file DMREQ.CMF. The Command file DMRSIM.CMF can be used to run SAGEM (not GEMSIM or the TABLO-generated program) to carry out the Johansen version of the simulation described in Exercise 4.15 of DPPW, the results of which can be found in Appendix 4.2 of DPPW. TREES This is a stylized model of forestry designed to show how intertemporal models are implemented within GEMPACK, described in Codsi et al (1992). The relevant files are TABLO Input file TREES.TAB Text base data file TREES20.DAT Time data file EVEN2080.DAT GEMPACK Command file TREESP.CMF The TABLO Input file is as in the Appendix of Codsi et al (1992) while the base data file TREES20.DAT contains the steady state data described in section 6 there. The Command file TREESP.CMF enables you to simulate the effect of a 10% increase in the price of trees in years 8 and onwards (announced at year 0), using a grid with 20 equal intervals over an 80 year time span. CRTS This is a single-sector investment model, described in Wilcoxen (1989) or Exercises 5.1-5.4 of Chapter 5 of DPPW. The relevant files are TABLO Input file CRTS.TAB Text base data file CRTS20.DAT Time data file EVEN2080.DAT GEMPACK Command file CRTSDIV.CMF These files let you simulate a doubling of the dividend tax rate in years 8 to 80 (announced at year 0), using a grid with 20 equal intervals over an 80 year time span. (You might like to compare your results with those for Exercise 5.5(b) in DPPW.) (See section 6.6 of the READ.ME file supplied with Pearson (1992) to see why we recommend an 80 years time span rather than the 100-year time span in DPPW.) You can, of course, easily experiment with other grids. MODELS USUALLY SUPPLIED WITH GEMPACK Page B-6 5SECT This is a 5-sector investment model designed as an introduction to the issues involved in building and solving intertemporal models, also described in Wilcoxen (1989) or Part C of Problem Set 5 of DPPW. The relevant files are TABLO Input file 5SECT.TAB Text base data file 5SECT10.DAT Time data file GRIDH80.DAT GEMPACK Command file 5SSIM.CMF The Command file is for carrying out a perfect foresight version of the dividend tax simulation described in Exercise 5.18(a) of DPPW - see also section 10.1 of Wilcoxen (1989). The grid in GRIDH80.DAT is an uneven, 10-interval grid over an 80 year time span (rather than the 100 year time span used in DPPW and Wilcoxen (1989)). (See section 6.6 of the READ.ME file supplied with Pearson (1992) to see why we recommend an 80 years time span rather than the 100-year time span in DPPW.) APPENDIX C SYNTAX OF GEMPACK TEXT DATA FILES In preparing arrays of data for GEMPACK text files, a text editor or spreadsheet may be used. Text files can contain several arrays. However, shock files and files used for modifying data with MODHAR via its 'm' subcommand should only contain one array. For each array, there must be o the "how much data" information, followed by o the actual data values of the array. C.1 The "How Much Data" Information This gives information about the array of data values which follow it. It can continue onto second and subsequent lines, can contain comments and must finish with a semicolon ';'. The input of text strings such as 'real' and 'header' is not case sensitive so either 'real' or 'REAL' is correct. For real or integer data, the expected format is
; where is a list of 1 to 7 positive integers, giving the sizes of the array of data values, is either real or integer, and is either row_order, col_order or spreadsheet. If is omitted, real is assumed. If is omitted, row_order is assumed.
and are optional (see below). Examples (1) For a three-dimensional real array of size 2 x 3 x 4 in row order, the "how much data" information is 2 3 4 row_order ; SYNTAX OF GEMPACK TEXT DATA FILES Page C-2 The "How Much Data" Information (2) For an vector (that is, a 1-dimensional array) containing integers of size 7, the "how much data" information could be 7 integer header "IJK9"; (3) For a real array in column order, with header "ABCD", the "how much data" information (including some comments) could be ! This is an array of real numbers in column order 2 3 real col_order ! The header and longname are only read by MODHAR header "ABCD" longname "Array description " ; For character string data, the expected format is strings length
; where and are positive integers specifying respectively the number of strings and the length of each string. Example For a list of 3 character strings, each of length 12, the "how much data" information could be 3 strings length 12 header "GGGG" longname "Elements of set G1" ; Header and longname In all cases (real, integer or character data),
and are optional. They take the form HEADER "...." and LONGNAME "....." respectively. These are only relevant on text files used as input to MODHAR (specifically to the MODHAR commands 'at' and 'aw'). The actual long name (up to 70 characters long) must all be on one line of the file; neither it (nor the actual header) can be split over two lines. If the header and/or long name are not specified on a file which you are reading via MODHAR options 'at' or 'aw', MODHAR will prompt you for them if they are needed. In all other programs except MODHAR, the header and longname may be present but will be ignored by the program reading the text file. In all cases, real, integer or character, a semicolon ; is required at the end. SYNTAX OF GEMPACK TEXT DATA FILES Page C-3 Comments C.1.1 Comments Any part of an input line following a single exclamation mark ! will be ignored. If the exclamation mark is at the start of the line, the whole line will be ignored. As for terminal input (or input on Stored-input or GEMPACK Command files), each comment finishes at the end of the line it starts on but can be continued by putting ! at the start of the next line. Comments can be included at the end of any line in the "how much data" information (which may extend over several lines and ends with a semicolon ;). Comments can also be included anywhere amongst the data values for real or integer data whose order is row_order or col_order. But they cannot be included amongst the data for real or integer data whose order is spreadsheet or with any character data. Start of example text file __________________________________________________________________ ! ! A complete example text file containing 5 arrays ! including data values ! 2 3 real row_order ! HEADER "abcd" LONGNAME ! Longname may be up to 70 characters ! Write all the longname between double quotes on one line "The input-output data flows (millions of dollars)" ; ! data follows 4.0 2.0 1.0 ! end of row 1 1.0 6.0 8.0 6 integer row_order header "cdef" longname "second array"; 1 2 ! One row of data can be split over several lines 3 4 ! Data part of real/integer row/col_order can contain comments 5 6 2, 4, integer spreadsheet header "fghj" longname "third array"; 1, 2, 3, 4, 5, 6, 7, 8, 2 4 col_order integer header "pqrt" ; 1 5 2 6 3 7 4 8 ! ! For a character array, don't leave any blank lines ! after the semicolon. ! Each of the character strings will be filled with blanks at the ! right-hand end. 3 STRINGS LENGTH 5 header "xyza"; abcde pqr 11223 ________________________________________________________________ End of example text file SYNTAX OF GEMPACK TEXT DATA FILES Page C-4 Array Sizes C.1.2 Array Sizes For a 2 x 5 x 7 array, the array sizes are given as three integers at the start of the "how much data" information* : 2 5 7 ! Correct way to give dimensions for 3-dimensional array For a vector (that is, a one-dimensional array), just one size is given since there is no difference between a 1 x 10 array and a 10 x 1 array. Real arrays can have up to 7 dimensions while integer arrays are restricted to at most 2 dimensions. C.2 Actual Data Values of the Array The lines of the text file following the "how much data" information contain the actual values for the array. For real arrays there can be up to 7 dimensions. For a 3-dimensional array of size a x b x c, values are given as if there were c matrices (that is, 2-dimensional arrays) of size a x b. Similarly for a 4-dimensional array of size a x b x c x d, the data is presented as if there are cd matrices each of size a x b (given in the order where the third index ranging over c values varies most rapidly). Each of the 2-dimensional a x b matrices can be given in row or column order depending on what is specified on the "how much data" information. Note that a matrix X of size m x n has m rows and n columns. The rows are the horizontal lines in the diagram below and the columns are the vertical lines. [ X(1,1) X(1,2) ... X(1,n) ] ! row 1 [ X(2,1) X(2,2) ... X(2,n) ] ! row 2 . . . . . . [ X(m,1) X(m,2) ... X(m,n) ] ! row m Row order o Enter each complete row in the data array in free format, continuing on as many lines of the text file as you like. o Start each new row on a new line. o Spaces (or commas) between numbers act as separators. _________________ * This is different from the Release 4.2.02 of GEMPACK where the number of dimensions 3 was given followed by the sizes 2 5 7. See section C.3 below for the simple procedure for converting Release 4.2.02 text data files for use with Release 5. SYNTAX OF GEMPACK TEXT DATA FILES Page C-5 Actual Data Values of the Array Column order o Enter each complete column in the data array in free format, continuing on as many lines of the text file as you like. o Start each new column on a new line. o Spaces (or commas) between numbers act as separators. Spreadsheet o Spreadsheet order is the same as row order except that usually every data value is followed by a comma as separator. o There may also be commas after the dimensions in the "how much data" information. o In preparing the data array on a spreadsheet, enter the data values in the spreadsheet then save the array using the comma-separated values (CSV) format supported by most spreadsheet programs. One-dimensional Arrays For a 1-dimensional array, there is no distinction between row and column order; the actual data values can be given on one line or continued on subsequent lines as you like. Real Numbers There are various valid ways of writing real numbers: o as a string of digits with (or without) a decimal point. (Whole numbers do not need a decimal point.) o with positive or negative signs. o with an exponent followed by an optional sign and an integer. (For example, 1.23E2 means 1.23x100=123 while 1.23E-2 means 1.23x0.01=0.0123) Valid examples include 3.2 +1.2 .234567 -15.9E-12 16 Repeated Values in Arrays Repeated values in arrays can be given in the form * For example, 20*1.35 gives 20 values each of 1.35. Don't leave spaces on either side of the symbol *. Don't include brackets around negative real numbers. For negative values the appropriate form is 20*-1.35 SYNTAX OF GEMPACK TEXT DATA FILES Page C-6 Actual Data Values of the Array Character Strings There should be one character string per line. A character string cannot be broken on a line and continued on the next line. This effectively restricts the maximum length of strings to the maximum length of lines of the text file. Some text editors allow long text lines. Blank lines after the "how much data" information are important since a blank line counts as a character string filled with blanks. Comments are not allowed in character data. Multi-dimensional Real Arrays Consider a COEFFICIENT C declared as follows in the TABLO Input file. COEFFICIENT (all,i1,S1)(all,i2,S2)(all,i3,S3)(all,i4,S4) C(i1,i2,i3,i4) ; The associated array is of size N1 x N2 x N3 x N4 where N1,...,N4 are the sizes of the sets S1,...,S4 respectively. The (4,3,1,2) entry in the array corresponds to the 4th element of S1, the 3rd of S2, the first of S3 and the second of S4. Suppose that S1,...,S4 have sizes 4,5,2,3 respectively. Then the corresponding data on a GEMPACK text file should be presented as 6 (=2x3) matrices each of size 4 x 5. First are the (1-4,1-5,1,1) entries in 4 rows, then the (1-4,1-5,2,1) entries (since the third index over S3 varies faster than the fourth over S4), then the 4 x 5 matrix corresponding to the (1-4,1-5,1,2) entries, then the (1-4,1-5,2,2) matrix, then the (1-4,1-5,1,3) matrix and finally the matrix corresponding to the (1-4,1-5,2,3) entries of C. Maximum Length of Lines of a File For row order or column order files, no line of data (including spaces) on the file can exceed 500 characters (and you may need to be shorter than this on some machines). If you are creating such a file yourself in an editor, it may be best to limit lines to 80 characters (including spaces); each row or column of data can extend over several lines of the file is necessary. For spreadsheet style arrays, there is no fixed limit.* Usually all numbers in one row of data are on one line of the file. _________________ * When data in row or column order is read, low-level GEMPACK subroutines process each item of data directly. When data in spreadsheet style is read, a Fortran list-directed read is used. SYNTAX OF GEMPACK TEXT DATA FILES Page C-7 Differences Between Row Order and Spreadsheet Data C.2.1 Differences Between Row Order and Spreadsheet Style Data In each of these, the entries of the matrices are in row order. The differences are (i) in spreadsheet style there is a separator (usually a comma) between data items, and (ii) in spreadsheet style data, each line of data may be very long. (Ideally, for an N1 x N2 matrix, each line of a spreadsheet style file has N2 data items.) (iii) no comments are allowed in the actual data for spreadsheet style (see section C.1.1 above). When GEMPACK programs (GEMSIM, TABLO-generated programs, SEEHAR or SLTOHT) write spreadsheet style files, they try to put all data entries for one row onto one line of the file (possibly a very long one). For example, in writing a 10 x 112 matrix, there will be 10 lines of data, each containing 112 real numbers. In contrast, when the same programs write row order data, each line of the file contains at most 5 real numbers. Thus, when writing a 10 x 112 matrix, each of the 10 rows of 112 real numbers is broken into 23 or so lines of the file. It is easy to edit row-order files in any text editor. However, it may not be possible to edit all spreadsheet style files in your text editor since some lines may be too long for the editor to process. It is best to use spreadsheet style files only for communication between spreadsheet programs and GEMPACK and to use row-order (or column-order) files when you want to edit them in a text editor. (You can always edit spreadsheet files once you have imported them into a spreadsheet program.) When GEMPACK programs write row-order or column-order data, they put at most 4 or 5 real numbers on each line and separate the numbers with spaces. However, when you are preparing text file for input, you can put more or less numbers per line and can use either spaces or commas (or a mixture) as separators between data items. C.2.2 Element Name/Number Labels When GEMPACK programs (GEMSIM, TABLO-generated programs, SEEHAR or SLTOHT) write row-order or column-order real or integer data, they put element names (or numbers if names are not available) amongst the data to indicate the position in the array of each number. These labels are written as comments (following the style indicated in section C.1.1 above). Note that these element name or number labels are not required when you prepare a text file to be read. Indeed, even if included, they are ignored since they are treated as comments when such a file is read; in particular, programs reading files with element names as comments do not check that the names are correct. SYNTAX OF GEMPACK TEXT DATA FILES Page C-8 Element Name/Number Labels Below we give an example of a 4 x 7 array to show these labels. Note that the row element labels are at the end of the first line of data for each row. Example ! ! Values of TO_HAT(NX_COMM,REG) - an array of size 4x7 !------------------------------ ! ! (Entries are written one "row" at a time, maximum of 4 per line.) 4 7 real row_order ; ! The matrix TO_HAT(%1,%2) with %1 in NX_COMM, %2 in REG. +++++++ !%2= Australasia USCN HiYEAsia NewNICs 5.960465E-06 0.000000E+00 1.192093E-05 0.000000E+00 !%1=land !%2= China EC12 ROW 0.000000E+00 0.000000E+00 0.000000E+00 !%2= Australasia USCN HiYEAsia NewNICs 0.000000E+00 5.960465E-06 0.000000E+00 1.192093E-05 !%1=labor !%2= China EC12 ROW 1.192093E-05 0.000000E+00 1.192093E-05 !%2= Australasia USCN HiYEAsia NewNICs 0.000000E+00 5.960465E-06 1.192093E-05 0.000000E+00 !%1=capital !%2= China EC12 ROW 1.192093E-05 5.960465E-06 0.000000E+00 !%2= Australasia USCN HiYEAsia NewNICs -2.31080 -14.2302 -22.3250 -1.59832 !%1=crops !%2= China EC12 ROW -6.96980 -30.2941 -1.192093E-05 C.3 Converting Release 4.2.02 Files for Use with Release 5 or Later This section tells users with text files prepared for use with Release 4.2.02 of GEMPACK how to convert these files for use with Release 5 or later. (Readers not familiar with Release 4.2.02 should ignore this section.) We apologise to users of Release 4.2.02 for the fact that the format of text files required for Release 5 differs from that for Release 4.2.02. We believe we made a mistake in requiring column order in Release 4.2.02 (we still find it difficult to work with) and we believe that the current files will prove much easier to work with. The essential difference is that, with Release 4.2.02 we insisted on column order, whereas with Release 5 or later we allow you to use either row order or column order. Although text file formats differ between these releases, it is most important to realise that Header Array files created using Release 4.2.02 or earlier releases (including those prepared using text files) do not need any change for use with Release 5. However, SYNTAX OF GEMPACK TEXT DATA FILES Page C-9 Converting Release 4.2.02 Text Files if you wish to change a Release 4.2.02 text file and use it with Release 5 (or later) GEMPACK software to create a new Header Array file, you will need to change the text file. This is very easy to do, as explained below. Because Release 4.2.02 of GEMPACK required what is now referred to as column-ordered files, the simplest way to modify Release 4.2.02 text files is just to change the "how much data" parts of them to o include 'col_order', o omit the "number of dimensions" integer at the start, and o add a semi-colon at the end of this. The actual data part should not need any changes. (Just check that each new "column" of data starts on a new line.) Example Consider the Release 4.2.02 text data file containing one real array of size 2 x 3 x 4. The "how much data" information on it will be 3 2 3 4 Simply change this to 2 3 4 col_order ; (That is, omit '3' at the start and add 'col_order ;' at the end.) You might also like to add comment lines to make these files more self-documenting. APPENDIX D CHOOSING THE CLOSURE AND SETS OF VARIABLES INTERACTIVELY In this appendix we describe how you can specify the closure for a simulation (see section D.1) or choose other sets of variables (see section D.2) when you are running the relevant program interactively or via a Stored-input file. This complements chapter 6 in which the procedures for making such choices via a GEMPACK Command file have been described. D.1 Specifying the Closure Interactively In this section, interactive specification of the closure is described in detail. Specifying the closure using a Command file has been described earlier in section 6.1.2. As described in section 6.1.2, there are three main ways of specifying the closure: (1) specifying the closure from scratch, (2) using a saved closure, that is, choosing it to be exactly the same as one already stored on a file (an Environment, Solution or LU file), (3) modifying a saved closure, that is starting from an existing closure saved on file and modifying it. We give an overview of each method here but leave until later in this section precise details of the commands used in these methods. (1) Specifying the closure from scratch Here there are two possible methods (the first of which is usually to be preferred). In the first, you start with all variables endogenous (for example), and then specify the exogenous ones in lists. Alternatively, you can choose to respond to prompts about each of the variables in turn. You respond to say whether all, some or none of the variable's components are exogenous. (2) Using a saved closure This is, of course, the easiest way to specify a closure. If you have already used the closure and have saved it on one of the appropriate types of file, you begin by specifying that you want to use that file, state its type and then its name and finally say you wish to use this closure (rather than modify it). CHOOSING THE CLOSURE AND SETS OF VARIABLES INTERACTIVELY Page D-2 Specifying the Closure Interactively (3) Modify a saved closure Here you start as in (b) but then ask to modify it. You can use the 'sx', 'sn', 'sxs' and 'sns' commands (described in section D.1.2 below) to change the classification (exogenous/endogenous) of components of specified variables. You can also use the swap command sw to swap (from exogenous to endogenous or vice versa) all components of the two variables 'v1' and 'v2'. Closure Status Report In all three methods above, you start by specifying an exogenous/endogenous split which may or may not be a possible closure. Then for methods (1) and (3) you can modify this closure until you are ready to use it as the closure for your simulation. During these two steps in the specification of a closure, after every action you take, you will be given a status report about the current number of exogenous and endogenous variables, and whether a valid closure currently exists or not. If your current closure is invalid, the status report looks like: [ Closure is not yet valid. Current closure : 562 exog, 268 endog. You require : 583 exog, 247 endog. ] If your current closure is valid, the status report looks like: [ Current closure is valid, namely, there are 583 exogenous and 247 endogenous.] Note that, in these reports, "valid" just means that the number of endogenous variables equals the number of equations. Such a closure may still be invalid in the sense that the exogenous variables are not really independent. This will only be revealed when doing the simulation, at which stage the software will report that the matrix is singular (that is, not invertible). The rest of this section gives a detailed description of the inputs allowed in starting the specification (section D.1.1 below) and in modifying an existing split (section D.1.2 below). D.1.1 Starting the Specification When you start to choose your closure, the following menu of choices is offered: CHOICE OF ECONOMIC ENVIRONMENT How do you want to start specifying your closure ? From an EXISTING closure (which you may modify if you wish)? [e] By responding to PROMPTS about the variables one at a time? [p] By setting all components of all variables EXOGENOUS? [x] By setting all components of all variables ENDOGENOUS? [n] GIVE UP trying to specify a closure [g] CHOOSING THE CLOSURE AND SETS OF VARIABLES INTERACTIVELY Page D-3 Starting the Specification Option [e] From an EXISTING closure (which you may modify) Select [e] to start from a closure already stored on an Environment, Solution or LU file. You will be prompted for: Type of file closure is stored on. Name of the file (excluding suffix). (Note that you can either use this closure exactly as it is, or you can modify it.) Option [p] To respond to PROMPTS about the variables one at a time Select [p] to choose the starting exogenous/endogenous split by interacting with the software one variable at a time. You will be prompted with the variables' names, one at a time. These come in the order in which the variables are declared in the TABLO Input file for the model. For each variable there are three choices. CHOICE MEANING a Set All components of the variable exogenous. n Set No components of the variable exogenous. s Set Some components of the variable exogenous. If you choose 's', you will be requested to enter in the actual components which are to be set exogenous. First you are asked how many components you want to be exogenous and then to list the actual components (by number). For example, to specify components numbered 2,3,4,8,10, respond 5 ! number of components 2-4 8 10 ! actual components More details about specifying actual components are given in section D.2.1 below. Option [x] To set all components of all variables EXOGENOUS Option [n] To set all components of all variables ENDOGENOUS If you choose one of these starting options, all components of all variables will initially be marked exogenous or endogenous respectively. Of course, this choice is not likely to be a possible closure. You can modify this in ways described in the next section. CHOOSING THE CLOSURE AND SETS OF VARIABLES INTERACTIVELY Page D-4 Modifying or Using the Exogenous/Endogenous Split D.1.2 Modification or Use of the Exogenous/Endogenous Split Once you have some exogenous/endogenous split, you have three or four possibilities. The choice offered is: Type [u] if you wish to USE this as the closure (or) type [m] if you wish to MODIFY the current closure. (Alternatively, type [s] to start again or [g] to give up trying to specify a closure.) Option [u] Use the exogenous/endogenous split as the closure This option is only available when the split of exogenous and endogenous variables constitutes a valid closure as indicated by the most recent status report. When you choose to use a closure, you have finished the closure specification part of the software and you will continue with the rest of the user input for the simulation. Option [s] Start again This option allows you to begin again, that is to start specifying the closure. So if you get lost or make a mistake at any stage this can be an escape route. Option [g] Give up is used when you want to stop the program without using a closure. Option [m] Modify the exogenous/endogenous split If you choose [m], you can modify the current exogenous/endogenous split (how to do this is described below in detail) until you are happy with it. When you have made all the modifications you wish to make, you will be presented with the four choices [u], [m], [s] and [g] again. Note that under option [m], you can set up and save (for later use) one or more different closures. Indeed you can use SAGEM just for this purpose if you wish. (After saving the different closures, finish or abort the modification process. If you do not want to use the final closure, then choose option [g] - Give up.) CHOOSING THE CLOSURE AND SETS OF VARIABLES INTERACTIVELY Page D-5 Modifying or Using the Exogenous/Endogenous Split Modifying the Exogenous/Endogenous Split After choosing option [m], there are several commands which allow you to modify the current exogenous/endogenous split or view the current state of play. The commands available are listed below, together with a brief description of each one. After each command you can continue choosing from the set of commands below until you choose either [f] - finish or [a] - abort. Commands For Modifying An Exogenous/Endogenous Split COMMAND MEANING sx Set eXogenous all components of all variables in list sn Set eNdogenous all components of all variables in list sxs Set eXogenous Some components of all variables in list sns Set eNdogenous Some components of all variables in list sw SWap v1 and v2 (two variables). wx Which components of all variables are eXogenous? wn Which components of all variables are eNdogenous? wx Which components of the listed variables are eXogenous? wn Which components of the listed variables are eNdogenous? save SAVE the current closure (on an Environment file). ? Help. ? Detailed help for the specified commands. f Finish. a Abort. (Give up this attempt to specify a closure.) Table D.1.2: Commands For Modifying An Exogenous/Endogenous Split These commands are described in more detail in the following pages. a) To set all components of some variables exogenous or endogenous Commands: sx (for 'Setting all eXogenous') sn (for 'Setting all eNdogenous') is a list (separated by spaces) of the names of the variables which are to have all components exogenous or endogenous. can also contains names of variables followed by sets or elements as arguments, for example p_XF("labor,SECT), to specify just the relevant components. In this case there must be no space between the end of the variable name and the "(" starting the arguments. Example sx p1 p2 p_XF("labor",SECT) sets exogenous all components of the variables called p1 and p2, and the components p_XF("labor",s) for all s in SECT. CHOOSING THE CLOSURE AND SETS OF VARIABLES INTERACTIVELY Page D-6 Modifying or Using the Exogenous/Endogenous Split b) To set some components of some variables exogenous or endogenous Commands: sxs (for 'Setting eXogenous Some components') sns (for 'Setting eNdogenous Some components') is a list (separated by spaces) of the names of the variables which are to have some components set exogenous or endogenous. For each variable in (in the same order as in ), you will be prompted for: The number of components to be set. The ACTUAL components. (Follow the method in section D.2.1 below.) Example using sxs ________________________________________________________________ n ! start with all endogenous m ! modify this sxs p_xfac p_pfac ! some of these exogenous 1 ! one component of p_XFAC 1 ! component number 1 (supply of labor) 1 ! one component of p_PFAC 2 ! component number 2 (price of capital) f ! finish specifying the closure u ! use this closure _______________________________________________________________ This example specifies an alternative closure for the Stylized Johansen model. Of course, you could also use this method but start with all variables exogenous and then specify the endogenous ones in lists via the commands 'sn' and 'sns' to set components endogenous. When specifying which components (after 'sxs' or 'sns' commands) you can give the component numbers in groups such as 1-5 16-25 30 which specifies the components numbered 1 to 5, 16 to 25 and 30. c) To swap two variables Command: sw (for 'SWap two variables') and are the names of two variables. Rules for use: - Variables v1 and v2 must have the same number of components. - Each variable must either have all its components currently exogenous or all its components endogenous. - If v1 has all components exogenous, then v2 must have all components endogenous (and vice versa). Example using sw sw p_XFAC p_XCOM CHOOSING THE CLOSURE AND SETS OF VARIABLES INTERACTIVELY Page D-7 Modifying or Using the Exogenous/Endogenous Split All components of p_XFAC are initially exogenous, all components of p_XCOM are initially endogenous. After the swap all components of p_XFAC are endogenous, all components of p_XCOM are exogenous. Both have 2 components. (You can not swap separate components as you can using a Command file, only whole variables. Use 'sxs' and 'sns' commands instead to swap separate components.) d) To see which components are exogenous or endogenous Commands: wx (for 'Which components are eXogenous ?') wn (for 'Which components are eNdogenous ?') wx (for 'Which components are eXogenous ?') wn (for 'Which components are eNdogenous ?') The first two of these ask for information about ALL variables. The last two only ask about the variables in . e) To save a closure Command: save (for 'SAVE a closure') You will be prompted for: The name of the Environment file on which the closure is to be saved. Rule for use: You must have a valid closure i.e. the correct numbers of exogenous and endogenous variables. If you do not have a valid closure, you will not be allowed to save the current split. (Note that you can save closures which are different from the one you intend to use for your current simulation.) f) To get help with modifying Commands: ? (for 'A listing of available commands') ? (for 'Detailed help for command(s)') is the list of commands you require help with. g) To finish modification Command: f (for 'Finish') Rule for use: You must have a valid closure i.e. the correct numbers of exogenous and endogenous variables. If you do not have a valid closure, but still wish to stop modifying the closure, you must use the 'a' command to abort. h) To abort an attempt at specifying a closure Command: a (for 'Abort') (Note that if you abort you will lose any changes you have made, and you will have to start specifying the closure again.) CHOOSING THE CLOSURE AND SETS OF VARIABLES INTERACTIVELY Page D-8 Choosing Other Sets of Variables Interactively D.2 Choosing Other Sets of Variables Interactively Choosing sets of variables has been introduced in section 6.2 of the main text. Sometimes your choice will be simple and easily expressed. For example, you may wish to choose all variables or none, or all "macro" variables (that is, variables with just one component), or just a few variables. Procedures for doing these have been described in section 6.2.3 above. On the other hand, you may need to describe a fairly complicated set - perhaps many variables and only some of the components of some of them. GEMPACK provides you with two ways of making such a choice. (1) The first is the "active" way in which you give lists of the variables (and their components) you want to be in the subset. (2) The second is the "passive" way in which you let the software prompt you about all the available variables in turn and you say, for each one, which components of it you wish to be in the subset. Of these two, the Lists option is the default and the one we recommend to you. The Lists option, which has been described briefly in section 6.2.4 above, is described in detail in section D.2.2 below while the "responding to prompts" method is described in section D.2.3 below. You will recognise the choice situations we are describing in this section because you will be presented with a menu looking something like that shown below. (In the menu below, the words "shocked exogenous" and "individually-retained exogenous" will be replaced, more generally, by words describing the big set and the subset being chosen.) CHOICE OF WHICH shocked exogenous VARIABLES YOU WANT TO BE individually-retained exogenous. Make ONE of the following choices: L LISTS of variables, all or some of whose components are to be individually-retained exogenous. a ALL components of ALL shocked exogenous variables to be individually-retained exogenous. n NO shocked exogenous variables to be individually-retained exogenous. m All shocked exogenous MACRO variables to be individually-retained exogenous. 1 All components of ONE shocked exogenous variables to be individually-retained exogenous. f All components of a FEW shocked exogenous variables to be individually-retained exogenous. s SOME components of SOME shocked exogenous variables to be individually-retained exogenous. w WHICH are the shocked exogenous variables. Enter your choice now. ('L' is the default.) Example of the Menu Presented for Choosing a Subset (The menu above is the one you will see if you are using full prompts. If you have chosen brief prompts, as described in section 5.4 above, CHOOSING THE CLOSURE AND SETS OF VARIABLES INTERACTIVELY Page D-9 Choosing Other Sets of Variables Interactively the menu will be compressed considerably.) Choices a,n,m,1,f,w have been described in section 6.2.3, choice L (Lists) is described in section D.2.2 and choice s (SOME) is in section D.2.3 below. D.2.1 Specifying Components of One Variable In either of the 'L' (Lists - Active) or 's' (Some - Passive) methods, you may wish to specify just some of the components of one variable. Under 'L' this can be done by specifying components via set/element arguments, as in, for example, a p_XF("labor",SECT) Alternatively, you can use subcommand 's' under the 'L' options and specify component numbers as indicated below. The procedure for specifying component numbers directly is described below. (You should also follow this procedure after the 'sxs' and 'sns' commands used in specifying a closure.) First you will be asked how many components you wish to choose. Respond with an integer. Then you will be asked for the actual components. These you must specify by number, and you can abbreviate several consecutive components using, for example, 6-10 to indicate components 6,7,8,9,10. Your response can extend over several lines if you wish and can contain several such groups of consecutive components or single component numbers, separated by commas or spaces, as you prefer. For example, the following two lines specify 85 of the 120 components of a particular variable. 1-6, 8 12 16 21-40, 50 - 70 86-120 See section 6.1.3 for the order of the components of variables with two or more arguments. D.2.2 The Lists Option - Choosing a Set Actively Once you have chosen 'L' (Lists) from the main menu, you can use several commands (as described below) to specify the set. This choice is done in a command-driven mode in which (until you indicate that you have finished the choice) you see the following prompt. > Next choice (or ? for help) The commands available are listed below, together with a brief description of each one. (If you ask for help, you get essentially the table below except that the MEANING column will give a more CHOOSING THE CLOSURE AND SETS OF VARIABLES INTERACTIVELY Page D-10 The Lists Option - Choosing a Set Actively explicit description that reflects the current context.)* COMMAND MEANING a Choose ALL components of the listed variables. s Choose SOME components of the listed variables. m Choose all available MACRO variables. w Which are available components of variables to choose from? c Which components of which variables have I already chosen? f Finish. q Quit.(Give up this attempt to choose a set of variables.) ? Help. ? Detailed help for the specified commands. Subcommands Available When Choosing via the Lists Option These commands are described in more detail in the following pages. An example should help to make it clear. EXAMPLE Suppose that you are choosing the exogenous variables to shock and suppose that the model has the following exogenous variables: x1 4 components, all exogenous x2 6 components, numbers 1,3,5 of which are exogenous y1 10 components, all exogenous y2 1 component, exogenous z1 3 components, all exogenous z2 3 components, all exogenous The 2 commands a x1 x2 y2 s y1 z1 followed by, responding (as described in section D.2.1 above) to prompts about first 'y1' and then 'z1', 4 (for 'y1') 1-3 9 2 (for 'z1') 1, 2 will say that all exogenous components of x1, x2 and y2 are to be shocked and that just components numbered 1-3 and 9 of 'y1' and components 1 and 2 of 'z1' are to be shocked. Then the command f (to finish) completes the choice of the set of variables to shock. _________________ * Commands 'm' and 'c' are new for Release 5, as is the possibility of specifying classes of variables by arguments as in, for example, a (COM) (COM,IND) described later in this section. CHOOSING THE CLOSURE AND SETS OF VARIABLES INTERACTIVELY Page D-11 The Lists Option - Choosing a Set Actively In the command a you can choose whole classes of variables by indicating their arguments and the sets over which they range. For example a (COM) (COM,IND) chooses all (available) components of o all variables in the model having one argument ranging over the set COM (this is what (COM) means), and o all variables in the model having two arguments ranging respectively over the sets COM and IND (this is what (COM,IND) means). (Of course, in such cases, the sets and arguments are as contained on the TABLO Input file for the model.) The set name or names must be enclosed in brackets '(' and ')' in this type of command. Note that, as you issue more commands, you keep adding to the subset. SUBCOMMANDS AND DETAILED EXPLANATION a) To choose ALL (available) components of a list of variables Command: a (for 'Choosing ALL components') is a list (separated by spaces) of names of the variables which are to have all components selected. can also contains names of variables followed by sets or elements as arguments, for example p_XF("labor,SECT), to specify just the relevant components. In this case there must be no space between the end of the variable name and the "(" starting the arguments. can also contain classes of variables specified via their arguments such as (COM) or (COM,IND). b) To choose SOME (available) components of a list of variables Command: s (for 'Choosing SOME components') is a list (separated by spaces) of names of the variables which are to have some components selected. Then, for each variable in the list (in the order you have listed them), you will be prompted for: The number of components to be chosen. The ACTUAL components. (Follow the method in section D.2.1 above.) (Note that if you enter an invalid response at any time with the 's' command , NO components of that variable will be chosen.) CHOOSING THE CLOSURE AND SETS OF VARIABLES INTERACTIVELY Page D-12 The Lists Option - Choosing a Set Actively c) To choose all available MACRO variables Command: m (for 'Choosing MACRO variables') d) To list which components of variables are available for selection Command: w (for 'Which') e) To list which components of variables have been selected so far Command: c (for 'Chosen') f) To finish selecting a subset of variables Command: f (for 'Finish') g) To Quit an attempt to choose a set of variables Command: q (for 'Quit') (Note that if you quit you will lose any changes you have made, and will be able to start choosing the set of variables again.) h) To get help with Choosing commands Commands: ? (for 'A listing of available commands') ? (for 'Detailed help for command(s)') is the list of commands you require help with. NOTE. If, in options (a) or (b) above, one of the names in your list is not in the model or if it has no components in the set from which you are choosing, this name will be ignored (a message will be given). Note that the other (legal) variables listed will still have all or some of their components chosen if you are running interactively; however if you are running in batch (or from a Stored-input file), the program will stop once this invalid input is encountered. D.2.3 The Some Option - Responding to Prompts If you respond 's' (Some) in the main menu, you will be presented with the names of the variables (those with at least one component in the big set) one at a time. For each one, you are first asked to respond a to select ALL (available) components to be in the subset, n to select NO components to be in the subset, or s to select SOME (available) components to be in the subset. If you respond 's', you specify the components you want by following the method described in section D.2.1 above. Note that the variables are presented in the order in which they are declared on the TABLO Input file for the model in question. This information should help you anticipate the order of the prompts if you are creating a Stored-input file. (But remember that variables with CHOOSING THE CLOSURE AND SETS OF VARIABLES INTERACTIVELY Page D-13 The Some Option - Responding to Prompts no components in the big set are omitted in this prompting.) If you do create a Stored-input file, we suggest you comment it by putting the names of the variables as comments (precede them with a single exclamation mark) after the a/s/n responses; this makes it easier to modify and, when you run the program, you can check that the prompts and your answers coincide. APPENDIX E SUGGESTIONS FOR HANDS-ON COMPUTING In this appendix we give several examples for you to try using various GEMPACK programs and some of the models described in Appendix B of GEMPACK document GDP-1 "Introduction to GEMPACK". This assumes that you have access to a machine on which an appropriate version of GEMPACK is installed. Source-code versions (on any machine), Executable Image versions and the Demonstration Version of GEMPACK are all suitable. The examples below all rely on files which are in the appropriate Examples subdirectory of your machine. For the Demonstration version of GEMPACK this is the subdirectory \GEM while for the full source-code version of GEMPACK for 80386/80486 machines, the examples are in subdirectory \GP51\EXAMPLES. If you are working on another type of machine, you may need to consult your machine-specific documentation to find the location of the Examples subdirectory on your machine. Most of the input to the programs is independent of the type of machine being used. Where this is not the case below, we give the DOS command and indicate this using a comment "! DOS". E.1 Examples using the Stylized Johansen Model SJ Many of these examples using SJ have been discussed in greater detail earlier in this document. In these cases we give the appropriate section as reference. Preparing a Directory for Model SJ To keep all examples files for this model together in one area, create a separate directory SJ. Under DOS, you can use the command md \sj ! DOS Change to this directory and copy the SJ files from the directory containing GEMPACK model examples. Under DOS, you can use the commands cd \sj ! DOS copy \gp51\examples\sj*.* ! DOS source-code version or copy \gem\sj*.* ! DOS Demonstration version SUGGESTIONS FOR HANDS-ON COMPUTING Page E-2 Examples using the Stylized Johansen Model SJ dir ! DOS This should list about 17 files associated with the Stylized Johansen model. Example 1 - Implementing the model SJ using TABLO. This is Step 1 described in section 2.1 of GPD-1. Start the program TABLO running. Under DOS (and several other systems), this can be done by entering tablo ! DOS Then type in the User Input given in section 2.2.2 of GPD-1. (There is no need to enter text following an exclamation mark ! - these are comments.) When this finishes, check that the GEMSIM Auxiliary files SJ.GSS and SJ.GST have been created. dir *.gs* ! DOS You can also look at the Information file SJ.INF in your text editor. Under DOS version 4 or later, you can use the command edit sj.inf ! DOS This file SJ.INF gives information about the TABLO Input file such as whether there are any syntax or semantic errors found by the program TABLO when it was checking the TABLO Input file. Example 2 - Running a Simulation using GEMSIM. This is Step 2 described in section 2.1 of GPD-1. Start the program GEMSIM running. Under DOS (and several other systems), this can be done by entering gemsim ! DOS When GEMSIM prompts, you enter the two responses cmf sjlb.cmf These responses cause GEMSIM to run a simulation as described in section 2.2.3 of GPD-1. To look at the Command file which contains the input for the program GEMSIM, look at file SJLB.CMF in your text editor. This file is discussed in section 2.3.1 of GPD-1. Example 3 - Print out the results using GEMPIE. This is Step 3 described in section 2.1 of GPD-1. Start the program GEMPIE running. Under DOS (and several other systems), this can be SUGGESTIONS FOR HANDS-ON COMPUTING Page E-3 Examples using the Stylized Johansen Model SJ done by entering gempie ! DOS then type in the User Input in section 2.2.4 of GPD-1. Examine the results in file SJLB.PI5 using your text editor. Alternatively you can print out the file SJLB.PI5. These results should be similar to the results in Table 2.2.4 of GPD-1. Example 4 Running a simulation interactively. Start GEMSIM running. gemsim ! DOS Then respond to prompts according to the User Input in section 2.3.2 of GPD-1. If you rerun GEMPIE as in Example 3 above, the same Print file SJLB.PI5 should be re-created with the same results as before. Alternatively you can run GEMSIM from a Stored-input file. Start GEMSIM running. gemsim ! DOS Then respond sti sjlb.sti as described in section 2.3.3 of GPD-1. Example 5 - Running several Johansen simulations using SAGEM. To run Johansen simulations, start the program SAGEM running. sagem ! DOS Then type in the responses as in section 2.4 of GPD-1 for Command file input, or the responses in section 2.4.1 of GPD-1 for interactive mode. Run GEMPIE (as described in section 2.4 of GPD-1) to create the print file SJLBJ.PI5 and examine it using the text editor. Example 6 - Changing the Closure and shocks. To modify the closure on the command file SJLB.CMF, copy the file SJLB.CMF to SJLB2.CMF. copy sjlb.cmf sjlb2.cmf ! DOS Then use a text editor to modify this file, following the steps below. In the original closure, both components of p_XFAC (supplies of labor and capital) are exogenous. Here we keep the supply of capital exogenous, but set the price (rather than the supply) of labor SUGGESTIONS FOR HANDS-ON COMPUTING Page E-4 Examples using the Stylized Johansen Model SJ exogenous. (1) Find the statement exogenous p_XFAC ; and change this to exogenous p_PF("labor") p_XFAC("capital") ; (Be careful not to leave a space between the variable name p_PF and the bracket in this type of command.) (2) Shock p_PF("labor"), the price of labor, by 3 per cent and shock p_XFAC("capital"), the supply of capital, by 10 per cent. You will need two separate shock commands. The first is shock p_PF("labor") = 3 ; (3) Change the name of the Solution file to SJLB2. (4) Change the verbal description appropriately. Rerun program GEMSIM with command file SJLB2.CMF (similarly to Example 2) and view the Extrapolation Accuracy file SJLB2.XAC using the text editor. Extrapolation Accuracy files, which estimate the accuracy of an extrapolated multi-step solution, are discussed in section 2.5.3 of GPD-1. Example 7 - Making a data file using MODHAR In the editor, view the text file SJDAT.TXT. Details of the syntax of text files are given in Appendix C. Start the program MODHAR running. modhar ! DOS Then type in the User Input in section 3.4.1 of GPD-1 as shown below. Input for MODHAR to Recreate Data File for Stylized Johansen __________________________________________________________________ ! Use default program options n ! Not based on old file (we are creating a new one) sj.dat ! Name of file to be created at ! Add arrays from a text file sjdat.txt ! The name of the text file a ! Add all arrays from this file ex ! Exit (There is no more data to add.) ! Your name ! Date (Will not be prompted for on most machines) Standard input-output data for the Stylized Johansen model. ! History **end ! end the history y ! Yes, this history is what I wanted _____________________________________________________________________ End of Input for MODHAR to Recreate Data File for Stylized Johansen SUGGESTIONS FOR HANDS-ON COMPUTING Page E-5 Examples using the Stylized Johansen Model SJ You may wish to check that the file SJ.DAT has been created. You can examine the data on it by running the GEMPACK program SEEHAR (as in Example 8 below). Example 8 - Viewing a data file using SEEHAR Run SEEHAR to examine the data in a Header Array file (SJ.DAT). seehar ! DOS Then respond to prompts giving SJ.DAT as the Header Array file to examine and SJ.SEE as the output file. Choose r to output all arrays. Examine SJ.SEE in the editor. Example 9 - Condensation of Stylized Johansen using TABLO The concept of condensation is discussed in section 3.9 of GPD-1. This is also an example of using some of the basic options at the start of all GEMPACK programs, creating a LOG file and taking input from a Stored-input file SJCOND.STI. Run TABLO. tablo ! DOS Then enter the following responses: User Input to TABLO __________________________________________________________________ log ! LOG file sjcond.log ! name of log file sti ! Stored-input file B ! output to both screen and log file sjcond.sti ! name of Stored-input file __________________________________________________________________ When this finishes, examine (using your text editor) the Information file SJCOND.INF and the LOG file SJCOND.LOG. Example 10 - Running GEMSIM for Condensed SJ Copy the file SJLB.CMF to file SJCOND.CMF. copy sjlb.cmf sjcond.cmf ! DOS Edit the file SJCOND.CMF to change the names of the Auxiliary files, Equation file and Solution file to SJCOND. Run the program GEMSIM using the command file SJCOND.CMF (as in Example 2 above). Compare the .XAC files SJLB.XAC (for the uncondensed system) and SJCOND.XAC (for the condensed system of equations). The results should be the same but not all variables are there in SJCOND.XAC. SUGGESTIONS FOR HANDS-ON COMPUTING Page E-6 Examples using the Stylized Johansen Model SJ Example 11 - Backsolving using TABLO Copy the file SJCOND.STI to SJBACK.STI Edit the file SJBACK.STI (1) to change the "s" above p_XH to a "b" so that p_XH is backsolved for instead of being substituted out. (2) Change the name of the Information file and the GEMSIM Auxiliary files to SJBACK Repeat the steps in Examples 9 and 10 above, replacing SJCOND with SJBACK throughout. Compare the .XAC files in the three simulations SJ, SJBACK and SJCOND to see whether p_XH is present. E.2 Miniature ORANI Model Examples The following examples are based on files relating to the Miniature ORANI model MO. Preparing a Directory for Model MO To keep all examples files for this model together in one area, create a separate directory MO. Under DOS, you can use the command md \mo ! DOS Change to this directory and copy the MO files from the directory containing GEMPACK model examples. Under DOS, you can use the commands cd \mo ! DOS copy \gp51\examples\mo*.* ! DOS source code version or copy \gem\mo*.* ! DOS Demonstration version dir ! DOS Example 12 - Implementation of the model MO using TABLO Run TABLO. tablo ! DOS Then respond to prompts as in Example 1 but replace the file name SJ with MO. Example 13 - Simulation using GEMSIM Examine the command file MOTAR.CMF in the editor to see the closure and shocks applied in the simulation. SUGGESTIONS FOR HANDS-ON COMPUTING Page E-7 Miniature ORANI Model Examples Run the program GEMSIM using the Command file MOTAR.CMF similarly to Example 2 above. Look at the Extrapolation Accuracy file MOTAR.XAC to see the results or run GEMPIE as in Example 3 above to make a print file MOTAR.PI5. Example 14 - Using a stored closure with SAGEM Create the Command file MOSAGEM.CMF on the editor. The file MOSAGEM.CMF should be as follows: !_________ Start of file MOSAGEM.CMF ______________________ use equation file mo ; solution file = mosagem ; use environment file mo ; individually-retained exogenous %all ; shock p_t 2 = 1 ; shock p_phi = 1 ; shock p_fWAGE = -2.38 ; shock p_cR = 2.76 ; verbal description = MO Standard closure ; !____________ End of file _________________________________ Run the program SAGEM with this command file. sagem ! DOS Then enter responses log mosagem.log cmf B mosagem.cmf If there are any errors, look in the log file MOSAGEM.LOG. If not, run GEMPIE as in section 2.4 of GPD-1 for SAGEM runs to create the GEMPIE Print file MOSAGEM.PI5 from the Solution file called MOSAGEM.SL4. Examine the .PI5 file to see the results. Example 15 - Homogeneity Test using SAGEM To test whether some models are homogeneous, you can shock certain price variables by 1 percent and leave all quantities unshocked. (See section 8.1.2 of GPD-1 for more information.) In this example, you will carry out one such homogeneity test for MO. SUGGESTIONS FOR HANDS-ON COMPUTING Page E-8 Miniature ORANI Model Examples Copy the command file MOSAGEM.CMF to a new file MOHOMOG.CMF and edit MOHOMOG.CMF so that only the exchange rate p_PHI is shocked and the shock is 1 percent. Change the name of the Solution file to MOHOMOG but use the same Equations file and Environment file (MO). Rerun the simulation using SAGEM as in Example 14. Run GEMPIE as in section 2.4 of GPD-1 to create the Print file MOHOMOG.PI5 and examine the results in the editor. Similarly you can shock all quantity variables by 1 percent and leave all price variables unshocked to check a second kind of homogeneity. Example 16 - Modifying a closure using GEMSIM To modify the closure in the command file MOTAR.CMF, first copy it to a new filename MOTAR2.CMF, then edit it using the editor to make the following changes: (1) Replace the exogenous variable 'p_phi' by the variable 'p_cpi'. (2) Replace the second component of p_XEXP, p_XEXP("c2"), by the second component of p_v, 'p_v("c2")'. (3) Change the name of the solution file to "motar2" and the name of the environment file to "mo2". (4) Change the verbal description at the end to indicate these changes have been made. Rerun the program GEMSIM using this command file MOTAR2.CMF. The results are in the Extrapolation Accuracy file MOTAR2.XAC. E.3 Other Models Supplied Example 17 - TABLO Input files and Simulations Examine in the editor (or print out) some of the TABLO Input files (extension .TAB) from the Examples subdirectory on your computer. Brief directions for running each of the model examples are given in Appendix B of GPD-1, and comments in the TABLO Input files and Command files give further help. References are given for each of the models. Try running simulations with some of these models. E.4 Working with TABLO Input Files You can use the GEMPACK software to build and solve your own models, and to carry out data-related tasks. We suggest you create a new directory on the hard disk for each model. A description of building models and an introduction to TABLO Input files are given in chapter 3 of GPD-1. The basic TABLO syntax is in Chapter 3 of the GEMPACK Document GPD-2, "User's Guide to TABLO, GEMSIM and TABLO-generated Programs". SUGGESTIONS FOR HANDS-ON COMPUTING Page E-9 Working with TABLO Input Files Example 18 - Modifying a TABLO Input file As a very simple example of modifying a TABLO Input file, try editing the file MO.TAB. Change the initial prices of commodities PCOM, the price of labour PLAB and the price of capital PCAP from 1 to 2 dollars per unit. To do this, search the file for the statement FORMULA(INITIAL) and make the relevant changes. Save the edited file with a new name MO2.TAB. Since you have changed the model, you need to run TABLO again as in Example 1 or 12 above. Copy the file MOTAR.CMF to MO2TAR.CMF and then edit it to change the name of the Auxiliary files to the new model name MO2 and change the name of the Equation and Solution and updated data files to MO2TAR for the new simulation. You can use the same data file as before (MO.DAT). Run this new simulation using the Command file MO2TAR.CMF as in Example 2 or 13 above. Examine the results to see the effects on prices, quantities and dollar values. There should be no difference in the simulation results since the change in the initial prices made (from 1 to 2) should not affect percentage changes at all. Example 19 - Checking whether a database is balanced This is an example of using the GEMPACK programs for data manipulation only (instead of for simulations where a set of equations is solved). (See section 3.4.3 of GPD-1 for an introduction to this use of TABLO.) Table 2.2.1a in section 2.2.1 of GPD-1 shows the standard data base for the Stylized Johansen model. The horizontal totals (Total sales) should balance the vertical totals (Total production). Write a TABLO Input file which reads in the data in Table 2.2.1a (this is similar to the reading section of SJ.TAB). In this TABLO Input file, define new COEFFICIENTs for Total sales and Total production for each sector. Use FORMULA statements to calculate total sales and production from the input data and write these variables to a Display file using DISPLAY statements. Process your new TABLO Input file using TABLO. Then run GEMSIM (interactively), attaching the GEMSIM Statement and Table files corresponding to your new TABLO Input file, and using the data file SJ.DAT as the input file. Look at the Display file produced in the text editor. By comparing corresponding values of Total sales and production for each sector, you can check whether the database is balanced. You can then rerun GEMSIM using the same GEMSIM Statement and Table file, but using the updated data file SJLB.UPD (created in the first simulation in Example 2 above) as the input file (rather than SJ.DAT) to check that the updated database remains balanced after the simulation in Example 2 above. SUGGESTIONS FOR HANDS-ON COMPUTING Page E-10 Using TABLO-generated Programs E.5 Using TABLO-generated Programs In the previous examples, the program GEMSIM is used to run simulations. In this section, we give hands-on examples using the alternative method of running simulations using TABLO-generated programs as described in section 2.6 of GPD-1. We suggest that you run these examples (even though they are very similar in many ways to the examples using the program GEMSIM) to clarify the differences between the two methods. To summarise the TABLO-generated program method, the program TABLO is used to convert the algebraic equations of the economic model into a Fortran program which is specific to that model. The TABLO-generated Fortran program is compiled and linked to a library of GEMPACK subroutines. The executable image produced is used instead of GEMSIM to run simulations on the model. This method provides faster execution times for large models but means you must have an appropriate Fortran compiler. It is not possible to use the TABLO-generated method unless you have a full source-code version of GEMPACK. E.5.1 Stylized Johansen Simulations via TABLO-generated programs In this section we give hands-on examples for the Stylized Johansen model. These examples are all similar to ones in section E.1 above, but here you will use the TABLO-generated program for Stylized Johansen instead of GEMSIM to carry out simulations. Preparing the Directory SJ for the TABLO-generated version In order to see that the following examples have run successfully, delete the results files from the GEMSIM runs described in section E.1. However you still need the files copied earlier in section E.1 from the examples subdirectory. Under DOS, you can use the commands cd \sj ! DOS del *.eq4 ! DOS del *.sl4 ! DOS del *.bcv ! DOS del *.xac ! DOS del *.upd ! DOS To prepare an executable version of the TABLO-generated program for the SJ model takes two steps shown in Examples 1aT and 1bT. The simulation step is in Example 2T which is is equivalent to Example 2 above. SUGGESTIONS FOR HANDS-ON COMPUTING Page E-11 Stylized Johansen Simulations via TABLO-generated programs Example 1aT - Implement model SJ using a TABLO-generated program. This is STEP 1(a) in section 2.6.1 of GPD-1. Start the program TABLO running. Under DOS (and several other systems), this can be done by entering tablo ! DOS Then type in the User Input given in section 2.6.2 of GPD-1. The only difference between this and the input for Example 1 above is the response wfp ! Write a Fortran (the TABLO-generated) program instead of the response pgs ! Produce output for GEMSIM When this finishes, check that the TABLO-generated program SJ.FOR and the Auxiliary files SJ.AXS and SJ.AXT have been created. dir *.for ! DOS dir *.ax* ! DOS There is also an Information file called SJ.INF as in Example 1. Example 1bT - Compile and link the TABLO-generated program. This is Step 1(b) in section 2.6.1 of GPD-1. The commands for compiling and linking vary from machine to machine. For a DOS machine, you can simply run the batch file LTG.BAT to compile the Fortran program SJ.FOR, link to the GEMPACK libraries and create the executable image SJ.EXE. Enter ltg sj ! DOS (do not include the extension '.FOR' in this command). Check that the file SJ.EXE has been created. Example 2T - Running a Simulation using the TABLO-generated program This is Step 2 in section 2.6.1 of GPD-1. Start the TABLO-generated program SJ running. Under DOS (and several other systems), this can be done by entering sj ! DOS After the program SJ has started, the prompts and responses are identical to those for GEMSIM as given in Example 2 above. When the program prompts, you enter the two responses cmf sjlb.cmf These responses cause the program SJ.EXE to run a simulation as SUGGESTIONS FOR HANDS-ON COMPUTING Page E-12 Stylized Johansen Simulations via TABLO-generated programs described in section 2.6.4 of GPD-1. You can use the same Command file SJLB.CMF as for the GEMSIM method. The only difference between the Command file for GEMSIM and that for the equivalent TABLO-generated program SJ is that the command auxiliary file = SJ ; is optional for the TABLO-generated program whereas this command is mandatory for GEMSIM since this is the input which tells GEMSIM which model you are using. However for the TABLO-generated program, the model to use is determined by the name of the TABLO-generated program SJ. As in Example 2 above, the Solution file SJLB.SL4 is produced by the TABLO-generated program. Example 3T - Print out the results using GEMPIE. This is Step 3 of section 2.6.1 of GPD-1 and is identical to Example 3 given above. Start the program GEMPIE running. Under DOS (and several other systems), this can be done by entering gempie ! DOS then type in the User Input in section 2.2.4 of GPD-1. Examine the results in file SJLB.PI5 using your text editor. These results should be similar to the results in Table 2.2.4 of GPD-1. Example 4T Running a simulation interactively. Start the TABLO-generated program SJ running. sj ! DOS Then respond to prompts according to the User Input in section 2.3.2 of GPD-1 except that you must omit the second response which gives the name of the GEMSIM Statement file. Apart from this, the responses to prompts are exactly the same as in Example 4 above. Alternatively you can run the TABLO-generated program from a Stored-input file. Copy the file SJLB.STI to a new file SJLBTG.STI and edit the file SJLBTG.STI to remove the second response 'sj' (which gives the GEMSIM Statement filename). Since all the other responses to prompts are the same, the file SJLBTG.STI can now be used to run TABLO-generated program SJ.EXE. Start SJ running. sj ! DOS Then respond sti sjlbtg.sti SUGGESTIONS FOR HANDS-ON COMPUTING Page E-13 Stylized Johansen Simulations via TABLO-generated programs as described in section 2.3.3 of GPD-1. You can rerun the Examples 6, 9, 10 and 11 above for TABLO-generated programs. Example 6T - Changing the Closure and Shocks Run the TABLO-generated program SJ with the Command file SJLB2.CMF (from Example 6 above). Enter sj cmf sjlb2.cmf Examples 9T, 10T and 11T - Condensing and Backsolving Edit the Stored-input files SJCOND.STI and SJBACK.STI to change 'pgs' to 'wfp'. Then you will need to carry out Steps 1(a) and 1(b) as in Examples 1aT and 1bT to create, compile and link the TABLO-generated programs SJCOND and SJBACK. However when you reach the simulation step (see example 2T) you can reuse the Command files SJCOND.CMF and SJBACK.CMF to run the TABLO-generated programs SJCOND.EXE and SJBACK.EXE. E.5.2 Miniature ORANI Model Simulations via TABLO-generated program The following examples which are based on files relating to the Miniature ORANI model MO illustrate the TABLO-generated method of running simulations. Preparing the Directory MO for the TABLO-generated version In order to see that the following examples have run successfully, delete the results files from the GEMSIM runs described in section E.2. However you still need the files copied earlier in section E.2 from the examples subdirectory. Under DOS, you can use the commands cd \mo ! DOS del *.eq4 ! DOS del *.sl4 ! DOS del *.bcv ! DOS del *.xac ! DOS del *.upd ! DOS SUGGESTIONS FOR HANDS-ON COMPUTING Page E-14 Miniature ORANI Simulations via TABLO-generated program Example 12aT - Implementation of the model MO using TABLO Run TABLO. tablo ! DOS Then respond to prompts as in Example 1aT (choosing option 'wfp') but replace the file name SJ with MO in the responses. Example 12bT - Compile and link the TABLO-generated program Compile and link the TABLO-generated program MO.FOR by typing ltg mo ! DOS and check that the executable image has been created (MO.EXE). Example 13T - Simulation using TABLO-generated program MO Run the TABLO-generated program MO using the Command file MOTAR.CMF similarly to Example 2aT above. Enter mo ! DOS cmf motar.cmf Look at the Extrapolation Accuracy file MOTAR.XAC to see the results or run GEMPIE as in Example 3 above to make a print file MOTAR.PI5. Example 16T - Modified closure for TABLO-generated program You can also rerun Example 16 with the modified closure using the TABLO-generated program MO.EXE (instead of GEMSIM) and the modified Command file MOTAR2.CMF. APPENDIX F DIFFERENCES BETWEEN RELEASES 5.0 AND 4.2.02 OF GEMPACK This appendix is addressed to readers who have used Release 4.2.02 of GEMPACK but are not familiar with Release 5.0. It describes the features of Release 5.0 which are not in Release 4.2.02. In comparison with Release 4.2.02 (April 1991), Release 5.0 (April 1993) introduced significant improvements in the areas of solution speed and accuracy, ease of use (especially in batch mode), data manipulation, simulation reporting, and user documentation. It is now possible to implement levels models directly (without having to first linearize the equations). Below we outline these and other areas of change. Of course, all the features below are also available in Release 5.1. Accurate multi-step solutions (1) Release 5.0 contains two new methods for calculating multi-step solutions, namely Gragg's method and the midpoint method, which converge much more quickly than Euler's. (This means that the results from Gragg or midpoint calculations are generally much more accurate than those from an Euler calculation with the same number of steps, even though they take about the same time to compute.) To take full advantage of these methods, we advise you to change any UPDATE (EXPLICIT) statements in your TABLO Input files to UPDATE (CHANGE) statements, as explained in section 3.5.3. (2) Formatted Solution (SLX) files, which are now called Extrapolation Accuracy (XAC) files, contain extra information which makes it easy for you to assess how accurate your solution is. They can tell you at a glance how many figures accuracy you can be sure of for each component of each endogenous variable and give a summary across all endogenous variables. Details can be found in section 2.5.3. (3) Solution accuracy is also increased because the well-known process of iterative refinement of solutions (via residual correction) is employed by SAGEM and TABLO-generated code (although, again you have the option of turning this off). See section 7.5 for more information. In particular, this means that there is little point in using values of the Harwell parameter U larger than 0.1; doing so may take considerably longer and will not result in more accurate solutions. Differences Between Releases 5.0 and 4.2.02 of GEMPACK Page F-2 Speed of TABLO-generated Programs (1) In Release 4, condensation of a model often led to many calculations being repeated in several submatrices or updates. This no longer occurs with Release 5 TABLO-generated programs, which accordingly may run much faster.* During condensation, TABLO creates extra COEFFICIENTs (to stand for the results of calculations that may previously have been repeated) to speed up submatrix calculations and does system-initiated backsolves for certain variables if it judges that this will speed up the update calculations. You will find that a little more time may be taken during the Formula calculation stage (to calculate the values of the extra COEFFICIENTs) but that this is more than offset by the much quicker submatrix and update calculations. (2) Solution speed is also improved by taking advantage of the Harwell routines' ability to reuse the "pivots" (see Duff (1977)) used to calculate the LU decomposition in earlier steps of a multi-step solution. To make this most likely to succeed, the default is now to store on the Equations file in step 1 of a multi-step solution all coefficients (that is, entries in the Equations Matrix C) calculated, even if they are zero. For some models, reusing pivots will not succeed; in these cases, you have the option of turning it off. Ease of Use (1) Each program starts by offering you several options. Some are standard to all programs while others are program-specific. Amongst the ones standard to all programs are options + to take all input from a Stored-input file, + to take some inputs from a Stored-input file and then, once the file ends, to transfer control back to you at the terminal, + to store all inputs you make on a file which can be used later as a Stored-input file, + to write all output to a LOG file (and usually also to the terminal), + to use brief prompts, + to stop whenever one piece of invalid input is encountered. (This is intended for batch operation when you are not there to change input judged by the program to be invalid.) _____________________ * For example, for ORANI at its full disaggregation, the Release 5 running time for Formulas plus Submatrices plus Updates is only about 30-35 percent of the time for Release 4.2.02. Differences Between Releases 5.0 and 4.2.02 of GEMPACK Page F-3 These options are selected by the same process as previously used for selecting TABLO options. See sections 5.3 and 5.4 for details. (2) In terminal input (and therefore in Stored-input files) you can ALWAYS put in comments, the beginning of which is signalled by a single exclamation mark !. (Such comments end at the end of the current line, unless continued to the next line by an exclamation mark at its start.) See section 5.2 for more details. (3) A completely new form of input called GEMPACK Command files is accepted by SAGEM and TABLO-generated programs. These files are much easier to construct than Stored-input files because they are essentially order-independent. This means you do not have to be able to anticipate the exact order in which the program asks you for information. They are also self-documenting since they use easily understood commands such as use Equations file STJ ; Harwell parameter = 0.8 ; exogenous xfac pcom 1-10 20 ; rest endogenous ; steps = 1 2 4 ; See section 2.3.1 and Appendix A for details. Levels Equations and Models Prior to Release 5, the equations of models had to be presented in linearized form in the TABLO Input file. It is now possible to write down levels equations directly in these files. Indeed these can contain a mixture of linearized and levels equations, as explained in chapter 3. Simulation Reporting and Data Manipulation (1) You can now ask the utility programs SEEHAR and SLTOHT to produce output in a form which is suitable for reading data into other non-GEMPACK utilities such as spreadsheets, and MODHAR and TABLO-generated programs can read data in this form. These features are designed to make it easy to transfer data between GEMPACK and other applications including spreadsheets to assist you in preparing or modifying data and in preparing reports about your model or your simulation results. See chapter 8 for details. (2) New commands 'at' and 'ah' (add several arrays from a text or Header Array file respectively) make it easier to use MODHAR to build data files for models. See GPD-3 for details. (3) When running GEMPIE you have the option of selecting the order in which the endogenous variables appear in the Print file. See section 7.6.2 for details. Differences Between Releases 5.0 and 4.2.02 of GEMPACK Page F-4 Other New Features (1) On most machines, Creation Information put on files by GEMPACK programs now includes the time and date the file was created. This information is usually displayed at the terminal when an existing file is accessed. (2) When you substitute out a variable during the condensation phase of TABLO, you can now say that, nevertheless, you want to be able to calculate and report its values in a simulation. This process is called backsolving for this variable. Of course the variable in question can only be endogenous (not exogenous). Its values can be calculated if the simulation is carried out via the relevant TABLO-generated program but are not available if the simulation is carried out via SAGEM. See section 3.9.2 for more details. (3) There is much less output from TABLO-generated code, which makes LOG files much more manageable and useful. However you have the option of increasing the amount of detail if you wish. You can also ask for WRITEs to text files or the terminal to be done at all steps instead of just during the first step. See chapter 5 of GPD-2 for more details. (4) TABLO-generated code has options which enable you, for example, to suppress displays or writes or to ignore equations on a particular run. See section 5.6 of GPD-2 for more details. (5) TABLO-generated programs have a large number of other options which you may find useful. See chapter 5 of GPD-2 for details. (6) The Code Generation stage of TABLO is quicker. (7) When choosing sets of variables via the 'L' (Lists) option, there are extra possibilities including, for example, a (COM) (COM,IND) to select all available variables with one argument ranging over the set COM (this is what (COM) means) and two arguments ranging over COM and IND and m to select all available macro variables. See section 6.2.4 and section D.2.2 in Appendix D. Similar abbreviations can be used when selecting sets of variables on a Command file (see section 6.2.1). (8) Equations files now have equation block information on them, which means that the map produced by SUMEQ (see section 8.1) also shows this information. (9) The program CMPHAR can meaningfully compare two simulation solutions which have been converted to Header Array form via SLTOHT. The program COMPEQ can compare two Equations files Differences Between Releases 5.0 and 4.2.02 of GEMPACK Page F-5 and report differences by submatrix (that is, by equation block and vector variable). See chapter 8 for details. More Comprehensive Documentation Most importantly, the documentation for Release 5.0 was completely reorganised. In particular, the number of separate documents was reduced significantly. The Release 5.0 documentation superseded many old documents including documents numbered GED-2,GED-3,GED-6,GED-7,GED-8,GED-20,GED-20a,GED-22,GED-23 and GED-24. Readers should note that, as a part of this process, the numbering of GEMPACK Documents was re-started with Release 5.0 of GEMPACK, when the abbreviation "GPD" was first used. Previous editions of these documents did not have the same numbers as the current editions. Pre-Release-5 documents have the abbreviation "GED-xx". For example, the pre-Release-5 document GED-2 ('Choosing A Set of Variables') should not be confused with the current GPD-2 which is a User's Guide to TABLO, GEMSIM and TABLO-generated programs. APPENDIX G FORTRAN COMPILERS FOR USE WITH GEMPACK ON PCS In this appendix we give information about those Fortran compilers which are currently supported for use with source-code versions of GEMPACK on 80386/80486 PCs and Macintosh PCs. Other Fortran compilers on these machines cannot be used with GEMPACK at present. A suitable Fortran compiler is required with all source-code versions of GEMPACK in order to install the software, vary program parameters (to work with large models) and, most importantly, to compile and link TABLO-generated programs. G.1 Compilers on 80386/80486 Machines Two compilers, Lahey's F77L-EM/32 and Watcom's Fortran 77/32, can be used on 80386/80486 PCs running DOS, Windows or OS/2. The Lahey compiler F77L-EM/32 is available from Lahey Computer Systems Inc 865 Tahoe Blvd PO Box 6091 Incline Village, NV 89450, USA Telephone: 800-548-4778 or 702-831-2500 FAX: 702-831-8123 The Australian distributor of Lahey products is Computer Transition Systems Box 4553 Melbourne Vic 3001 Australia Telephone: (03)-510-7789 FAX: (03)-525-1661 Version 5.0 or later (preferably version 5.01 or later) is required. The Watcom compiler Fortran 77/32 is available from Watcom International Corp 415 Phillip Street Waterloo, Ontario, Canada N2L 3X2 Telephone: 1-800-265-4555 or (519)-886-3700 FAX: (519)-747-4971 FORTRAN COMPILERS FOR USE WITH GEMPACK ON PCS Page G-2 Compilers on 80386/80486 Machines One Australian distributor of Watcom products is Microway PO Box 84 Mordialloc, Vic 3195 Australia Telephone: (03)-580-1333 FAX: (03)-580-8995 At present, over half of GEMPACK source-code users are working on 80386/80486 PCs using the Lahey compiler. Only a small number are using the Watcom compiler (which has only been supported since late 1993). Modellers running OS/2 may find the Watcom compiler attractive since it can produce true OS/2 executables (while at present the Lahey compiler can only produce executables which run in the DOS box). G.1.1 Hardware Requirements on 80386/80486 Machines A minimum of 4Mb of memory is required, together with at least 20-25Mb free disk space to install and test GEMPACK. You will also need several extra megabytes free to install the Fortran compiler and in which to build your own models. For the Lahey compiler, a separate math coprocessor is required on 80386 or 80486 SX machines. (80486 DX machines have a built-in coprocessor.) For the Watcom compiler, a coprocessor is not essential but is strongly recommended for all except small models. FORTRAN COMPILERS FOR USE WITH GEMPACK ON PCS Page G-3 Compilers on Macintosh Computers G.2 Compilers on Macintosh Computers Two compilers can be used on Macintosh computers. If your hardware is sufficient (roughly speaking, Mac II or better), we recommend Alternative 1 below, the MacFortran II compiler. In each case, you will need a hard disk with a minimum of 20-25Mb free to install and test GEMPACK. You will also need several extra megabytes free to install the Fortran compiler and in which to build your own models. Each of these compilers is available from Absoft Corporation 2781 Bond St Rochester Hills Michigan 48309 USA Telephone: (313)-853-0050 FAX: (313)-853-0108 The Australian agent for Absoft is Oxford Systematics PO Box 126 Heidelberg, Vic 3084 Australia Telephone: (03)-459-9671 Alternative 1 This is the Absoft Fortran compiler MacFortran II version 3.2 or later. This requires o at least 11 Mb of RAM (memory), o Macintosh operating system 6.0.5 or later, o a Macintosh with a 68020 or 68030 CPU (Central Processor) with 68881 or 68882 FPU (Floating Point Unit), OR a 68040 CPU with hardware floating point capabilities. This compiler comes with MPW (Macintosh Programmer's Workshop). Alternative 2 This is the Absoft Fortran compiler MacFortran/020 version 2.4. This requires o a Macintosh SE or better, o at least 4Mb of memory. A numeric coprocessor is not required. REFERENCES Atkinson, Kendall E. (1989) An Introduction to Numerical Analysis, second edition, Wiley, New York. Calder, Wayne (1992), 'Hitchhikers Guide to GEMPACK', Impact Preliminary Working Paper No. C10-01, Melbourne (October), pp.31. Codsi, G., K.R. Pearson and P.J. Wilcoxen (1992), 'General-Purpose Software for Intertemporal Economic Models', Computer Science in Economics and Management vol.5, pp.57-79. [A preliminary version was Impact Preliminary Working Paper No. IP-51, Melbourne (May 1991), pp.39.] Codsi, G. and K.R. Pearson (1988), 'GEMPACK: General-Purpose Software for Applied General Equilibrium and Other Economic Modellers', Computer Science in Economics and Management vol.1, pp.189-207. [A preliminary version was Impact Preliminary Working Paper No. IP-39, Melbourne (July 1988), pp.31.] Dixon P.B., B.R. Parmenter, J. Sutton and D.P. Vincent (1982), ORANI: A Multisectoral Model of the Australian Economy, North-Holland, Amsterdam. Dixon, P.B., B.R. Parmenter, A.A. Powell and P.J. Wilcoxen [DPPW] (1992), Notes and Problems in Applied General Equilibrium Economics, North-Holland, Amsterdam. Duff I.S. (1977), 'MA28 - A Set of FORTRAN Subroutines for Sparse Unsymmetric Linear Equations', Harwell Report R.8730 (HMSO, London), pp.104. Harrison, W.J., K.R. Pearson, A.A. Powell and E.J. Small (1993a), 'Solving Applied General Equilibrium Models Represented as a Mixture of Linearized and Levels Equations', Impact Preliminary Working Paper No. IP-61, Monash University, Clayton (September 1993), pp.20. Harrison, W.J. and E.J. Small (1993b), 'TABLO Input Files for the Stylized Johansen, Miniature ORANI and ORANI-F Models', Impact Computing Document No. C11-01, Monash University, Clayton (September 1993), pp.29. Hertel, T.W., J.M. Horridge and K.R. Pearson (1992), Mending the Family Tree: A Reconciliation of the Linearized and Levels Schools of AGE Modelling, Economic Modelling, vol.9, pp.385-407. [A preliminary version was Impact Preliminary Working Paper No. IP-54, Melbourne (June 1991), pp.45.] Hertel, T.W. and M.E. Tsigas (1993), 'GTAP Model Documentation', Department of Agricultural Economics, Purdue University, July 1993, pp.32+26. Horridge, J.M., B.R. Parmenter and K.R. Pearson (1993), ORANI-F: A General Equilibrium Model of the Australian Economy, Economic and Financial Computing, vol.3, pp.71-140. Pearson, K.R. (1988), 'Automating the Computation of Solutions of Large Economic Models', Economic Modelling, vol.5, pp.385-395. [A preliminary version was Impact Preliminary Working Paper No. IP-27, Melbourne (March 1986), pp.28.] Pearson K.R. (1991), 'Solving Nonlinear Economic Models Accurately via a Linear Representation', Impact Preliminary Working Paper No. IP-55, Melbourne (July), pp.39. Pearson, K.R. (1992) Simulation Software for Use with 'Notes and Problems in Applied General Equilibrium Economics', North-Holland, Amsterdam. _ _ _ Stewart, G.W. (1973) Introduction to Matrix Computations, Academic Press, London. Wilcoxen, P.J. (1989), Intertemporal Optimization in General Equilibrium: A Practical Introduction, Impact Preliminary Working Paper No. IP-45, Melbourne (December), pp.170. GEMPACK DOCUMENTS* GPD-2, User's Guide to TABLO, GEMSIM and TABLO-generated Programs, Second edition, April 1994, pp.138+14. GPD-3, How to Create and Modify GEMPACK Header Array Files Using the Program MODHAR, Third edition, April 1993, pp.27+4. GPD-5, Installing and Using GEMPACK on Macintosh PCs with MacFortran/020, Fourth edition, (in preparation, expected May 1994). GPD-5B, Installing and Using GEMPACK on Macintosh PCs with MacFortran II, First edition, (in preparation, expected May 1994). GPD-6, Installing and Using GEMPACK on 80386 or 80486 DOS PCs with Lahey Fortran F77L-EM.32, Fourth edition, (in preparation, expected May 1994). GPD-6B, Installing and Using GEMPACK on 80386 or 80486 DOS PCs with the Watcom Fortran Compiler 77/32, Second edition, (in preparation, expected May 1994). ________________________________ * The numbering of GEMPACK Documents has been re-started with Release 5 of GEMPACK, when the abbreviation "GPD" was first used. Previous editions of these documents did not have the same numbers as the current editions. Pre-Release-5 documents are numbered "GED-xx". Document GPD-4, Implementing Levels Models Directly Using GEMPACK (First edition, April 1993) is now superseded. (Its contents are included in the current versions of GPD-1 and GPD-2.) GPD-1 Page Index-1 Index INDEX Abbreviation Interactive, 6-12 Command file syntax, A-10 Closure, 2-10, 2-41, 6-1 Absolute difference, 8-6 Command file syntax, A-4 Absorbed variable, 3-49 Different shocks, 7-8 Accuracy, 2-31, 7-9 Meaning, 6-1 Actions Modifying Commands, 6-5, D-5 see TABLO-generated programs Saving, 6-4, D-7 Aggregating data, 3-24 Specifying, 6-3 AMST, 8-19 Valid, 6-1, D-2 Apple File Exchange, 8-17 CMPHAR, 8-6 Arrays Option SOL, 8-7 Dimensions, C-4 CMPSOL, 8-20 Text, C-1 Code ASCII file, 2-47 TABLO, 3-45 ASSEQ, 8-19 Code generation Auxiliary Statement,Table files, TABLO, 3-50 2-39, 4-8, A-4 COEFFICIENT TABLO, 3-15 Backsolving, 3-48 to 3-49 Column order, C-1 Base Coefficient Values file, SEEHAR, 8-5 2-43, 2-48 SLTOHT, 8-9 see also BCV file Column sums Batch operation, 5-2, 5-5 Equations, 8-2 BCV file, 2-43 Columns see also Base Coefficient Solution, 7-2 Values file Comma-separated values format Binary compatible, 8-16 see CSV format Binary files Command file, 2-10, A-1 Transfer of files, 8-16 Closure, 6-3 Use in GEMPACK, 2-47 Eliminating syntax errors, 5-9 Bug Example, A-12 Reporting, 5-8 SAGEM Example, 6-10, A-17 Command file syntax C matrix, 2-29 to 2-30, 7-8 Choice of variables, 6-8 see also Equations Matrix Closure, A-4 Condensation, 3-45 Files, A-3 Calibration, 3-38 SAGEM, A-13 Case sensitive, 3-34, 5-1, A-10 Shocks, 6-16 TABLO, 3-14 TABLO-generated programs, A-2 Change variables, 3-17 Comments, 3-20, 5-2, C-3 Character strings, C-6 Amongst data, C-3 Check Command file syntax, A-10 TABLO, 3-45, 3-50 Comparing Checking models, 8-4 Header Array files, 8-6 Choice of Variables Solution files, 8-6 Macros,all,one, 6-13 Comparing data, 8-20 Sets, 6-15, D-11 COMPEQ, 8-20 To shock or print, 6-8 Compile, 2-41 Choice of variables Components of variables Command file, 6-8 Specifying, D-9 GPD-1 Page Index-2 Index Computation time Endogenous, 2-1, 6-1 Extrapolation, 2-33 Individual,cumulative, 7-2 TABLO, 3-50 Setting variables, D-3 U parameter, 7-10 Environment Condensation, 3-45 see Closure Example, 3-46 Meaning, 6-1 Condense Environment file, 2-19, 2-48, D-3 TABLO, 3-45, 3-50 EQUATION Condensing twice, 3-50 TABLO, 3-8, 3-16 CPU time Equation block, 2-29 Command file syntax, A-8 EQUATION(NONE) statement, 3-24 SAGEM, 7-11 Equations, 2-29 CRTS Linearized, 2-1 Model files, B-5 Solving them, 7-9 CSV format, 3-24, 3-26, 8-5, C-5 Equations file, 2-43 Cumulative results, 2-28, 7-4 Command file syntax, A-3 Cumulative solution, 8-8 Contents, 2-29, 8-1 Cumulatively-retained Creation, 4-1 Choice of, 6-9 Production and use, 2-48 Cumulatively-retained endogenous, Summary, 8-2 7-4 Transferring, 8-18 Backsolves, 3-49 Equations Matrix, 2-29 to 2-30, Meaning of, 7-4 7-8, 8-1 Condensation, 3-45 Data Map, 8-2 Comparing, 8-5 Error message, 5-7 Data file, 2-48, 3-18 Errors Command file syntax, A-2 Rounding, 8-7 Transfer, 8-18 Errors in Command file Data manipulation, 3-23, 8-8, Eliminating, 5-9 8-18 Euler's method, 2-31, 4-3 Actions, 4-3 Example Default response, 5-1 Command file, A-12 Defaults Examples of User Input Command file, A-10 see User input Demonstration version of GEMPACK, Exclamation mark, 5-2, C-3 1-4, 2-35 Executable image, 2-36 Description file Executable image version of SLTOHT, 8-15 GEMPACK, 1-3, 2-35 Difference Exogenous, 2-1, 6-1 see Absolute difference Individual,cumulative, 7-2 Difference ratio, 8-6 Setting variables, D-3 Different machines, 1-2, 8-16 Exogenous/Endogenous split Binary compatible, 8-16 see Closure Comparing results, 8-20 Extra data file DISPLAY Command file syntax, A-2 TABLO, 3-16 Extrapolation, 2-32, 4-3 DMR Extrapolation Accuracy file, 2-19, Model files, B-4 F-1 Documentation, 9-1 Contents, 2-33 DPPW, 2-2 Use, 2-48 Extrapolation Accuracy Summary, Elasticity, 7-2 2-34 Eliminated variables, 3-48 GPD-1 Page Index-3 Index Fatal Error, 5-7 Transfer, 8-16 FILE Header Mapping file TABLO, 3-15 SLTOHT, 8-12 File Headers see Binary files Reserved, 3-24 see Command file Help see Data file Online, 5-7, 7-10 see Environment file Homogeneity, 8-4 see Equations file How much data information, 3-18, see GEMPIE Print file C-1 see Header Array file Shocks, 6-19 see Log file see Shock file Identifier see Stored-input file see Model identifier see TABLO Input file Ill-conditioned matrix, 7-11 see Text files Implementation, 2-1, 3-50 Logical name, 3-15 Increasing Parameters, 5-7 File name Individual column results, 2-25, Standard suffixes, 2-47 7-2 File types and names, 2-47 Printing, 7-7 Formatted Solution files, F-1 Individual solution, 8-8 FORMULA & EQUATION, 3-16 Individually-retained Fortran compiler, 2-35, G-1 Choice of, 6-9 FTP, 3-25, 8-17 Individually-retained endogenous, 7-4 GEMPACK Meaning of, 7-2 Versions, 1-3, 2-35 Individually-retained exogenous, GEMPACK Command file 7-4 see Command file Meaning of, 7-2 GEMPACK Documents, 9-1, F-5 Information file, 2-8, 2-39 GEMPACK programs, 1-2 Input redirection, 2-23 GEMPIE, 7-4 Interactive operation, 5-2, 5-5 Choice of variables, 6-8 Intermediate file Example, 2-12, 2-42 Command file syntax, A-3 Options, 7-10 Internal program error, 5-8 Print file, 2-3, 2-12, 2-36, Intertemporal models 7-4 see GPD-2 Subtotals, 7-6 Iterative refinement, 7-10, A-8, GEMSIM A-16, F-1 How to run, 2-10 see also Residual correction GEMSIM Auxiliary files Meaning, 2-3 Johansen simulation, 2-24, 2-31, GEMSIM Statement,Table files, 2-8 7-1 Gragg's method, 2-32, 4-3 Transferring, 8-18 Johansen solution Harwell Laboratories, 7-9 Meaning, 2-31 Harwell parameter, 7-9 Johansen's method, 4-3, 7-1 Header, 3-24 Joining files Header Array SPJNTX, 8-18 From Solutions, 8-8 Header Array files, 3-24, 8-5 Kermit, 3-25, 8-17 Creating, 3-18 Keyword, 3-8, 3-14 Examining data, 3-18 Modifying, 3-18 Labelling information, 3-14 GPD-1 Page Index-4 Index Large data files Multi-step simulation, 4-3 SPJNTX, 8-18 Multi-step solution, 2-29, 2-31 Large models No subtotals, 7-8 Condensation, 3-45 Levels equations, 2-2, 3-2 Nonlinear equation, 2-31 Levels TABLO Input file, 3-43 Numerical values Levels variables, 2-2, 3-17 Shocks, 6-16 Linearized equations, 2-29, 3-2 Linearized TABLO Input file, 3-43 Omitting variables, 3-49 Lists Online help, 5-7, 7-10 Choice of variables, 6-8 Option Help, 5-7, 7-10 Lists of variables, D-6, D-9 Options Log file, 2-23, 5-3 CMPHAR Terminal output, 5-5 SOL, 8-7 Long name, 3-24 GEMPACK Basic, 5-3 LU decomposition, 4-5, 7-9, F-2 ASI, 5-4 LU file, 6-5, D-3 Invalid input, 5-4 Using, 7-13 BAT, 5-4 BPR, 5-6 MA28, 7-9 LOG, 5-3, 5-6 Macro variables, 6-9, 6-12, D-8, SIF, 5-4 D-12 Invalid input, 5-4 Meaning, 2-7 STI, 5-3, 5-6 Map of Equations file, 8-2 GEMPIE Mapping file CPL, 7-12 Header, 8-12 CPW, 7-12 SLTOHT, 8-9 FBS, 7-12 Spreadsheet, 8-13 NBV, 7-12 Matrix OSR, 7-12 Equations, 2-30, 7-8, 8-2 OSS, 7-12 Ill-conditioned, 7-11 RPO, 7-12 Singular, D-2 SNA, 7-12 Solution, 7-2 SAGEM Sparse, 2-31, 8-2 CMF, 7-10 Memory Command file, A-16 TABLO-generated programs, 4-8 CPU, 7-11 Midpoint method, 2-32 KZC, 7-11 Miniature ORANI NIR, 7-11 Example, 6-2 NSM, 7-11 Model files, B-2 NWE, 7-11 Mixed TABLO Input file, 3-43, B-3 SEEHAR MKEQ, 8-16, 8-18 COL, 8-5 MKHAR, 8-16 to 8-17 NEL, 8-6 Model examples, 1-4, B-1 ROW, 8-5 Model identifier, 7-12 SS, 8-5 Model name, 7-12 SLTOHT Model representation DES, 8-15 Levels, 3-43 SIC, 8-9 Linearized, 3-43 SIR, 8-9 Mixed, 3-43 SS, 8-9 Model verification, 8-4 VAI, 8-9 Model version, 7-12 TABLO Code MODHAR, 3-22, 3-24 PGS, 2-3, 2-36 see also GPD-3 WFP, 2-36 GPD-1 Page Index-5 Index TABLO-generated programs, A-8 Command file example, A-17 Options menu Command file syntax, A-13 GEMPACK programs, 5-3 Johansen simulations, 7-1 TABLO-generated program, 4-3 Many solutions, 7-9 ORANIF Options, 7-10 Model files, B-3 Solution file, 7-2 Output redirection, 2-23 Subtotals, 7-4 Outputs from SAGEM, 7-2 Scalar variables, 6-9 Meaning, 2-7 Page width,length SEEHAR, 3-24, 3-26, 8-5 GEMPIE, 7-12 Options, 8-5 Parameters SEESMD, 8-19 In equations, 3-4 SEEST, 8-19 Program, 5-7 SET Passes TABLO, 3-15 TABLO-generated program, 4-3 Set-up files, 8-19 Percentage change, 2-2, 3-17 Sets of variables Percentage-change variables, 3-17 Choosing, 6-15, D-11 Print file Shock file, 6-19 Meaning, 2-48 Shocks Program errors, 5-8 Command file syntax, A-6, A-11 Prompts Component list, A-7 Choice of variables, 6-8 For one step, 4-6 Some option, D-12 Meaning, 6-1 Multi-dimensional variable, Qualifier, 3-14 6-20 Quantifier, 3-8, 3-15 Numerical values, 6-16 Same closure, 7-8 READ SLTOHT, 8-12 TABLO, 3-15 Specifying, 6-16 Reading data, 2-48, 3-7, 3-18 Uniform, 6-19 Real numbers, C-5 Meaning, 6-16 Reducing model size, 3-45 SIC (solutions in columns), 8-10 Repeated values, 6-19, A-11, C-5 Significant differences, 8-7 Reporting program errors, 5-8 Simulation Residual correction, 7-10, F-1 Choice of variables, 6-8 see also Iterative refinement Meaning, 2-1 Reusing pivots, F-2 SAGEM, 7-1 Rounding errors, 7-9 Steps, 2-3 Row order, C-1, C-7 Stylized Johansen example, 2-6 SEEHAR, 8-5 Simulations SLTOHT, 8-9 Several at once, 2-24 Row print order SIR (solutions in rows), 8-10 GEMPIE, 7-12 SLTOHT, 3-26, 8-8 Row sums SLTOHT Mapping file, 8-12 Equations, 8-2 Solution Row totals, 7-4 Computation time, 2-33, 7-10 RWEQ, 8-16, 8-18 Matrix, 7-2 RWHAR, 8-16 to 8-17 Simulation, 7-2 RWSL, 8-20 To Header Array files, 8-8 To Text files, 8-8 SAGEM, 2-24, 7-5 Solution files, 2-3, 2-10, 2-36 Backsolved variables, 3-49 Comparing, 8-8 Choice of variables, 6-8 Contents, 7-2 GPD-1 Page Index-6 Index SAGEM, 7-2 Printing, 7-7 Solution method Subtotal solution, 8-8 Command file syntax, A-2 Suffix, 2-47 Solution subtotals, 7-4 Standard, 2-47 Solving models, 2-1 SUM Source-code versions of GEMPACK, TABLO, 3-15 1-3, 2-35 SUMEQ, 8-2 Sparse matrices, 7-9, 8-2 SUMHAR, 3-24, 8-5 Sparse matrix U parameter, 7-9 SUMSMD, 8-19 SPJNTX, 8-16, 8-18 Swapping variables, D-5 Splitting files Syntax errors in Command file SPJNTX, 8-18 Eliminating, 5-9 Spreadsheet, 3-24, 8-5, C-1, C-7 Example, 8-11, 8-14 Tableau, 2-30, 8-1 From Solutions, 8-8 TABLO, 2-29 SEEHAR, 8-5 How to run, 2-8, 2-39 Separator, 3-26 Record, Table files, 3-50 SLTOHT, 8-9 Restarting, 3-50 Spreadsheet files Stages, 3-45, 3-50 see also CSV format TABLO Input file, 2-1, 3-1, 3-7 Spreadsheet Mapping file Comment, 3-14 SLTOHT, 8-13 Data manipulation, 3-23 to 3-24 Standard suffixes, 2-47 Examples, B-1 Statement in TABLO Input file, Levels, 3-43, B-3 3-14 Linearized, 3-43 Steps Mixed, 3-43 Command file syntax, A-2 Statements, 3-14 TABLO-generated program, 4-3 TABLO language, 3-17 Stored-input file, 2-22, 5-3 TABLO syntax Terminal output, 5-5 see GPD-2 Stylized Johansen model Example, 3-7 Condensation, 3-46 TABLO-generated program, 2-35 Data, 3-5 TABLO-generated programs, 2-39 Description, 2-6 Actions, 4-1 Equations, 3-2 Choice of variables, 6-8 Equations Matrix C, 2-30 Command file example, A-12 GEMSIM simulation, 2-10 Command file syntax, A-1 Model files, B-1 Meaning, 2-36 SAGEM simulation, 2-24 Memory required, 4-8 TABLO Input file, 3-10 One solution, 7-9 TABLO-generated simulation, Options menu, 4-3 2-41 Terminal Input Subintervals Comments, 5-2 Command file syntax, A-2 Shocks, 6-19 Submatrix, 8-1 Terminal output Submatrix Data files, 8-19 Suppressing, 5-5 Subset Text files Choice of variables, 6-8 Data files for models, 3-25 Substitution, 3-45, 3-49 Data Input/Output, 3-24 Subtotal, 2-28, 7-4 to 7-5 From Solutions, 8-8 Command file syntax, 6-9, A-15 Input to MODHAR, 3-19 Description, 8-15 Joining, 8-19 Example, 7-5 Old to new format, C-8 Meaning of, 7-4 Splitting, 8-18 GPD-1 Page Index-7 Index Syntax, C-1 TABLO Check only, 3-51 Transfer of files, 8-16 TABLO Condense and Code, 3-51 Use in GEMPACK, 2-47 TABLO Step 1, 2-8, 2-39 TRADMOD Model files, B-3 VAI (variable arguments ignored), Transferring data 8-10 Between machines, 8-17 VARIABLE Between PCs and mainframes, TABLO, 3-15 8-17 Variables, 2-29 Transferring data between PCs and Change, 3-17 mainframes, 3-25 Levels, 2-2 Transferring models, 4-8, 8-16 Macro TREES see Macro variables Model files, B-5 Percentage change, 2-2, 3-17 Scalar U parameter, 7-9 see Scalar variables Undefined solution values Shocked, 6-8 SLTOHT, 8-12 Specifying components, D-9 Uniform shocks, 6-19 Vector UPDATE see Vector variables Actions, 4-1 Vector variables, 2-29, C-2 Change, 3-35 Meaning, 2-7 Example, 3-35 Verbal Description, 2-18 Meaning, 3-35 Version Product, 3-35 see also Model version Purpose, 3-27 Versions of GEMPACK, 1-3, 2-35 UPDATE(CHANGE), 3-35 Demonstration, 1-4 Updated data Executable, 1-3 After Johansen simulation, 2-28 Source-code, 1-3 Updated data file, 2-48 User input WRITE Condensation in TABLO, 3-47 TABLO, 3-16 GEMPIE example, 2-12, 2-42 GEMSIM, 2-20 MODHAR Modify Data, 3-22 Zero coefficients, 7-11