On Reproducible Econometric Research



Similar documents
The Importance of Reproducible Research

Monitoring Structural Change in Dynamic Econometric Models

Testing, Monitoring, and Dating Structural Changes in Exchange Rate Regimes

CISC 275: Introduction to Software Engineering. Lab 5: Introduction to Revision Control with. Charlie Greenbacker University of Delaware Fall 2011

Version Control Tutorial using TortoiseSVN and. TortoiseGit

Implementing a Class of Structural Change Tests: An Econometric Computing Approach

Revision control systems (RCS) and

Version Control! Scenarios, Working with Git!

SAS in clinical trials A relook at project management,

Introduction to Subversion

Version control. HEAD is the name of the latest revision in the repository. It can be used in subversion rather than the latest revision number.

CSCB07 Software Design Version Control

Chapter-1 : Introduction 1 CHAPTER - 1. Introduction

Version Uncontrolled! : How to Manage Your Version Control

Web Hosting Features. Small Office Premium. Small Office. Basic Premium. Enterprise. Basic. General

Version Control with Subversion

Version Control with. Ben Morgan

High Level Design Distributed Network Traffic Controller

Version Control Tools

Barely Sufficient Software Engineering: 10 Practices to Improve Your Research CSE Software

What Is Specific in Load Testing?

Enabling Better Business Intelligence and Information Architecture With SAP Sybase PowerDesigner Software

PTK Forensics. Dario Forte, Founder and Ceo DFLabs. The Sleuth Kit and Open Source Digital Forensics Conference

Forensic Analysis of Internet Explorer Activity Files

Work. MATLAB Source Control Using Git

Chapter 3: Data Mining Driven Learning Apprentice System for Medical Billing Compliance

Software Delivery Integration and Source Code Management. for Suppliers

Version control with Subversion

South Carolina College- and Career-Ready (SCCCR) Probability and Statistics

Documentation and Project Organization

MySQL databases as part of the Online Business, using a platform based on Linux

Exchange Rate Regime Analysis for the Chinese Yuan

CPSC 491. Today: Source code control. Source Code (Version) Control. Exercise: g., no git, subversion, cvs, etc.)

Version Control with Git. Linux Users Group UT Arlington. Rohit Rawat

Version Control with Git. Kate Hedstrom ARSC, UAF

Version Control with Svn, Git and git-svn. Kate Hedstrom ARSC, UAF

Introducing Xcode Source Control

Two Best Practices for Scientific Computing

Automate Your Deployment with Bamboo, Drush and Features DrupalCamp Scotland, 9 th 10 th May 2014

Forecasting in STATA: Tools and Tricks

DATA MINING TOOL FOR INTEGRATED COMPLAINT MANAGEMENT SYSTEM WEKA 3.6.7

Miguel A. Figueroa Villanueva Xabriel J. Collazo Mojica. ICOM 5047 Capstone Miguel A. Figueroa Villanueva University of Puerto Rico Mayagüez Campus

ProgressBook StudentInformation Report Builder User Guide

An Introduction to Mercurial Version Control Software

XML. CIS-3152, Spring 2013 Peter C. Chapin

How To Retire A Legacy System From Healthcare With A Flatirons Eas Application Retirement Solution

Theme 1 Software Processes. Software Configuration Management

Data Management Implementation Plan

ECON 523 Applied Econometrics I /Masters Level American University, Spring Description of the course

Automating the Measurement of Open Source Projects

Deposit Identification Utility and Visualization Tool

Introduction to Software Engineering (2+1 SWS) Winter Term 2009 / 2010 Dr. Michael Eichberg Vertretungsprofessur Software Engineering Department of

Packrat: A Dependency Management System for R

Enabling Better Business Intelligence and Information Architecture With SAP PowerDesigner Software

GUI Test Automation How-To Tips

Using WebLOAD to Monitor Your Production Environment

Version Control Systems

Guideline for stresstest Page 1 of 6. Stress test

Nominal and Real U.S. GDP

Forecast. Forecast is the linear function with estimated coefficients. Compute with predict command

Redmine: A project management software tool. January, 2013

Javadoc like technical documentation for CAPRI

BI xpress Product Overview

How a Content Management System Can Help

SOFTWARE TESTING TRAINING COURSES CONTENTS

partykit: A Toolkit for Recursive Partytioning

Database Studio is the new tool to administrate SAP MaxDB database instances as of version 7.5.

Teamstudio USER GUIDE

Ball Aerospace s COSMOS Open Source Test System

Source Control Systems

Introductory Concepts

The Impact of Release Management and Quality Improvement in Open Source Software Project Management

Archival Data Format Requirements

Annoyances with our current source control Can it get more comfortable? Git Appendix. Git vs Subversion. Andrey Kotlarski 13.XII.

FEAWEB ASP Issue: 1.0 Stakeholder Needs Issue Date: 03/29/ /07/ Initial Description Marco Bittencourt

Xcode Source Management Guide. (Legacy)

Lesson 7 - Website Administration

enicq 5 External Data Interface User s Guide

Content Management Systems: Drupal Vs Jahia

Data management on HPC platforms

STATISTICA Solutions for Financial Risk Management Management and Validated Compliance Solutions for the Banking Industry (Basel II)

How To Manage Source Code With Git

Audit TM. The Security Auditing Component of. Out-of-the-Box

Polynomial Neural Network Discovery Client User Guide

A recipe using an Open Source monitoring tool for performance monitoring of a SaaS application.

Software Requirement Specification for Web Based Integrated Development Environment. DEVCLOUD Web Based Integrated Development Environment.

Distributed Version Control with Mercurial and git

EAE-MS SCCAPI based Version Control System

ProGUM-Web: Tool Support for Model-Based Development of Web Applications

Test Data Management Concepts

Transcription:

On Reproducible Econometric Research Achim Zeileis http://eeecon.uibk.ac.at/~zeileis/

Overview Joint work with Roger Koenker (University of Urbana-Champaign). Koenker R, Zeileis A (2009). On Reproducible Econometric Research. Journal of Applied Econometrics, 24(5), 833 847. doi:10.1002/jae.1083 And with Christian Kleiber (Universität Basel). Zeileis A, Kleiber C (2005). Validating Multiple Structural Change Models A Case Study. Journal of Applied Econometrics, 20(5), 685 690. doi:10.1002/jae.856 Kleiber C, Zeileis A (2008). Applied Econometrics with R. Springer-Verlag, New York. URL http://cran.r-project.org/package=aer Kleiber C, Zeileis A (2011). Reproducible Econometric Simulations. Working Paper 2011-02, Working Papers in Economics and Statistics, Research Platform Empirical and Experimental Economics, Universität Innsbruck. URL http://econpapers.repec.org/repec:inn:wpaper:2011-02

Overview Forensic econometrics: Case studies Cross-country growth regressions Multiple structural change models Software tools Version control Data technologies and data archiving Programming environments Document preparation systems Literate programming Challenges and conclusions

Forensic econometrics: Growth regressions Investigation: Cross-country growth behavior based on extended Solow model. Durlauf and Johnson (1995, Journal of Applied Econometrics) extend analysis by Mankiw, Romer, Weil (1992, The Quarterly Journal of Economics). Of interest: Output (GDP per capita) growth from 1960 to 1985 for 98 non-oil-producing countries. Variables: Real GDP per capita; fraction of real GDP devoted to investment; population growth; fraction of population in secondary schools; and adult litercy rate. Data taken from MRW. DJ added literacy rate. Available as data.dj in JAE data archive. Models: OLS regressions for full sample and breaks based on initial output and literacy.

Forensic econometrics: Growth regressions Dependent variable: log(y /L) i,1985 log(y /L) i,1960. (Y /L) i,1960 < 1950 (Y /L) i,1960 1950 Full sample LR i,1960 < 54% LR i,1960 54% Observations 98 42 42 Constant 3.040 1.400 0.450 (0.831) (1.850) (0.723) log(y /L) i,1960 0.289 0.444 0.434 (0.062) (0.157) (0.085) log(i/y ) i 0.524 0.310 0.689 (0.087) (0.114) (0.170) log(n + 0.05) i 0.505 0.379 0.545 (0.288) (0.468) (0.283) log(school) i 0.233 0.209 0.114 (0.060) (0.094) (0.164)

Forensic econometrics: Growth regressions Replication: Data is available from JAE archive, and OLS regression should be trivial... right? Data: Read, code missing values, and select non-oil countries. R> dj <- read.table("data.dj", header = TRUE, + na.strings = c("-999.0", "-999.00")) R> dj <- subset(dj, NONOIL == 1) Model: R formula (converting percentages to fractions). R> f1 <- I(log(GDP85) - log(gdp60)) ~ log(gdp60) + + log(iony/100) + log(popgro/100 + 0.05) + log(school/100) Regression: OLS fit for full sample and subsamples. R> mrw <- lm(f1, data = dj) R> sub1 <- lm(f1, data = dj, subset = GDP60 < 1950 & LIT60 < 54) R> sub2 <- lm(f1, data = dj, subset = GDP60 >= 1950 & LIT60 >= 54)

Forensic econometrics: Growth regressions Full sample results: Success! Only minor deviations. R> mrw <- lm(f1, data = dj) R> coeftest(mrw) Durlauf & Johnson Replication Observations 98 98 Constant 3.040 3.022 (0.831) (0.827) log(y /L) i,1960 0.289 0.288 (0.062) (0.062) log(i/y ) i 0.524 0.524 (0.087) (0.087) log(n + 0.05) i 0.505 0.506 (0.288) (0.289) log(school) i 0.233 0.231 (0.060) (0.059)

Forensic econometrics: Growth regressions Subsample results: Failure! Not even sample size is correct. R> sub2 <- lm(f1, data = dj, subset = GDP60 >= 1950 & LIT60 >= 54) R> coeftest(sub2) Durlauf & Johnson Replication Observations 42 39 Constant 0.450 3.952 (0.723) (1.337) log(y /L) i,1960 0.434 0.425 (0.085) (0.104) log(i/y ) i 0.689 0.653 (0.170) (0.187) log(n + 0.05) i 0.545 0.587 (0.283) (0.361) log(school) i 0.114 0.137 (0.164) (0.180)

Forensic econometrics: Growth regressions Problem 1: Grid search plus educated guessing leads to different breaks. R> sub2b <- lm(f1, data = dj, subset = GDP60 >= 1800 & LIT60 >= 50) R> coeftest(sub2b) Durlauf & Johnson Replication Observations 42 42 Constant 0.450 4.147 (0.723) (1.230) log(y /L) i,1960 0.434 0.435 (0.085) (0.096) log(i/y ) i 0.689 0.689 (0.170) (0.178) log(n + 0.05) i 0.545 0.545 (0.283) (0.345) log(school) i 0.114 0.114 (0.164) (0.171)

Forensic econometrics: Growth regressions Problem 2: Population growth and schooling not fractions but percent. R> sub2c <- update(sub2b,. ~ log(gdp60) + + log(iony) + log(popgro/100 + 0.05) + log(school)) Durlauf & Johnson Replication Observations 42 42 Constant 0.450 0.450 (0.723) (0.899) log(y /L) i,1960 0.434 0.435 (0.085) (0.096) log(i/y ) i 0.689 0.689 (0.170) (0.178) log(n + 0.05) i 0.545 0.545 (0.283) (0.345) log(school) i 0.114 0.114 (0.164) (0.171)

Forensic econometrics: Growth regressions Problem 3: Robust sandwich standard errors. R> coeftest(sub2c, vcov = sandwich) Durlauf & Johnson Replication Observations 42 42 Constant 0.450 0.450 (0.723) (0.723) log(y /L) i,1960 0.434 0.435 (0.085) (0.085) log(i/y ) i 0.689 0.689 (0.170) (0.170) log(n + 0.05) i 0.545 0.545 (0.283) (0.283) log(school) i 0.114 0.114 (0.164) (0.164)

Forensic econometrics: Growth regressions Summary: Cutoffs actually used did not match those indicated. Usage of standard errors inconsistent. Scaling of variables (and hence intercepts) inconsistent. Other models in DJ paper: Similar problems, and some inference not reproducible at all. Implications: Casts doubt results. (Even though in this case, so far qualitative results remain unchanged.) Very hard to track down without original code. Might have been impossible for less standard models. Hence: Provide replication code even for simple things and details.

Forensic econometrics: Structural change models Investigation: Multiple structural change model for level of US ex-post real interest rate (Jan 1961 Jul 1986). Source: Bai and Perron (2003, Journal of Applied Econometrics). Comprehensive discussion of computational aspects of multiple structural change models. Empirical examples, with data in JAE archive. GAUSS software and replication code! Replication: Re-implementation of methods in R (package strucchange). Successful replication of: Breakpoint estimates (OLS), coefficient estimates (OLS), coefficient standard errors (quadratic spectral kernel HAC with prewhitening). Problems: Confidence intervals of breakpoints.

Forensic econometrics: Structural change models Bai & Perron Real interest rate 5 0 5 10 1960 1965 1970 1975 1980 1985 Time

Forensic econometrics: Structural change models Replication Real interest rate 5 0 5 10 1960 1965 1970 1975 1980 1985 Time

Forensic econometrics: Structural change models What is going on? Computation of confidence intervals is based on asymptotic theory, leading to nonstandard distribution function. Quantiles need to be computed from functional of a two-sided Brownian motion with different scales and drifts. This also involves the term: exp(ax) Φ( b x). For second breakpoint: a 8.31, b 4.08, and x [0, 300]. Product of a huge and a tiny number, numerically very instable. Better: exp{ax + log Φ( b x)} and compute log Φ directly. But still: GAUSS 3.2.38 (and even up to 6.0.8) chokes on this.

Forensic econometrics: Structural change models P(X x) 0.0 0.2 0.4 0.6 0.8 1.0 1.2 GAUSS R 0 50 100 150 200 x

Forensic econometrics: Structural change models Computation of Φ(y) and log(φ(y)) with y = 4.08 x in GAUSS 3.2.38 and R (all versions at least since 2.1.1). GAUSS R GAUSS R x cdfn(y) pnorm(y) lncdfn(y) pnorm(y, log.p=true) 82 4.23e 299 4.23e 299 687.03 687.03 84 2.46e 306 2.46e 306 703.69 703.69 86 2.23e 308 0 720.35 720.35 88 2.23e 308 0 737.01 737.01 90 2.23e 308 0 753.66

Forensic econometrics: Structural change models Conclusions: Be careful about numerical precision of your own code...... and also the functions of your programming environment. Replication would not have been successful without access to GAUSS code of Bai and Perron. Epilogue: Aptech fixed lncdfn() in recent versions of GAUSS (after initial private e-mails to us claiming that our computations were wrong). Stata published a very good and openly available C implementation for normal log-probabilities.

Software tools Typically: An econometric analysis encompasses the following. Data handling. Data analysis in some programming environment. Document preparation with results of the analysis. Question: Which software can assist the researcher in making such an analysis reproducible?

Software tools: Version control Often: Research is carried out over an extended period, by several authors, on several computers, and hence difficult to reconstruct exactly. Problem: Files proliferate with inconsistent naming conventions, get overwritten or deleted or are ultimately archived upon paper acceptance... or next disk crash. Idea: Employ version control tools. Only one current version of each file. But full history of all changes in database. Annotate changes in log files. Enable moving back and forth through revisions.

Software tools: Version control Work flow: Initially, check out a repository of files. Subsequently, easily check out updates by other authors. Work on files and commit own changes. All changes, additions, removals stored in repository. Software: Popularized through internet and open software development. Various packages available: CVS, SVN, Git, Mercurial,... Probably most popular for small to medium sized projects: Subversion (SVN). Only diffs stored in each revision. On Windows: TortoiseSVN integrates with Explorer.

Software tools: Data technologies and data archiving Typically: Data is not extremely large or complex. Flat plain text file ideal for reproducibility: Portable, easy to store and access. Furthermore: Relational database management systems for complex data, e.g., open-source systems PostgreSQL or MySQL. New standards for web-based sharing of data, e.g., XML or PHP.

Software tools: Programming environments In general: Many aspects drive choice of programming environment. Here: Focus on aspects directly relevant to reproducibility. Desirable: Command line interface (CLI) or at least script from some graphical user interface (GUI). Modular code that is easy to read, encapsulates conceptual tasks, and is reusable in other settings. Open sources to enable gradual refinement.

Software tools: Document preparation systems Two approaches: WYSIWYG (what you see is what you get) text processors (e.g., Microsoft Word, OpenOffice.org, LibreOffice,... ). Markup languages (like L A T E X, HTML,... ). Again: Focus on reproducibility. Stable open standards preferred. Proprietary binary formats (such as Microsoft Word) problematic. Flat text files ideal for combination with version control.

Software tools: Literate programming Idea: Merge text, documentation, and computer code to facilitate keeping everything in sync. Literate programming: Single file contains documentation and computer code. Tangling: Extract computer code. Weaving: Produce documentation that optionally shows or hides the code. Literate data analysis: Extend weaving step: Execute code to produce all numeric output, tables, figures, etc. Sweave in R: Combines R code with L A T E X (or HTML, ODF,... ). Results in dynamic or revivable documents.

Challenges and conclusions Real challenge: Better incentives from journals and funding agencies for archiving and distribution of details underlying empirical and/or computational work. Goal: Convince authors that providing such details will enhance the chances for publication and citation of their work. However: Advances in (open) software make it relatively easy to enhance reproducibility without too much extra effort. At eeecon: New server and support by the admins provide web-based services, in particular web space, working paper series, SVN,...