diff --git a/roadmap/HARKworkflow.pdf b/roadmap/HARKworkflow.pdf new file mode 100644 index 0000000..c521ae9 Binary files /dev/null and b/roadmap/HARKworkflow.pdf differ diff --git a/roadmap/MakeHARKworkflow.py b/roadmap/MakeHARKworkflow.py new file mode 100644 index 0000000..ac3aaf4 --- /dev/null +++ b/roadmap/MakeHARKworkflow.py @@ -0,0 +1,51 @@ +''' +Make a quick workflow diagram for HARK meeting. +''' +import graphviz + +HARKflow = graphviz.Digraph(comment='workflow for HARK') + +HARKflow.node('HARK1', 'HARK 1.0', rank='sink') + +with HARKflow.subgraph() as x: + x.attr(rank='same') + x.node('params','parameter \n improvements') + x.node('solve', 'solver \n improvements') + x.node('sim', 'simulation \n improvements') + +with HARKflow.subgraph() as y: + y.attr(rank='same') + y.node('A', 'undo hierarchy \n among solvers') + y.node('B', 'automated simulation \n from model dynamics') + y.node('C2', 'rewrite input \n constructors') + y.node('D', 'add "parameters \n block" to models') + y.node('H', 'multiple "modes" \n for simulation') + +with HARKflow.subgraph() as z: + z.attr(rank='same') + z.node('F', 'make parser for simulation', shape='rectangle') + z.node('G', 'make parser for auto-solution', shape='rectangle') + z.node('I', 'make "type \n constructor"', shape='rectangle') + +HARKflow.node('C1', 'new system for \n constructed inputs') +HARKflow.node('E', 'design micro \n syntax for DSL', shape='rectangle', rank='source') + +HARKflow.edge('params','HARK1') +HARKflow.edge('solve','HARK1') +HARKflow.edge('sim','HARK1') +HARKflow.edge('C1','C2') +HARKflow.edge('C2','params') +HARKflow.edge('D','params') +HARKflow.edge('A','solve') +HARKflow.edge('B','sim') +HARKflow.edge('H','sim') +HARKflow.edge('E','I') +HARKflow.edge('E','F') +HARKflow.edge('E','G') +HARKflow.edge('I','C2',style='invis') +HARKflow.edge('I','params') +HARKflow.edge('G','solve') +HARKflow.edge('F','sim') + + + diff --git a/roadmap/memos/.gitignore b/roadmap/memos/.gitignore new file mode 100644 index 0000000..eac0968 --- /dev/null +++ b/roadmap/memos/.gitignore @@ -0,0 +1,2 @@ +# MyST build outputs +_build diff --git a/roadmap/memos/DraftGrantForLanguageDev.pdf b/roadmap/memos/DraftGrantForLanguageDev.pdf new file mode 100644 index 0000000..37a4f2b Binary files /dev/null and b/roadmap/memos/DraftGrantForLanguageDev.pdf differ diff --git a/roadmap/memos/DraftGrantForLanguageDev.tex b/roadmap/memos/DraftGrantForLanguageDev.tex new file mode 100644 index 0000000..c92daf1 --- /dev/null +++ b/roadmap/memos/DraftGrantForLanguageDev.tex @@ -0,0 +1,124 @@ + + \documentclass[12pt,pdftex,letterpaper]{article} + \usepackage{setspace} + \usepackage[dvips,]{graphicx} %draft option suppresses graphics dvi display +% \usepackage{lscape} +% \usepackage{latexsym} +% \usepackage{endnotes} +% \usepackage{epsfig} + \usepackage{amsmath} +% \singlespace + \setlength{\textwidth}{6.5in} + \setlength{\textheight}{9in} + \addtolength{\topmargin}{-\topmargin} + \setlength{\oddsidemargin}{0in} + \setlength{\evensidemargin}{0in} + \addtolength{\headsep}{-\headsep} + \addtolength{\topskip}{-\topskip} + \addtolength{\headheight}{-\headheight} + \setcounter{secnumdepth}{2} +% \renewcommand{\thesection}{\arabic{section}} + % \renewcommand{\footnote}{\endnote} + \newtheorem{proposition}{Proposition} + \newtheorem{definition}{Definition} + \newtheorem{lemma}{lemma} + \newtheorem{corollary}{Corollary} + \newtheorem{assumption}{Assumption} + \newcommand{\Prob}{\operatorname{Prob}} + \clubpenalty 5000 + \widowpenalty 5000 + \renewcommand{\baselinestretch}{1.35} + \usepackage{amsmath} + \usepackage{amsthm} + \usepackage{amsfonts} + \usepackage{amssymb} + \usepackage{bbm} + \newcommand{\N}{\mathbb{N}} + \newcommand{\R}{\mathbb{R}} + \newcommand{\E}{\mathbb{E}} + \newcommand{\der}[2]{\frac{\text{d}#1}{\text{d}#2}} + \newcommand{\pd}[2]{\frac{\partial#1}{\partial#2}} + +\begin{document} +\begin{center} + \singlespacing \textbf{Initial Draft Language for Grant Proposal for the Development of HARK 2.0} +\end{center} + +\noindent \textbf{Purpose:} This document contains preliminary language that could be included in a request for funding for the development of ``HARK 2.0'', a software package for representing, solving, simulating, and estimating dynamic models with heterogeneous agents. It is not formatted as a grant proposal, but instead merely includes fragments of text that can be further developed and refined. The name ``HARK 2.0'' is used only as a shorthand in this paragraph. + +\vspace{0.5cm} + +\noindent \textbf{Synopsis:} In 2017, the newly founded Econ-ARK project received a generous grant from the Alfred P.\ Sloan Foundation to develop the \texttt{HARK} toolkit, a software package for solving, simulating, and estimating heterogeneous agents macroeconomics models. Using this funding, the structure and presentation of the \texttt{HARK} package was professionalized, and a wide variety of canonical models and applications were developed as exemplars for economists to use when developing their own research projects using \texttt{HARK}. In the years since, and using NumFocus as our fiscal sponsor, we have received additional funding from other sources (including the Think Forward Institute and T.\ Rowe Price, as a ``no strings attached'' corporate sponsor) to continue the work and expand the range of models offered in the \texttt{HARK} package, allowing us to achieve our original set of goals. + +Over the past seven years, the combination of our experience producing \texttt{HARK}, feedback we have received since its inception, and relatively recent developments in other software packages have led the Econ-ARK team to conclude that a new software package and modeling schema is needed to further advance the field and fully realize the vision of a common platform for dynamic structural modelers. We seek funding to create and deploy this new system, which we believe will fill a critical gap in the toolset available to structural economists, thus accelerating the development of models on the frontier of economic research, improving the verifiability of numeric output from such models, and improving communication and collaboration among researchers. In addition to academic researchers, such a platform would be of significant use both to governments (including central banks) in conducting prospective analyses of potential policy actions, and to private financial institutions who wish to make decisions or provide advice that is informed by a rigorous structural model. + +\vspace{0.5cm} + +\noindent \textbf{Background:} Over the past thirty years, economists have increasingly developed dynamic models of the decisions of individual agents (i.e.\ households or firms) that are intended to be interpreted \textit{quantitatively} rather than only \textit{qualitatively}. Instead of merely characterizing the general properties of the outcomes predicted by a particular theoretical model, researchers instead seek to quantitatively evaluate its performance in matching past observed outcomes, and to generate quantitatively plausible predictions of the effects of hypothetical future events and policies. This approach to economics is often referred to as structural modeling. When applied to macroeconomic topics, structural modeling involves generating aggregate outcomes as the accumulation of the individual decisions of many agents, each of whom may face different circumstances idiosyncratic to themselves. Hence this subfield is known as heterogeneous agents macroeconomics (``HA macro''), in contrast to the more traditional representative agent (``RA'') approach in which idiosyncratic heterogeneity among households and firms is assumed away. + +Modern models in both HA macroeconomics and structural microeconomics include stochastic processes that realistically reflect the large uncertainties inherent to the agents' problem-- potentially large shocks to their productivity, demand for their labor (or output), health, etc. In combination with risk averse preferences or constraints on access to capital, these sources of uncertainty generate model solutions for optimal behavior that are highly non-linear and require global (rather than local) methods for solving the model. Such methods are computationally complex and costly, requiring careful application of fundamental numeric tools like quadrature methods, functional approximation, and solving systems of non-linear equations. These tools are not usually taught as part of graduate economics training, and it takes years of experience to understand how they should be applied, and how to interpret (and correct) their apparent failures and shortcomings. + +While economists have developed a standard and well-adopted set of tools for representing, solving, and examining RA macro models (including especially the Dynare software package), and there is commercially available software for statistical and econometric analysis (e.g.\ Stata), there is no widely adopted software nor standard for HA models, nor dynamic structural models in general. Each research team instead develops its own bespoke software for each new project, often inheriting or adapting pieces from their own prior work. The code for each model is designed to meet the specific needs of that project, and there is no interoperability or standards for the usage or application of numeric methods. Individual toolkits have been developed for classes of problems and types of analysis, but none is universally applicable and each has limitations on the type of models that can be represented. + + +\vspace{0.5cm} + +\noindent \textbf{Proposal Summary:} Econ-ARK seeks funding to develop a language for expressing dynamic structural models (with a particular focus on heterogeneous agents macroeconomics), specifying numeric methods, and describing simulation procedures to generate model output. The language is intended to provide a common format for describing dynamic structural models that will be widely adopted for precisely conveying model content in a human- and machine-readable way, but is independent of the software and code to actually solve and implement the model. To that end, the funding sought will also be used to develop a software package that interprets model statements in the new language, generates code for solving and simulating the model (with the provided numeric method choices), and allows the user to interactively develop and build a structural model and examine its solution and output. + +Economic models are usually expressed with a combination of mathematical and natural language: most of the content can be concisely conveyed as a series of equations, inequalities, and other mathematical statements, while a few additional details are provided in plain English outside of the formal statement.\footnote{For example, few models of a person's life-cycle include a precise mathematical representation of what it means for an agent to ``die'' in the model; the authors trust that the reader understands the implications.} This representation of the theoretical model is intended to be readily understood by a human reader. Because dynamic structural models almost surely do not have a closed form solution, they can be solved only approximately using numeric methods. While it is increasingly common for researchers to publicly archive their project code, a description of the numeric methods used is usually omitted from the final published paper;\footnote{E.g., economists rarely publish information about quadrature methods, the discretization of a continuous state variable, or convergence criteria.} this information is (at best) relegated to an online appendix or (at worst) not documented anywhere outside of the code itself. Moreover, unlike the conventions of mathematically expressing a system of statements to compose a theoretical model, there is no straightforward and complete way to convey such numeric methods and details, even if an economist were so inclined. Even worse, there is no formal relationship between the model as expressed \textit{on paper} and the problem as solved \textit{in code}-- the academic refereeing system focuses deeply on the economics and relies on trust with respect to the numerics. + +Our proposed modeling language seeks to rectify these systemic issues with the workflow of economic research that uses dynamic structural models. We will provide a common platform for precisely representing the mathematical mechanics of dynamic structural models, providing syntax to specify a wide range of model features. The representation of a model in this language will be both human-readable (via a concise syntax and simple structure) and machine-readable (due to the precision and completeness of the modeling language). If a model specification file is used to generate a numeric solution and model output, a reader or evaluator can be confident that the model presented on paper matches its execution in code. Furthermore, our language will include a format for specifying the methods and choices used to solve the model numerically, transparently providing this information alongside the ``pure'' mathematical content of the model. In combination with our proposed software package, we seek to provide a platform for testing and evaluating the performance of a numeric solution to a theoretical model.\footnote{E.g., a tool for computing the accuracy of an approximate solution as measured by its adherence to a known characteristic of the solution, such as an automatic test of Euler equation errors.} + +\vspace{0.5cm} + +\noindent \textbf{Extant Tools:} Several software packages already exist that are \textit{related to} our proposed modeling framework, but are \textit{insufficient} individually or in combination to fulfill our vision. We will briefly describe each in turn, addressing the capabilities and limitations of the software, as well as how its scope and design relate to the work for which we seek funding. + +Most prominently, \texttt{Dynare} is a software package for the Matlab programming environment that has been in continuous development and use since 1994, and has been widely adopted for work with traditional representative agent macroeconomic models. In \texttt{Dynare}, a user first specifies their model in a file, declaring each variable, parameter, random shock, law of motion, etc. They then pass the model file to \texttt{Dynare}, which fully automates the process of solving for model behavior and provides an API for examining and processing model output. The format for a \texttt{Dynare} model file is relatively straightforward (and well documented), with an organizational structure that makes it reasonably readable by a human. Because of the package's wide adoption among RA modelers, \texttt{Dynare} model files can be (and regularly are) exchanged among different research teams. Over nearly thirty years of updating and improvement, the range of model features that can be handled by \texttt{Dynare} has significantly expanded, as has the set of numeric methods that it can employ. + +Undoubtedly, \texttt{Dynare} is a strong inspiration for our own vision, and a touchstone among macroeconomists. Indeed, when the \texttt{HARK} package is described to economists, they often interpret it \textit{through the lens} of \texttt{Dynare} and its capabilities for RA models. That is, they initially believe that \texttt{HARK} models are specified in model files and solved automatically by the package. Rather, \texttt{HARK} is a platform in which the solution method for each microeconomic model must be hand-coded by the user, but provides an environment that makes it relatively easy to introduce arbitrary \textit{ex ante} heterogeneity among agents (as well as represent large populations with \textit{ex post} heterogeneity arising from idiosyncratic shocks), with a wide array of example models for users to adapt for their own purposes. + +This mistaken interpretation of \texttt{HARK} is in fact key evidence in support of the great need for the platform we are proposing: macroeconomists broadly understand the \textit{limitations} of \texttt{Dynare} and hope for its extension to the frontier of heterogeneous agents modeling-- the new generation of HA models don't use \texttt{Dynare} because they \textit{can't}. Simply put, \texttt{Dynare} is designed solely around representative agent models, that might have a representative consumer, representative firm, and/or a representative bank, but \textit{never} have any concept of a \textit{multitude} of consumers, firms, or banks, each with their own circumstances. We seek to develop a modeling language and software platform that is akin to ``\texttt{Dynare} for HA'', for which so many of our colleagues have expressed hope. Because of the fundamental differences in the \textit{kind} of problems posed by HA vs RA models (and hence the kind of solution methods and numeric tools involved), \texttt{Dynare} cannot simply be extended to encompass HA macroeconomic models. This is evidenced by the fact that despite its ubiquity, familiarity, and long history, no one has attempted to extend the package in this way. Instead, an entirely new system is needed, albeit one inspired by the scope and ongoing extension of \texttt{Dynare}. + +Over the past decade, Pablo Winant has developed\footnote{Pablo is the sole primary developer for \texttt{dolo}, while \texttt{Dynare}'s development is governed by a wider group of programmers and economists, after being originated by Michel Juillard.} the \texttt{dolo} package for the Python programming language, focusing on dynamic stochastic general equilibrium (DSGE) models. Like \texttt{Dynare}, models in \texttt{dolo} are passed as a model file, declaring state variables, exogenous shocks, control variables, etc, then describing the laws of motion and conditions for optimal controls. After verifying that a valid model has been specified, \texttt{dolo} then solves for the optimal policy function automatically and can produce simulated output via its API. More recently, Pablo has extended \texttt{dolo} to the \texttt{dolark} package (now using the Julia programming language), which incorporates important elements of HA models. + +Even as it permits models with non-trivial heterogeneity among agents, the fundamental assumption underlying the structure of \texttt{dolark} is that agents have an \textit{infinite horizon} when evaluating future possibilities. That is, agents take the perspective that they will experience an infinite sequence of discrete periods, each of which is structurally identical \textit{but for} the particular circumstances they find themselves in (both idiosyncratically and with respect to aggregate variables) and the realizations of random shocks that period. This modeling approach is sometimes referred to as ``perpetual youth'', as there is no concept of age or a life-cycle, and is typical in macroeconomic modeling due to its convenient properties and close relationship to RA models. In contrast, our proposed framework goes far beyond infinite horizon models (while still incorporating them) to include decision problems over a finite life-cycle, including those in which the \textit{basic structure} of the problem can change across periods. Moreover, it includes concepts of discrete choice and non-deterministic ``flow control'', as well as a format for representing the formation of agents' beliefs about endogenous processes. + +Even more recently, a team of economists has released the \texttt{sequence-jacobian} package for Python, which provides a toolkit for HA macro models using their recently published work on the sequence space Jacobian method (``SSJ'', as the toolkit is usually called).\footnote{This toolkit is maintained and developed by Bence Bard\'{o}czy, Michael Cai, and Matthew Rognlie; Bard\'{o}czy and Rognlie are two of the four coauthors on the new paper.} A critical complication of HA macro models is that the \textit{state} of the economy at a point in time is an infinite-dimensional object representing the entire distribution of idiosyncratic states of individual agents. That is, future aggregate values depend on the cumulative choices of all individual agents, and the decisions of those agents depend on both their expectation of future aggregate values and their idiosyncratic circumstances; hence a \textit{fully rational} agent needs to know the entire distribution of his fellows' states in order to make a perfectly informed decision. Because this is a clearly infeasible task, economists have focused methods for simplifying the model, usually by (greatly) reducing the dimensionality of the aggregate state (``approximate aggregation''), or by approximating the solution to individuals' microeconomic model with (greatly) reduced dimensionality. In contrast, the SSJ method expresses equilibrium conditions in terms of the \textit{sequence space} of perfect-foresight outcome sequences, rather than in terms of the macroeconomic \textit{state}. Per the authors, this approach allows them to preserve the complexity of microeconomic behavior while quickly and accurately computing the macroeconomic outcomes from perturbations around the steady state (``impulse responses''). + +The SSJ toolkit provides a framework for representing HA macro models and characterizing the equilibrium conditions as a directed acyclic graph (DAG), specifying model components in ``blocks'' that flow into each other in a sequence of information. In a canonical HA macro model, one block would be the behavior of individual agents (e.g.\ households choosing how much to consume vs retain in savings) within the period and another block would be the market-level behavior (e.g.\ aggregation of individual savings into aggregate capital and determination of factor prices). With sufficient information provided for characterizing the steady state of the model (both in aggregate and individually optimizing policies), the SSJ toolkit automatically (and quickly) computes objects that characterize general equilibrium behavior of the model. These objects in turn can be used to analyze the model's response to any (reasonably small) perturbation around the steady state. + +The SSJ method and accompanying toolkit is undoubtedly a massive advance for the field of HA macroeconomics. Both the perspective shift from the \textit{state space} to the \textit{sequence space} and the restructuring of HA models as a DAG are significant conceptual steps, and the provision of software that implements the method will accelerate the development and analysis of HA macro models. However, it is not without its limitations. While the SSJ method can quickly produce \textit{aggregate variable} time series impulse responses to various perturbations, it does not actually produce simulated \textit{microeconomic} data in doing so; the main thrust of the method is to \textit{avoid} doing so. As the authors write in their paper (emphasis added), ``Given these [sequence-space] Jacobians, the \textit{underlying heterogeneity no longer matters}: the Jacobians tell us everything that we need to know, to first order, \textit{about the aggregate behavior} of the model’s heterogeneous agents.'' General equilibrium behavior derived from the SSJ method thus cannot inform any analysis of microeconomic (e.g.\ redistributional) consequences of macroeconomic changes. Moreover, while the toolkit automates much of the computation of the steady state and general equilibrium behavior, it does not automatically solve the \textit{microeconomic} problem faced by individual agents (nor does any other extant package, of course).\footnote{As the developers note in one of their tutorial \texttt{jupyter} notebooks for the package, ``Backward iteration [of the microeconomic problem] is model specific, and requires careful consideration. [...] As such, we ask users only to provide a recipe for backward iteration[, s]o the main task is to write a \textbf{backward step function} that represents the Bellman equation.''} Like \texttt{dolo} and \texttt{dolark} before it, the SSJ method and toolkit focuses exclusively on infinite horizon microeconomic models, largely forgoing life-cycle considerations (as is typical in most of macroeconomics). + +Our proposed modeling framework will build on and advance the structural philosophies of \texttt{dynare}, \texttt{dolark}, and the SSJ toolkit. Rather than ignore life-cycle models and fundamentally assume an infinite horizon model, our framework is designed to handle life-cycle problems (typical in the structural microeconomics literature) \textit{and} infinite horizon models by explicitly specifying the recursive nature. Inspired by the formalization of a model as a DAG in the SSJ toolkit, models in our propose framework are also specified in ``blocks'' whose inputs and outputs flow into each other, but more permissive with respect to the structure of the graph. In our vision, extant toolkits for economic modeling can be linked to our software package and used when the specified model (and desired analysis) is appropriate for that package's capabilities. + +In our extensive field research prior to beginning work on the new platform, we conducted a thorough search of \textit{other} academic fields, investigating whether a general dynamic modeling schema has already been developed. Despite considerable effort, we found that there is no comparable or related project that could be adapted or expanded for our purposes. Rather, we found that the universe of modeling- and optimization-adjacent software is both diverse and diffuse: a collection of useful but \textit{unconnected} software tools. The lack of a common platform for representing dynamic models and calling tools for handling subsets of them is akin to the lack of cohesion among the various artificial intelligence (AI) and deep learning toolkits that have recently developed. That is, researchers who want to use multiple AI tools must write their own code to link to each one individually, rather than there being any kind of common interface. + +In addition to the modeling-oriented software packages, there are general purpose computational packages that are relevant and adjacent to our proposed platform. Most prominently, the \texttt{sympy} package for symbolic mathematics in Python has made great progress in recent years. With \texttt{sympy}, users can execute algebraic operations on symbolic expressions, including various simplifications and substitutions, solving a system of equations, and automatic differentiation and integration. Critically, it also allows the user to easily transform a symbolic representation of a function into an executable Python function, interfacing with several numeric backends for high performance computation.\footnote{Options include \texttt{mpmath}, \texttt{numpy}, \texttt{CuPy}, and \texttt{jax}, as well as Python's native \texttt{math} package.} A key feature of the modeling platform we describe below is that model objects can carry both a (pure) mathematical representation of their content as well as a numeric form (i.e., an approximated digital representation). Hence while \texttt{sympy} provides incredible symbolic math capabilities, our proposed package will \textit{apply} these to create a modeling environment for structural economics. + +\vspace{0.5cm} + +\noindent \textbf{Language Overview:} The core element of our proposed modeling language is a ``stage'', representing a sequence of events for an agent (or actor). An agent's dynamic programming problem is constructed by linking these stages together, potentially recurring on itself. Model stages are meant to compartmentalize information, explicitly specifying the variables that are ``inbound'' to the stage as information (i.e.\ ``state variables'') and objects that can be observed from its successor when solving (e.g.\ the continuation value function). Each stage has a declaration of its parameters, distributions, functions, and algebraic substitutions. The \textit{values} or \textit{details} of these parameters and distributions do are not required when a block is defined, and can instead be left symbolic. + +The dynamic model content of a stage could be as small as one model ``step'', or it could encompass as much as what economists would ordinarily describe as entire period of the model. For example, in the context of a basic consumption-saving model with transitory labor income risk and a riskless return, a stage could be as small as going from beginning-of-period capital holdings $k_t$ to bank balances $b_t$ by multiplying the former by return factor $\mathsf{R}$; or it could be the next step, where labor income $y_t$ is drawn from some distribution and added to $b_t$ to yield market resources $m_t$. Alternatively, a stage could be specified as having \textit{all} of the steps in one period of the consumption-saving problem: earning interest on capital, receiving stochastic labor income, choosing consumption, and retaining non-consumed market resources as assets. + +Suppose a user chose to specify the simple consumption-saving model using (say) four very small stages. Under our proposed modeling language, they could further specify that these stages are sequentially linked together. The resulting linked group of stages would itself then represent a stage (the entire period) that could be further linked. + +The Econ-ARK team has been developing draft specifications of this modeling language, formatted as YAML files. This allows model information to exist alongside parameterization choices, but not inextricably paired together. Instead, the modeling language will include a directive for assigning parameters (or distribution information, etc) from a YAML dictionary entry to a stage, filling in previously unspecified information. As discussed below, our proposed software package would also allow a user to import a stage into their modeling environment without parameter values, and \textit{then} to assign values. + +Our draft language specification includes concepts for flow control among stages, so that (e.g.) an agent's discrete control can govern the \textit{nature} of the next choice they face, or a mortality shock can determine whether they continue to the next period or simply terminate. A group of connected stages thus acts like (and can be represented by) a directional graph among a set of nodes. A graph that loops back on itself is interpreted as an infinite horizon model in which the solution for optimal controls is recursively defined, while a graph that reaches a definite terminal node is a finite lifecycle problem. + +The language will also have syntax for how information interacts among agents, including agent-to-agent transfer and market-level aggregation-- how idiosyncratic actions and states accumulate into macroeconomic outcomes. In our modeling language, such interactions are conducted by an actor that is also constructed from an assemblage of stages, albeit one that has no \textit{agency}-- it makes no choices and has no motivation or preferences. This structure allows for the macroeconomic endogenous objects (e.g.\ equilibrium prices) to be specified in the same way as microeconomic endogenous objects (e.g.\ optimal policy functions). + +\vspace{0.5cm} + +\noindent \textbf{Software Package:} The software package we plan to develop will act as an interpreter of the YAML model statements, interactive model development environment, and platform for applications using the models (e.g. structural estimation). Several features of the model specification language will also be included as programming directives in our software package-- the user can link stages, create a sequence of periods, assign or change parameters, etc. + +Our proposed software package will read in YAML model files and generate representations of model objects using \texttt{sympy}'s various capabilities, which now include objects that are simultaneously both a symbolic representation of a function's mathematical form \textit{and} a numeric approximation of it (e.g.\ a representation of the optimal policy or value function) that can actually be executed. The \texttt{sympy} package now has well developed interfaces with various numeric back-ends (including \texttt{numpy} and \texttt{jax}), so that carrying symbolic representations of the model does not (necessarily) impose grave efficiency costs on computations using them. + +Likewise, \texttt{sympy}'s automatic differentiation and algebraic substitution capabilities have now been sufficiently well developed that an Econ-ARK team member has prototyped code for generating an algebraic representation of the first order and envelope conditions for an intertemporal optimization problem. These representations can be automatically converted into code that numerically solves the choice problem using the endogenous grid method (EGM). Our software package will thus be able to quickly generate (a draft of) solver code from the model input, which could be used as-is or manually refined by the user; it will also allow the user to specify fully custom solver code. + +We have also already prototyped automatic Monte Carlo simulation based on YAML model input, ensuring consistency between intended and actual model behavior. The new version of HARK will support multiple modes of population dynamics, including explicit mortality Monte Carlo, cumulative survival probability weights, and discretizations of continuous state variables (for Markov-style approximations). + + + +\end{document} \ No newline at end of file diff --git a/roadmap/memos/Schmidt/CoverEmailForSchmidt.pdf b/roadmap/memos/Schmidt/CoverEmailForSchmidt.pdf new file mode 100644 index 0000000..ab5a53d Binary files /dev/null and b/roadmap/memos/Schmidt/CoverEmailForSchmidt.pdf differ diff --git a/roadmap/memos/Schmidt/CoverEmailForSchmidt.tex b/roadmap/memos/Schmidt/CoverEmailForSchmidt.tex new file mode 100644 index 0000000..6509b4e --- /dev/null +++ b/roadmap/memos/Schmidt/CoverEmailForSchmidt.tex @@ -0,0 +1,66 @@ + \documentclass[12pt,pdftex,letterpaper]{article} + \usepackage{setspace} + \usepackage[dvips,]{graphicx} %draft option suppresses graphics dvi display +% \usepackage{lscape} +% \usepackage{latexsym} +% \usepackage{endnotes} +% \usepackage{epsfig} + \usepackage{amsmath} +% \singlespace + \setlength{\textwidth}{6.5in} + \setlength{\textheight}{9in} + \addtolength{\topmargin}{-\topmargin} + \setlength{\oddsidemargin}{0in} + \setlength{\evensidemargin}{0in} + \addtolength{\headsep}{-\headsep} + \addtolength{\topskip}{-\topskip} + \addtolength{\headheight}{-\headheight} + \setcounter{secnumdepth}{2} +% \renewcommand{\thesection}{\arabic{section}} + % \renewcommand{\footnote}{\endnote} + \newtheorem{proposition}{Proposition} + \newtheorem{definition}{Definition} + \newtheorem{lemma}{lemma} + \newtheorem{corollary}{Corollary} + \newtheorem{assumption}{Assumption} + \newcommand{\Prob}{\operatorname{Prob}} + \clubpenalty 5000 + \widowpenalty 5000 + \renewcommand{\baselinestretch}{1.1} + \usepackage{amsmath} + \usepackage{amsthm} + \usepackage{amsfonts} + \usepackage{amssymb} + \usepackage{bbm} + \newcommand{\N}{\mathbb{N}} + \newcommand{\R}{\mathbb{R}} + \newcommand{\E}{\mathbb{E}} + \newcommand{\der}[2]{\frac{\text{d}#1}{\text{d}#2}} + \newcommand{\pd}[2]{\frac{\partial#1}{\partial#2}} + + \setlength{\parindent}{0pt} + \setlength{\parskip}{1em} + +\begin{document} + \pagestyle{empty} + +Jim: + +Jim: + +"consumption Carroll" here! + +Our previous email chain was the result of your contacting me to see if we needed funding for the [Econ-ARK](https://econ-ark.org) project. At that time, we'd recently received a generous grant from the Sloan Foundation-- I think my response was along the lines of "we need people, not money!'' Since then, we have found (some of) the right people and have made great progress. + +Having completed most of what we originally envisioned, we now have ambitious ideas for our next steps. (I'm attaching a brief letter of interest describing our proposed work, and its virtues.) In short, Econ-ARK wants to create a modeling framework (like, a much more powerful version of DYNARE) that encompasses the wide array of features that can be included in either micro or macro dynamic structural models -- basically, we want to create a way to represent any Bellman problem. The idea is to design a specification (that is both human- and machine-readable) for describing the mathematical content of models, as well as the numeric methods used to solve them. + +I'm reaching out now because, if you're amenable, this is the right time to get help from Schmidt Futures, both with respect to funding and personnel. You mentioned that the organization has several Googlers emeriti, and their technical expertise could be tremendously valuable to us. + +It would be great if we could set up a meeting with you to discuss all this (or, someone else if that would be more appropriate). + +Thank you very much, and I hope you are well. + +~~~~~---CDC + + +\end{document} \ No newline at end of file diff --git a/roadmap/memos/Sloan/2024-Small-Grant/EconARKpointsForLoS-email.md b/roadmap/memos/Sloan/2024-Small-Grant/EconARKpointsForLoS-email.md new file mode 100644 index 0000000..0e8f447 --- /dev/null +++ b/roadmap/memos/Sloan/2024-Small-Grant/EconARKpointsForLoS-email.md @@ -0,0 +1,21 @@ +Dear John: + +The next phase of the Econ-ARK project aims to develop something like the DYNARE `mod file` syntax, but capable of representing ANY Markov decision problem (including, but not limited to, any Bellman problem). The chief purpose of this email is to ask if you would be willing to help advise us as we pursue this goal. + +You can find an overview of what we have done and what we intend to do at our [this link](). + +The role we hope you can play is described in + + + +I'm using the word `representing` because the idea is NOT to tie the model representation to any specific solution method or toolkit. Instead, it is to provide a complete specification of the problem, which could be ingested by ANY compatible solution engine, which could then go to work solving the problem. + +We plan to use the tools we have already developed in the HARK toolkit to provide an example solution engine capable of solving the particular models we know our tools can solve. We also aim to provide examples of how to use existing tools, like Michael Reiter's toolkit and Robert Kirkby's VFI toolkit and Pablo Winant's Dolo, as the solution engine for models that they are capable of handling. + +Developing a model-description standard like this will require iterative feedback from economists with experience and knowledge about the theoretical foundations, scope, and breadth of dynamic modeling. We would like you to participate in this process as part of a working group, periodically providing constructive criticism on draft versions of the language specification. For example, feedback on whether it can encompass the range of models you have studied (or have considered) in your own projects. + +We have already developed a very primitive sketch of such a standard, which builds on Winant's Dolo framework. The next step (assuming we continue to have funding) is to convene an in-person meeting for the working group to help guide us in further development of the standard. + +We are applying for a grant from the Sloan Foundation to pursue this project. Sloan's guidelines say: "If the success of the project depends on the support of key figures or institutions other than the project lead or project team, the proposal must include an appendix with a letter from each, articulating the nature of their relationship to the project and their understanding of the role they expect to play in the project’s success." + +If you are willing to help, your letter can be addressed to Daniel L. Goroff, Economics Program Director, Alfred P. Sloan Foundation. I have attached a memo that summarizes Econ-ARK's work so far, and provides some additional details about our current direction and this project. diff --git a/roadmap/memos/Sloan/2024-Small-Grant/EconARKpointsForLoS.md b/roadmap/memos/Sloan/2024-Small-Grant/EconARKpointsForLoS.md new file mode 100644 index 0000000..7973632 --- /dev/null +++ b/roadmap/memos/Sloan/2024-Small-Grant/EconARKpointsForLoS.md @@ -0,0 +1,195 @@ +# Working Group on Model Development + +To implement the goals in the [roadmap](https://) + + +**Overview:** [Econ-ARK](https://econ-ark.org/) is developing a +[*modeling language*](https://ampl.com/wp-content/uploads/amlopt.pdf) +for representing dynamic structural models. This memo summarizes what +we've done so far and what we aim to do next. + +**What Econ-ARK Has Done:** Our progress since founding in 2016 is +summarized here. Our primary software output is +[HARK](https://github.com/econ-ark/HARK), a Python package for solving +and simulating heterogeneous agents (HA) macroeconomic models. + +- HARK is a framework for HA models that makes it easy to add or + change *ex ante* heterogeneity among agents, in both infinite + horizon and lifecycle frameworks. + +- You can install it from the command line (`pip install econ-ark`) or + see a gentle introduction + [here](https://econ-ark.org/materials/gentle-intro-to-hark/). + +- Includes [representations of + variations](https://docs.econ-ark.org/Documentation/reference/index.html) + on the canonical consumption-saving problem, including: shocks to + marginal utility of consumption, a second consumption good with + random marginal utility, aggregate productivity shocks, an exogenous + discrete state, endogenous labor supply, portfolio allocation, + non-normalizable income processes, etc. + +- Also has a + [framework](https://docs.econ-ark.org/Documentation/reference/tools/core.html#HARK.core.Market) + for representing (and solving for) aggregative equilibrium, using a + generalized Krusell-Smith-style algorithm. + +- Can be used for structural micro as well, e.g. [endogenous pricing + of health insurance](http://www.mnwhite.org/DynInsSelPaper.pdf). + +- Has + [tools](https://github.com/econ-ark/HARK/blob/master/HARK/dcegm.py) + for discrete-continuous choice models, with an [example + implementation](https://econ-ark.org/materials/endogenousretirement/). + +- Recently begun + [integrating](https://docs.econ-ark.org/examples/ConsNewKeynesianModel/SSJ_example.html) + with the [SSJ + toolkit](https://github.com/shade-econ/sequence-jacobian) to enable + analysis of (e.g.) HANK models in HARK. + +- Models are [*documented* to + explain](https://docs.econ-ark.org/Documentation/reference/ConsumptionSaving/ConsRiskyAssetModel.html#HARK.ConsumptionSaving.ConsRiskyAssetModel.IndShockRiskyAssetConsumerType) + what they mean/do, but these equations (etc) are not *encoded* in + HARK itself. *That's what we're going to change with this grant.* + +Econ-ARK has also designed the +[REMARK](https://github.com/econ-ark/REMARK) structure for archiving +research projects and reproductions of other papers that use HARK. *This +grant application is not about REMARKs.* You might be interested in the +reproductions of Jeppe Druedahl's +[guide](https://econ-ark.org/materials/durableconsumertype/) to +non-convex consumption-saving models, the [deep learning +method](https://econ-ark.org/materials/deep-learning-euler-method-krusell-smith/) +from Maliar, Maliar, & Winant (2018), and Alan Lujan's $\text{EGM}^n$ +[method notebook](https://econ-ark.org/materials/sequentialegm/). + +**What We're Trying to Address:** In broad terms, our organizational +focus is on reproducibility and robustness in economic research. We +don't think there's a "replicability crisis" *per se* (at least, not +yet), but we want to address the following significant issues related to +replicability: + +- Exact model specifications, and especially computational and numeric + details of the solution and/or estimation method, are not well + communicated in published research. + +- Dependency of economic conclusions on obscure arbitrary choices + (e.g., approximation gridpoints) + +- Implementation details might be in online appendix, or only in the + code itself. + +- Impact of these details on conclusions is not really probed in the + refereeing process. + +- Reproducing or replicating someone else's project often "starts from + zero". + +- There is no easy way to directly compare two implementations of the + same project or idea, and even verifying that two things are + tackling "the same" problem is difficult. + +**What We're Going to Do:** Econ-ARK's proposed solution is a new scheme +for unambiguously specifying both the precise mathematical structure of +a model *and* the methods and approximations used to numerically solve +the model and generate output from it. + +- A lot like [DYNARE](https://www.dynare.org/) for a (much) wider + class of models: feature set broad enough to be used for HA macro, + dynamic structural microeconomics, industrial organization, etc. + +- DYNARE model file contents are strictly informed by DYNARE solution + capabilities: can only specify model features that the package is + capable of handling. + +- New modeling language *not* tied to any particular software. Meant + to be common/shared way to precisely represent models *across* + solution methods or software packages. + +- Large feature set informed by *iterative feedback from working group + of experts* in the field. If language can't describe a feature they + want, then it needs to expand. + +- Will *organize a workshop to present preliminary version* of the + language to a working group and solicit feedback. Funding for this + event is requested in the grant. + +- HARK doesn't formally represent models internally. Will develop + model specification for HARK to inform language design. *This will + not restrict the modeling language*. + +- Language will have explicit separation of representation of the + "pure mathematical" or "Platonic ideal" model vs computational + implementation. + +- This grant application is to make HARK "language compatible" as + groundwork, establish working group, begin developing modeling + language, and hold workshop. + +- *Completing* development of the language exceeds scope of this + grant. We have ambitious future plans for what can be done with the + modeling language. + +**What We Want to Accomplish:** There are several potential upsides that +we hope to achieve with this project, some of which we have explicitly +discussed with you. Your letter need not advocate for the proposal, but +feel free to use any of these points if you want. + +- Economics is not immune to "failure to replicate," and the reasons + can be subtle. There are well-known examples papers in top journals + whose results were reversed by due to issues with numeric methods. + +- Frontier models have features that make solution not "well behaved" + (e.g. discrete-continuous choice). "Most interesting" papers might + be most susceptible to hard-to-detect numeric complications. + +- Even without any new software, a common format for representing + choices about numeric integrals, discretized state spaces, etc is a + big step in the right direction. + +- Greatly reduces burden on reader / evaluator to understand what was + *actually done*-- the *first prerequisite* to independently + reproducing the work. + +- Some top journals use a ["data + editor"](https://www.econometricsociety.org/publications/es-data-editor-website) + who tries to reproduce results in accepted papers, using the + authors' own files. Reproduces paper results; does *not* address + robustness. + +- "Robustness checks" in refereeing focus on model specification, not + numeric details. + +- Systematic representation / documentation of computational methods + (etc) could make it feasible to *actually* investigate whether and + how "hidden choices" affect conclusions. + +- There is no "standard software" in structural modeling, nor standard + *anything*. Other than well known numeric packages (`numpy`, + `lapack`), researchers hand code everything. + +- Some economists publish toolkits for solving particular types of + models or handling a specific method, but there's no commonality + among them or way to link them. + +- Some software tools are "inherited" from adviser or coauthors; need + to be an "insider". + +- Some overlap among toolkit capabilities. How does their output + compare when given *exact same* problem? Currently no easy way to + specify "exact same". + +- Includes AI / deep learning platforms not specifically designed for + economics. + +- Common platform for interacting with multiple toolkits would + accelerate research. + +- Economists are independent and opinionated. The kinds of economists + who will be invited to the workshop have strong opinions about the + topic and want to be included. + +- Dynamic models are diverse, many with some "unusual" feature. It + would not be reasonable for a small team to "get everything" + *without significant outside feedback*. diff --git a/roadmap/memos/Sloan/2024-Small-Grant/EconARKpointsForLoS.tex b/roadmap/memos/Sloan/2024-Small-Grant/EconARKpointsForLoS.tex new file mode 100644 index 0000000..e3989c6 --- /dev/null +++ b/roadmap/memos/Sloan/2024-Small-Grant/EconARKpointsForLoS.tex @@ -0,0 +1,196 @@ + + \documentclass[12pt,pdftex,letterpaper]{article} + \usepackage{setspace} + \usepackage[dvips,]{graphicx} %draft option suppresses graphics dvi display +% \usepackage{lscape} +% \usepackage{latexsym} +% \usepackage{endnotes} +% \usepackage{epsfig} + \usepackage[colorlinks=false, urlbordercolor={0 1 0}]{hyperref} +% \singlespace + \setlength{\textwidth}{6.5in} + \setlength{\textheight}{9in} + \addtolength{\topmargin}{-\topmargin} + \setlength{\oddsidemargin}{0in} + \setlength{\evensidemargin}{0in} + \addtolength{\headsep}{-\headsep} + \addtolength{\topskip}{-\topskip} + \addtolength{\headheight}{-\headheight} + \setcounter{secnumdepth}{2} +% \renewcommand{\thesection}{\arabic{section}} + % \renewcommand{\footnote}{\endnote} + \newtheorem{proposition}{Proposition} + \newtheorem{definition}{Definition} + \newtheorem{lemma}{lemma} + \newtheorem{corollary}{Corollary} + \newtheorem{assumption}{Assumption} + \newcommand{\Prob}{\operatorname{Prob}} + \clubpenalty 5000 + \widowpenalty 5000 + \usepackage{amsmath} + \usepackage{amsthm} + \usepackage{amsfonts} + \usepackage{amssymb} + \usepackage{bbm} + \newcommand{\N}{\mathbb{N}} + \newcommand{\R}{\mathbb{R}} + \newcommand{\E}{\mathbb{E}} + \newcommand{\der}[2]{\frac{\text{d}#1}{\text{d}#2}} + \newcommand{\pd}[2]{\frac{\partial#1}{\partial#2}} + +\begin{document} +\begin{center} + \textbf{Memo on Econ-ARK's Plans for a Modeling Language --- September 21, 2024} +\end{center} + +\noindent \textbf{Overview:} \href{https://econ-ark.org/}{Econ-ARK} is developing a \href{https://ampl.com/wp-content/uploads/amlopt.pdf}{\textit{modeling language}} for representing dynamic structural models. This memo summarizes what we've done so far and what we aim to do next. + +\vspace{0.35cm} + +\noindent \textbf{What Econ-ARK Has Done:} Our progress since founding in 2016 is summarized here. Our primary software output is \href{https://github.com/econ-ark/HARK}{HARK}, a Python package for solving and simulating heterogeneous agents (HA) macroeconomic models. + +\begin{itemize} + \item HARK is a framework for HA models that makes it easy to add or change \textit{ex ante} heterogeneity among agents, in both infinite horizon and lifecycle frameworks. + + \item You can install it from the command line (\texttt{pip install econ-ark}) or see a gentle introduction \href{https://econ-ark.org/materials/gentle-intro-to-hark/}{here}. + + \item Includes \href{https://docs.econ-ark.org/Documentation/reference/index.html}{representations of variations} on the canonical consumption-saving problem, including: shocks to marginal utility of consumption, a second consumption good with random marginal utility, aggregate productivity shocks, an exogenous discrete state, endogenous labor supply, portfolio allocation, non-normalizable income processes, etc. + + \item Also has a \href{https://docs.econ-ark.org/Documentation/reference/tools/core.html#HARK.core.Market}{framework} for representing (and solving for) aggregative equilibrium, using a generalized Krusell-Smith-style algorithm. + + \item Can be used for structural micro as well, e.g.\ \href{http://www.mnwhite.org/DynInsSelPaper.pdf}{endogenous pricing of health insurance}. + + \item Has \href{https://github.com/econ-ark/HARK/blob/master/HARK/dcegm.py}{tools} for discrete-continuous choice models, with an \href{https://econ-ark.org/materials/endogenousretirement/}{example implementation}. + + \item Recently begun \href{https://docs.econ-ark.org/examples/ConsNewKeynesianModel/SSJ_example.html}{integrating} with the \href{https://github.com/shade-econ/sequence-jacobian}{SSJ toolkit} to enable analysis of (e.g.)\ HANK models in HARK. + + \item Models are \href{https://docs.econ-ark.org/Documentation/reference/ConsumptionSaving/ConsRiskyAssetModel.html#HARK.ConsumptionSaving.ConsRiskyAssetModel.IndShockRiskyAssetConsumerType}{\textit{documented} to explain} what they mean/do, but these equations (etc) are not \textit{encoded} in HARK itself. \emph{That's what we're going to change with this grant.} +\end{itemize} + +\noindent Econ-ARK has also designed the \href{https://github.com/econ-ark/REMARK}{REMARK} structure for archiving research projects and reproductions of other papers that use HARK. \emph{This grant application is not about REMARKs.} You might be interested in the reproductions of Jeppe Druedahl's \href{https://econ-ark.org/materials/durableconsumertype/}{guide} to non-convex consumption-saving models, the \href{https://econ-ark.org/materials/deep-learning-euler-method-krusell-smith/}{deep learning method} from Maliar, Maliar, \& Winant (2018), and Alan Lujan's $\text{EGM}^n$ \href{https://econ-ark.org/materials/sequentialegm/}{method notebook}. + +\vspace{0.5cm} + +\noindent \textbf{What We're Trying to Address:} In broad terms, our organizational focus is on reproducibility and robustness in economic research. We don't think there's a ``replicability crisis'' \textit{per se} (at least, not yet), but we want to address the following significant issues related to replicability: + +\begin{itemize} + \item Exact model specifications, and especially computational and numeric details of the solution and/or estimation method, are not well communicated in published research. + + \item Dependency of economic conclusions on obscure arbitrary choices (e.g., approximation gridpoints) + + \item Implementation details might be in online appendix, or only in the code itself. + + \item Impact of these details on conclusions is not really probed in the refereeing process. + + \item Reproducing or replicating someone else's project often ``starts from zero''. + + \item There is no easy way to directly compare two implementations of the same project or idea, and even verifying that two things are tackling ``the same'' problem is difficult. +\end{itemize} + +\vspace{0.25cm} + +\noindent \textbf{What We're Going to Do:} Econ-ARK's proposed solution is a new scheme for unambiguously specifying both the precise mathematical structure of a model \textit{and} the methods and approximations used to numerically solve the model and generate output from it. + +\begin{itemize} + \item A lot like \href{https://www.dynare.org/}{DYNARE} for a (much) wider class of models: feature set broad enough to be used for HA macro, dynamic structural microeconomics, industrial organization, etc. + + \item DYNARE model file contents are strictly informed by DYNARE solution capabilities: can only specify model features that the package is capable of handling. + + \item New modeling language \textit{not} tied to any particular software. Meant to be common/shared way to precisely represent models \textit{across} solution methods or software packages. + + \item Large feature set informed by \emph{iterative feedback from working group of experts} in the field. If language can't describe a feature they want, then it needs to expand. + + \item Will \emph{organize a workshop to present preliminary version} of the language to a working group and solicit feedback. Funding for this event is requested in the grant. + + \item HARK doesn't formally represent models internally. Will develop model specification for HARK to inform language design. \emph{This will not restrict the modeling language}. + + \item Language will have explicit separation of representation of the ``pure mathematical'' or ``Platonic ideal'' model vs computational implementation.%: discretization choices, quadrature methods, functional representation, simulation procedures, etc. + + \item This grant application is to make HARK ``language compatible'' as groundwork, establish working group, begin developing modeling language, and hold workshop. + + \item \emph{Completing} development of the language exceeds scope of this grant. We have ambitious future plans for what can be done with the modeling language. + + %\item Future goal: Provide mappings to parse model specification in new language into formats used by various software packages (conditional on limitations on capabilities): DYNARE, Robert Kirkby's \href{https://www.vfitoolkit.com/}{VFI toolkit}, future version of HARK, etc. + + %\item Future goal: Make it feasible to compare solutions produced by different methods or packages, with a proper ``single source of truth'' to ensure apples-to-apples comparison. + + %\item Future goal: Connect model output to \href{https://cadcad.org/}{\texttt{cadCAD} package} from \href{https://block.science/}{BlockScience} to automate robustness testing for conclusions with respect to numeric/computational choices. + +\end{itemize} + +\newpage + +\vspace{0.25cm} + +\noindent \textbf{What We Want to Accomplish:} There are several potential upsides that we hope to achieve with this project, some of which we have explicitly discussed with you. Your letter need not advocate for the proposal, but feel free to use any of these points if you want. +\begin{itemize} + \item Economics is not immune to ``failure to replicate,'' and the reasons can be subtle. There are well-known examples papers in top journals whose results were reversed by due to issues with numeric methods. + + \item Frontier models have features that make solution not ``well behaved'' (e.g.\ discrete-continuous choice). ``Most interesting'' papers might be most susceptible to hard-to-detect numeric complications. + + \item Even without any new software, a common format for representing choices about numeric integrals, discretized state spaces, etc is a big step in the right direction. + + \item Greatly reduces burden on reader / evaluator to understand what was \textit{actually done}-- the \textit{first prerequisite} to independently reproducing the work. + + \item Some top journals use a \href{https://www.econometricsociety.org/publications/es-data-editor-website}{``data editor''} who tries to reproduce results in accepted papers, using the authors' own files. Reproduces paper results; does \textit{not} address robustness. + + \item ``Robustness checks'' in refereeing focus on model specification, not numeric details. + + \item Systematic representation / documentation of computational methods (etc) could make it feasible to \textit{actually} investigate whether and how ``hidden choices'' affect conclusions. + + \item There is no ``standard software'' in structural modeling, nor standard \textit{anything}. Other than well known numeric packages (\texttt{numpy}, \texttt{lapack}), researchers hand code everything. + + \item Some economists publish toolkits for solving particular types of models or handling a specific method, but there's no commonality among them or way to link them. + + \item Some software tools are ``inherited'' from adviser or coauthors; need to be an ``insider''. + + \item Some overlap among toolkit capabilities. How does their output compare when given \textit{exact same} problem? Currently no easy way to specify ``exact same''. + + \item Includes AI / deep learning platforms not specifically designed for economics. + + \item Common platform for interacting with multiple toolkits would accelerate research. + + \item Economists are independent and opinionated. The kinds of economists who will be invited to the workshop have strong opinions about the topic and want to be included. + + \item Dynamic models are diverse, many with some ``unusual'' feature. It would not be reasonable for a small team to ``get everything'' \textit{without significant outside feedback}. +\end{itemize} + +\end{document} + + + + + +That is, a format for precisely and unambiguously specifying the mechanics of methods of a model in a human- and machine-readable format-- not the traditional algebraic representation. Its primary goal is to promote transparency, reproducibility, and robustness in heterogeneous agents macroeconomic and structural microeconomic research. The language is meant to be a common denominator \textit{across} software packages, rather than bound to one in particular. As a tangible first step, we are expanding our HARK package to be compatible with such a modeling language (without tying down the language itself). + +\begin{itemize} + \item See REMARK notebooks \href{https://econ-ark.org/materials/}{here} by searching for the REMARK tag. + + \item REMARKs are governed with a \href{https://github.com/econ-ark/REMARK/blob/master/STANDARD.md}{simple structural standard} and now have a \href{https://github.com/econ-ark/REMARK?tab=readme-ov-file#action}{uniform command line interface} for setup and testing. + + \item You might be interested in the reproductions of Jeppe Druedahl's \href{https://econ-ark.org/materials/durableconsumertype/}{guide} to non-convex consumption-saving models, the \href{https://econ-ark.org/materials/deep-learning-euler-method-krusell-smith/}{deep learning method} from Maliar, Maliar, \& Winant (2018), and Alan Lujan's $\text{EGM}^n$ \href{https://econ-ark.org/materials/sequentialegm/}{method notebook}. +\end{itemize} + +\noindent \textbf{Where You Come In:} Successfully developing the language will require iterative feedback from economists with experience and knowledge about the theoretical foundations, scope, and breadth of dynamic modeling. We would like you to participate in this process as part of an advisory board or working group, periodically providing constructive criticism on draft versions of the language specification. For example, feedback on whether it can suitably capture \textit{your} models and encompass the range of features \textit{you} include (or have considered) in your own projects. + +As per Sloan's grant proposal guidelines, our project proposal must include an appendix with a letter from each key figure supporting the project. The letter must articulate the nature of their relationship to the project and their understanding of the role they expect to play in the project's success. (Suggestions for what your letter could say are listed below.) + + +\vspace{0.25cm} + +\noindent \textbf{What Your Letter Should Say:}\label{WhatToSay} Letters of support should be 1-2 pages long, and primarily address the writer's \emph{understanding of the role they expect to play} in the project's success. + +\begin{itemize} +\item Your ongoing role would be to provide occasional feedback on developmental versions of the modeling language, as a member of our advisory board/working group. Such feedback would be via a Zoom meeting, perhaps once every 2-3 months. + + \begin{itemize} + \item Depending on your interest and availability, we may follow up after such meetings to pursue particular ideas or questions raised during the meetings. + \end{itemize} + + \item Iterative process: We aim to make a specification that includes a sufficiently wide range of features to encompass the set of models of interest; you tell us what we missed. + + \item You will also be invited to an in-person workshop for live discussion and interaction about the language. Participants will be leaders in dynamic modeling and methods, and/or those who have developed toolkits for working with subsets of such models. While we hope you will be able to attend in person, if necessary participation can be remote. + + \item Your letter can be addressed to Daniel L. Goroff, Economics Program Director, Alfred P.\ Sloan Foundation. + +\end{itemize} diff --git a/roadmap/memos/Sloan/2024-Small-Grant/TwoPageLOIforEcon-ARK.pdf b/roadmap/memos/Sloan/2024-Small-Grant/TwoPageLOIforEcon-ARK.pdf new file mode 100644 index 0000000..f80ca33 Binary files /dev/null and b/roadmap/memos/Sloan/2024-Small-Grant/TwoPageLOIforEcon-ARK.pdf differ diff --git a/roadmap/memos/Sloan/2024-Small-Grant/TwoPageLOIforEcon-ARK.tex b/roadmap/memos/Sloan/2024-Small-Grant/TwoPageLOIforEcon-ARK.tex new file mode 100644 index 0000000..7000129 --- /dev/null +++ b/roadmap/memos/Sloan/2024-Small-Grant/TwoPageLOIforEcon-ARK.tex @@ -0,0 +1,87 @@ + + \documentclass[11pt,pdftex,letterpaper]{article} + \usepackage{setspace} + \usepackage[dvips,]{graphicx} %draft option suppresses graphics dvi display +% \usepackage{lscape} +% \usepackage{latexsym} +% \usepackage{endnotes} +% \usepackage{epsfig} +% \singlespace + \setlength{\textwidth}{6.5in} + \setlength{\textheight}{9in} + \addtolength{\topmargin}{-\topmargin} + \setlength{\oddsidemargin}{0in} + \setlength{\evensidemargin}{0in} + \addtolength{\headsep}{-\headsep} + \addtolength{\topskip}{-\topskip} + \addtolength{\headheight}{-\headheight} + \setcounter{secnumdepth}{2} +% \renewcommand{\thesection}{\arabic{section}} + % \renewcommand{\footnote}{\endnote} + \newtheorem{proposition}{Proposition} + \newtheorem{definition}{Definition} + \newtheorem{lemma}{lemma} + \newtheorem{corollary}{Corollary} + \newtheorem{assumption}{Assumption} + \newcommand{\Prob}{\operatorname{Prob}} + \clubpenalty 5000 + \widowpenalty 5000 + \renewcommand{\baselinestretch}{1.1} + \usepackage{amsmath} + \usepackage{amsthm} + \usepackage{amsfonts} + \usepackage{amssymb} + \usepackage{bbm} + \usepackage{hyperref} + \newcommand{\N}{\mathbb{N}} + \newcommand{\R}{\mathbb{R}} + \newcommand{\E}{\mathbb{E}} + \newcommand{\der}[2]{\frac{\text{d}#1}{\text{d}#2}} + \newcommand{\pd}[2]{\frac{\partial#1}{\partial#2}} + \setlength{\parindent}{0pt} + \setlength{\parskip}{0.9em} + +\begin{document} + +\begin{singlespace} + Prof Christopher D.\ Carroll \\ + Wyman Park Building 590 \\ + Johns Hopkins University \\ + Baltimore, MD 21211 + + \vspace{0.2cm} + + February X, 2024 + +\end{singlespace} + +\vspace{0.3cm} + +[Human]: + +In 2017, the newly founded \href{http://www.econ-ark.org}{Econ-ARK} project received a generous grant from the \href{https://sloan.org}{Alfred P.\ Sloan Foundation} to develop the \href{https://github.com/econ-ark/HARK}{HARK toolkit}, a software package for solving, simulating, and estimating heterogeneous agents models in economics (either heterogeneous agent macro or structural micro). With \href{https://numfocus.org/}{NumFocus} as our fiscal sponsor, we have since received additional funding from other sources (including the \href{https://inomics.com/institution/think-forward-initiative-1258337}{Think Forward Initiative} and \href{https://www.troweprice.com/en}{T.\ Rowe Price} as a ``no strings attached'' corporate sponsor) to continue the work and expand the range of models offered in the HARK package, allowing us to largely achieve our original set of goals. With this experience underneath our belt, we now see that our next steps involve developing a \textit{language} for expressing dynamic structural models that can specify computational methods, describe simulation procedures, and generate model output. I am writing to you to ask whether [organization] might be interested in funding this endeavor. + +To fix ideas, a structural model would be formalized as a model file: a set of statements characterizing its components, like how a budget constraint might be captured with a simple equation saying that assets are whatever is left of the consumer's money after consumption: \texttt{a=m-c} (of course much more sophisticated mathematical propositions would also be accommodated). The language (or perhaps a better term would be schema) will provide a common format for describing dynamic structural models convey model content in a human- and machine-readable way, but is independent of the code to actually solve and implement the model. As we develop the schema, we would simultaneously develop a software platform to parse the model file into the implied code. + +The \href{https://www.dynare.org/}{Dynare} package provides a prototype example of the \textit{kind} of thing we have in mind, but limitations in its syntax and specification mean that it cannot be used or extended for the kinds of models that are now \textit{de rigeur} in both micro and macro modeling. When explaining our work on HARK, we have found that other economists often interpret it through the lens of Dynare, with the hope that we have already built ``Dynare for heterogeneous agents.'' This has left us no doubt that there is a large demand for exactly such a tool. With our prior experience implementing HARK, and given recent advances in other software tools, we are now prepared to design and create it. + +Prior to beginning work on the new platform, we conducted a thorough search of \textit{other} academic fields, investigating whether a general dynamic modeling schema has already been developed. Having explored all the nooks and crannies of the internet, we are confident that there is no comparable or related project that could be adapted or expanded for our purposes. We found that the universe of modeling- and optimization-adjacent software is both diverse and diffuse: We found many of the building blocks necessary to accomplish our goal, but no schemes for putting the building blocks together into anything like what we need. The lack of a common platform for representing dynamic models is akin to the lack of cohesion among the various artificial intelligence (AI) and deep learning toolkits that have recently been developed. Translated into that context, the AI equivalent would be a language that described the AI problem to be solved in a platform-independent way, allowing a user then to solve exactly the same model with each of the competing AI tools. (The problem is even more ambitious in that context than in ours, but what we accomplish might be a good stepping stone toward a platform-independent AI tool.) + +This work will also significantly improve the transparency and replicability of structural economics research. Behind closed doors, everyone who works on these kinds of models admits (and laments) what they know to be true: Everyone's results depend on a host of ancillary assumptions -- how many gridpoints to use, how many agents to simulate, etc. While it is now expected that researchers will publicly archive their code, for many projects the code might as well be written in Klingon (so far as accessibility and transparency and replicability are concerned). Even worse, there is no direct relationship between the model as expressed \textit{on paper} and the problem as solved \textit{in code}-- the academic refereeing system focuses deeply on the economics of the abstract math, and relies on trust with respect to the numerics. Indeed, there are famous examples of papers that have been published based on their strong economic content, but whose quantitative (and sometimes qualitative) results were later discovered to be based on errant code. + + +Our proposed modeling language aims to rectify these systemic issues with the workflow of economic research. If a model specification file is used to generate a numeric solution and model output, a reader or evaluator can be confident that the model presented on paper matches its execution in code. Furthermore, our language will include a format for specifying the methods used to solve the model numerically, transparently conveying this information alongside the ``pure'' mathematical content of the model. The software platform can thus act as a vehicle for evaluating the performance of a numeric solution to a theoretical model. + +Our proposed platform will accelerate the development of models on the frontier of economic research, allow for the verifiability of numeric output from such models, and improve communication and collaboration among researchers. In addition to academic work, the platform would be of significant use both to governments (including central banks and financial regulators) in conducting prospective analyses of potential policy actions, and to private financial institutions who wish to make decisions or provide advice that is informed by a structural model (e.g.\ a model of optimal retirement savings). In developing the language and the software platform, we will seek out input from a variety stakeholders to ensure that their modeling needs are met. + +Thank you very much for your time and consideration in this matter, and I look forward to further discussion with you. + +\vspace{0.5cm} + +{\parskip=2pt Sincerely, + + \includegraphics[scale=0.7]{CDCsignature.jpg} + +Christopher D.\ Carroll, Professor of Economics, Johns Hopkins University} + +\end{document} diff --git a/roadmap/memos/Sloan/2024-Small-Grant/TwoPageLOIforEcon-ARK_Sloan.pdf b/roadmap/memos/Sloan/2024-Small-Grant/TwoPageLOIforEcon-ARK_Sloan.pdf new file mode 100644 index 0000000..2ef71a2 Binary files /dev/null and b/roadmap/memos/Sloan/2024-Small-Grant/TwoPageLOIforEcon-ARK_Sloan.pdf differ diff --git a/roadmap/memos/Sloan/2024-Small-Grant/TwoPageLOIforEcon-ARK_Sloan.tex b/roadmap/memos/Sloan/2024-Small-Grant/TwoPageLOIforEcon-ARK_Sloan.tex new file mode 100644 index 0000000..91ae94e --- /dev/null +++ b/roadmap/memos/Sloan/2024-Small-Grant/TwoPageLOIforEcon-ARK_Sloan.tex @@ -0,0 +1,110 @@ + + \documentclass[11pt,pdftex,letterpaper]{article} + \usepackage{setspace} + \usepackage[dvips,]{graphicx} %draft option suppresses graphics dvi display +% \usepackage{lscape} +% \usepackage{latexsym} +% \usepackage{endnotes} +% \usepackage{epsfig} +% \singlespace + \setlength{\textwidth}{6.5in} + \setlength{\textheight}{9in} + \addtolength{\topmargin}{-\topmargin} + \setlength{\oddsidemargin}{0in} + \setlength{\evensidemargin}{0in} + \addtolength{\headsep}{-\headsep} + \addtolength{\topskip}{-\topskip} + \addtolength{\headheight}{-\headheight} + \setcounter{secnumdepth}{2} +% \renewcommand{\thesection}{\arabic{section}} + % \renewcommand{\footnote}{\endnote} + \newtheorem{proposition}{Proposition} + \newtheorem{definition}{Definition} + \newtheorem{lemma}{lemma} + \newtheorem{corollary}{Corollary} + \newtheorem{assumption}{Assumption} + \newcommand{\Prob}{\operatorname{Prob}} + \clubpenalty 5000 + \widowpenalty 5000 + \renewcommand{\baselinestretch}{1.1} + \usepackage{amsmath} + \usepackage{amsthm} + \usepackage{amsfonts} + \usepackage{amssymb} + \usepackage{bbm} + \usepackage{hyperref} + \newcommand{\N}{\mathbb{N}} + \newcommand{\R}{\mathbb{R}} + \newcommand{\E}{\mathbb{E}} + \newcommand{\der}[2]{\frac{\text{d}#1}{\text{d}#2}} + \newcommand{\pd}[2]{\frac{\partial#1}{\partial#2}} + \setlength{\parindent}{0pt} + \setlength{\parskip}{0.9em} + +\begin{document} + +\begin{singlespace} + Prof Christopher D.\ Carroll \hfill Danny Goroff\\ + Wyman Park Building 590 \hfill The Alfred P. Sloan Foundation\\ + Johns Hopkins University \hfill %155 W 23rd St + \\ + Baltimore, MD 21211 \hfill %New York, NY 10011 + + \vspace{0.2cm} + + March 9, 2024 + +\end{singlespace} + +\vspace{0.3cm} + +Danny (and other interested parties): + +When the \href{http://www.econ-ark.org}{Econ-ARK} project's \href{generous founding grant}{https://sloan.org/grant-detail/8071} from \href{https://sloan.org}{Sloan} was nearing its end, your emphasis that Sloan's ambition was to fund the startup period of projects that would eventually be self-sustaining was something we took seriously. So seriously, in fact, that we did not apply to Sloan for a renewal of the grant. + +That was by no means a signal that the project had been abandoned. We have since received about \$750K in additional funding from other sources (including the \href{https://inomics.com/institution/think-forward-initiative-1258337}{Think Forward Initiative} and \href{https://www.troweprice.com/en}{T.\ Rowe Price} as a ``no strings attached'' corporate sponsor through NumFocus) to continue that work and expand the range of tools and models offered in the HARK package. We have now largely achieved our original set of goals. + +With this experience beneath our belt, we now see that the next steps involve developing a \textit{language} for expressing dynamic structural models. Such a language would specify computational methods, describe simulation procedures, and generate model output. I am writing to you to ask whether Sloan might be interested in funding this endeavor. + +To fix ideas, a structural model would be formalized as a model file: a set of statements characterizing its components, like how a budget constraint might be captured with a simple equation saying that assets are whatever is left of the consumer's money after consumption: \texttt{a=m-c} (of course much more sophisticated mathematical propositions would also be accommodated). The language (or perhaps a better term would be schema) will provide a common format for describing dynamic structural models and will convey model content in a human- and machine-readable way that is independent of the code to actually solve and implement the model. As we develop the schema, we would simultaneously build a software platform to parse the model file into the implied code (though nothing would prevent someone else from inventing a better software platform in the future). %To that end, we are also developing a software platform that interprets model statements in the new language, generates code for solving and simulating the model (with the chosen numeric methods), and allows the user to interactively build a structural model and examine its solution and output. + +%\href{https://www.dynare.org/}{Dynare} or \href{https://www.econforge.org/dolo}{dolo} user declares the budget constraint with a statement something like \texttt{c+k=k\^{}theta*A}. +%A tool of this kind already exists for classical representative agent macroeconomic models-- the widely adopted + +% , or a \href{https://www.econforge.org/dolo}{dolo} user expresses an intertemporal arbitrage condition as \texttt{1 = beta*(c/c(1))\^{}(sigma)*(1-delta+rk(1))}. + +The \href{https://www.dynare.org/}{Dynare} package provides a prototype example of the \textit{kind} of thing we have in mind, but limitations in its syntax and specification mean that it cannot be used or extended for the kinds of models that are now \textit{de rigeur} in both micro and macro modeling. When explaining our work on HARK, we have found that other economists often interpret it through the lens of Dynare, with the hope that we have already built ``Dynare for heterogeneous agents.'' This has left us no doubt that there is a large demand for exactly such a tool. With our prior experience implementing HARK, and given recent advances in other software tools, we are now prepared to design and create it. + +Prior to beginning work on the new platform, we conducted a thorough search of \textit{other} academic fields, investigating whether a general dynamic modeling schema has already been developed elswhere. Having explored all the nooks and crannies of the internet, we are confident that there is no comparable or related project that could be adapted or expanded for our purposes. We found that the universe of modeling- and optimization-adjacent software is both diverse and diffuse: We found many of the building blocks necessary to accomplish our goal, but no schemes for putting the building blocks together into anything like what we need. The lack of a common platform for representing dynamic models is akin to the lack of cohesion among the various artificial intelligence (AI) and deep learning toolkits that have recently been developed. %Translated into that context, the AI equivalent would be a language that described the AI problem to be solved in a platform-independent way, allowing a user then to solve exactly the same model with each of the competing AI tools. (The problem is even more ambitious in that context than in ours, but what we accomplish might be a good stepping stone toward a platform-independent AI tool.) + +%That is, researchers who want to use multiple AI tools must write their own code to link to each one individually, rather than there being any kind of common interface. Our project thus has potentially large spillovers. + +This work will also significantly improve the transparency and replicability of structural economics research. Behind closed doors, everyone who works on these kinds of models admits (and laments) what they know to be true: Everyone's results depend on a host of ancillary assumptions -- how many gridpoints to use, how many agents to simulate, etc. While it is now expected that researchers will publicly archive their code, for many projects the code might as well be written in Klingon (so far as accessibility and transparency and replicability are concerned). Even worse, there is no direct relationship between the model as expressed \textit{on paper} and the problem as solved \textit{in code}-- the academic refereeing system focuses deeply on the economics of the abstract math, and relies on trust with respect to the numerics. Indeed, there are famous examples of papers that have been published based on their strong economic content, but whose quantitative (and sometimes qualitative) results were later discovered to be wrong as a result of coding errors. + + +%The fact that everyone writes their own code means that it usually infeasible to meaningfully test whether a published paper's results are robust to the authors' arbitrary choices. (There are a few examples where the experiment has been tried and the results have not replicated). + +%Moreover, even if an economist were so inclined, there is no standard for how the computational instantiation of the model should be described. + + + +Our proposed modeling language aims to rectify these systemic issues with the workflow of economic research. If a model specification file is used to generate a numeric solution and model output, a reader or evaluator can be confident that the model presented on paper matches its execution in code. Furthermore, our language will include a format for specifying the methods used to solve the model numerically, transparently conveying this information alongside the ``pure'' mathematical content of the model. The software platform can thus act as a vehicle for evaluating the performance of a numeric solution to a theoretical model. + +Our proposed platform will accelerate the development of models on the frontier of economic research, allow for the verifiability of numeric output from such models, and improve communication and collaboration among researchers. In addition to academic work, the platform would be of significant use both to governments (including central banks and financial regulators) in conducting prospective analyses of potential policy actions, and to private financial institutions who wish to make decisions or provide advice that is informed by a structural model (e.g.\ a model of optimal retirement savings). In developing the language and the software platform, we will seek out input from a variety stakeholders to ensure that their modeling needs are met. + +Our sense is that, among potential funders, Sloan would be the best fit. + +Thanks for your time and consideration in this matter. + +\vspace{0.5cm} + +{\parskip=2pt Sincerely, + + \includegraphics[scale=0.7]{CDCsignature.jpg} + +Christopher D.\ Carroll, Professor of Economics, Johns Hopkins University} + +\end{document} + + +As brief background, economic models are usually expressed with a combination of mathematical and natural language: most of the content can be concisely conveyed as a series of equations, inequalities, and other mathematical statements, while a few additional details are provided in plain English outside of the formal statement. This representation of the theoretical model is intended to be readily understood by a human reader. Unlike basic economic models used for pedagogy, which can be solved algebraically and analyzed intuitively, modern dynamic structural models can be solved only \textit{approximately} using numeric methods. diff --git a/roadmap/memos/dolo/PitchToPablo.pdf b/roadmap/memos/dolo/PitchToPablo.pdf new file mode 100644 index 0000000..83398c6 Binary files /dev/null and b/roadmap/memos/dolo/PitchToPablo.pdf differ diff --git a/roadmap/memos/dolo/PitchToPablo.tex b/roadmap/memos/dolo/PitchToPablo.tex new file mode 100644 index 0000000..a9929d0 --- /dev/null +++ b/roadmap/memos/dolo/PitchToPablo.tex @@ -0,0 +1,152 @@ + + \documentclass[12pt,pdftex,letterpaper]{article} + \usepackage{setspace} + \usepackage[dvips,]{graphicx} %draft option suppresses graphics dvi display +% \usepackage{lscape} +% \usepackage{latexsym} +% \usepackage{endnotes} +% \usepackage{epsfig} + \usepackage{amsmath} +% \singlespace + \setlength{\textwidth}{6.5in} + \setlength{\textheight}{9in} + \addtolength{\topmargin}{-\topmargin} + \setlength{\oddsidemargin}{0in} + \setlength{\evensidemargin}{0in} + \addtolength{\headsep}{-\headsep} + \addtolength{\topskip}{-\topskip} + \addtolength{\headheight}{-\headheight} + \setcounter{secnumdepth}{2} +% \renewcommand{\thesection}{\arabic{section}} + % \renewcommand{\footnote}{\endnote} + \newtheorem{proposition}{Proposition} + \newtheorem{definition}{Definition} + \newtheorem{lemma}{lemma} + \newtheorem{corollary}{Corollary} + \newtheorem{assumption}{Assumption} + \newcommand{\Prob}{\operatorname{Prob}} + \clubpenalty 5000 + \widowpenalty 5000 + \renewcommand{\baselinestretch}{1.35} + \usepackage{amsmath} + \usepackage{amsthm} + \usepackage{amsfonts} + \usepackage{amssymb} + \usepackage{bbm} + \newcommand{\N}{\mathbb{N}} + \newcommand{\R}{\mathbb{R}} + \newcommand{\E}{\mathbb{E}} + \newcommand{\vFunc}{\text{v}} + \newcommand{\der}[2]{\frac{\text{d}#1}{\text{d}#2}} + \newcommand{\pd}[2]{\frac{\partial#1}{\partial#2}} + +\begin{document} + +\begin{center} + \textbf{Memorandum for Meeting with Pablo Winant --- December 15, 2023} +\end{center} + +\noindent \textbf{Purpose:} The Econ-ARK team has been internally discussing the development of the next iteration of \texttt{HARK}, and seeks feedback on our ideas from Pablo. + +\vspace{0.35cm} + +\noindent \textbf{Background:} The current version of \texttt{HARK} does not have a formal relationship among the mathematical model being represented, the operations performed to generate a ``solution'' of the model (policy functions and aggregate dynamics), and the model as acted out in simulation. Each of these components is written out separately for each model, and end users are meant to trust that there is consistency among them. Consequently, modifying an existing \texttt{HARK} model is not straightforward nor easy, as the user must make changes in several places in the code and understand the relationships among various modules. The solution methods in the current version of \texttt{HARK} are specifically tailored for each model, and the package is designed with \textit{ex ante} heterogeneity at front of mind. + +In contrast, the approach taken by Pablo's \texttt{dolo} and \texttt{dolark} projects enforces consistency among the model concept, solution, and simulation by using a ``single source of truth'': a clear specification of the model's dynamics (equations) and characterization of its solution, which is directly used when solving and simulating the model. User-specified models in \texttt{dolo} and \texttt{dolark} are solved automatically by several methods, which has the upside of being easy to use and the downside of potentially less efficient computation from forgoing hand-crafted code. Pablo's projects were designed primarily for macroeconomic modeling. \textit{Ex ante} heterogeneity and life-cycle models are possible to represent in these packages, but were not the primary intended use-case. Models with mixed choices or that change fundamentally over the lifecycle (``phases of life'') are not what \texttt{dolo} and \texttt{dolark} are designed for. + +\vspace{0.35cm} + +\noindent \textbf{Pitch Summary:} The Econ-ARK team wants to develop a next iteration of \texttt{HARK} that incorporates the structural consistency of \texttt{dolark}, while maintaining its focus on models with extensive \textit{ex ante} heterogeneity and life-cycle dynamics. This encompasses two main components: first, a format for precisely specifying dynamic models that can handle a wide variety of features (e.g.\ continuous and discrete choices, lifecycle problems, mortality and population dynamics, etc), like an extended \texttt{dolang}; and second, a software package that imports model specifications and allows the user to interactively construct a model piece by piece. Our intent is for the model specification language to be useful \textit{outside} of our own software package: a clear and consistent way to specify model information that could also be used by \textit{other} economists for their own purposes (e.g.\ another software package). + +\vspace{0.35cm} + +\noindent \textbf{Basic Example Model:} To fix ideas, consider the one period problem of an agent who must choose how much to consume $c_t$ out of their market resources $m_t$ and how much to retain as assets $a_t$. They have CRRA preferences over consumption, can earn a risk free return on retained assets, and discount future utility flows by a constant factor. + +\begin{equation*} +\vFunc_{t}(m_t) = \max_{c_t} \frac{c_t^{1-\rho}}{1-\rho} + \beta \overline{\vFunc}_{t+1}(k_{t+1}) \text{ s.t.} +\end{equation*} +\begin{equation*} + k_{t+1} = a_t = m_t - c_t, \qquad a_t \geq 0, +\end{equation*} +\begin{equation*} +b_t = \mathsf{R} k_t, \qquad m_t = b_t + y_t, \qquad y_t \sim F, +\end{equation*} +\begin{equation*} +\overline{\vFunc}_t(k_t) = \E[\vFunc_t(m_t) ~|~ k_t]. +\end{equation*} + +In this statement, which is intentionally more belabored and elaborate than strictly necessary, $\vFunc_t(m_t)$ is the ordinary Bellman value function over the decision-time state variable (market resources), while $\overline{\vFunc}_{t}(k_t)$ is the value function at the \textit{very beginning} of period $t$, before capital returns or labor income uncertainty are resolved. To notationally separate periods, we emphasize that the same quantity represented by end-of-period-$t$ assets is \textit{also} beginning-of-period-$t+1$ capital holdings. These terms and notation will be used below. + +\vspace{0.35cm} + +\noindent \textbf{Modeling Language:} The core element of our proposed modeling language is a ``stage'', representing a sequence of events for an agent (or actor). An agent's dynamic programming problem is constructed by linking these stages together, potentially recurring on itself. Model stages are meant to compartmentalize information, explicitly specifying the variables that are ``inbound'' to the stage as information (i.e.\ ``state variables'') and objects that can be observed from its successor when solving (e.g.\ the continuation value function). Like in \texttt{dolo}, a stage declares its parameters, distributions, functions, and algebraic substitutions (definitions); unlike \texttt{dolo}, the \textit{values} or \textit{details} of these parameters and distributions do \textit{not} need to be provided, and can instead be left symbolic. + +The dynamic model content of a stage could be as small as one model ``step'', or it could encompass as much as what we would ordinarily describe as entire period of the model. For example, in the context of a basic consumption-saving model with transitory labor income risk and a riskless return, a stage could be as small as going from beginning-of-period capital holdings $k_t$ to bank balances $b_t$ by multiplying the former by return factor $\mathsf{R}$; or it could be the next step, where labor income $y_t$ is drawn from some distribution and added to $b_t$ to yield market resources $m_t$. Alternatively, a stage could be specified as having \textit{all} of the steps in one period of the consumption-saving problem: earning interest on capital, receiving stochastic labor income, choosing consumption, and retaining non-consumed market resources as assets. + +Suppose a user chose to specify the simple consumption-saving model using (say) four very small stages. Under our proposed modeling language, they could further specify that these stages are sequentially linked together. The resulting linked group of stages would itself then represent a stage (the entire period) that could be further linked. + +The Econ-ARK team has been developing draft specifications of this modeling language, formatted as YAML files. This allows model information to exist alongside parameterization choices, but not inextricably paired together. Instead, the modeling language will include a directive for assigning parameters (or distribution information, etc) from a YAML dictionary entry to a stage, filling in previously unspecified information. As discussed below, our proposed software package would also allow a user to import a stage into their modeling environment without parameter values, and \textit{then} to assign values. + +Our draft language specification includes concepts for flow control among stages, so that (e.g.) an agent's discrete control can govern the \textit{nature} of the next choice they face, or a mortality shock can determine whether they continue to the next period or simply terminate. A group of connected stages thus acts like (and can be represented by) a directional graph among a set of nodes. A graph that loops back on itself is interpreted as an infinite horizon model in which the solution for optimal controls is recursively defined, while a graph that reaches a definite terminal node is a finite lifecycle problem. + +The \texttt{dolo}, \texttt{dolark}, and \texttt{dynare} packages are all designed for solving macroeconomic models that include endogenous objects such as factor prices and (approximations of) aggregate dynamics. We intend for our new language to also be able to describe these important features, but our draft proposals have not yet progressed to discussing how to do so. + +\vspace{0.35cm} + +\noindent \textbf{Software Package:} The software package we plan to develop (sometimes internally called ``HARK 2.0'') will act as an interpreter of the YAML model statements, interactive model development environment, and platform for applications using the models (e.g. structural estimation). Several features of the model specification language will also be included as programming directives in our software package-- the user can link stages, create a sequence of periods, assign or change parameters, etc. + +The new version of \texttt{HARK} will read in YAML model files and generate representations of model objects using \texttt{sympy}'s various capabilities, which now include so-called ``pleuripotent'' functions: objects that are simultaneously both a symbolic representation of a function's mathematical form \textit{and} a numeric approximation of it (e.g.\ a representation of the optimal policy or value function) that can actually be executed. The \texttt{sympy} package now has well developed interfaces with various numeric back-ends (including \texttt{numpy} and \texttt{jax}), so that carrying symbolic representations of the model does not (necessarily) impose grave efficiency costs on computations using them. + +Likewise, \texttt{sympy}'s automatic differentiation and algebraic substitution capabilities have now been sufficiently well developed that an Econ-ARK team member has prototyped code for generating an algebraic representation of the first order and envelope conditions for an intertemporal optimization problem. These representations can be automatically converted into code that numerically solves the choice problem using the endogenous grid method (EGM). The new version of \texttt{HARK} will thus be able to quickly generate (a draft of) solver code from the model input, which could be used as-is or manually refined by the user. The new version of \texttt{HARK} will also maintain the ability to specify custom solver code. + +We have also already prototyped automatic Monte Carlo simulation based on YAML model input, ensuring consistency between intended and actual model behavior. The new version of HARK will support multiple modes of population dynamics, including explicit mortality Monte Carlo, cumulative survival probability weights, and discretizations of continuous state variables (for Markov-style approximations). + +\vspace{0.35cm} + +\noindent \textbf{Example Usage:} So as not to distract with specification details that have not yet been implemented (let alone finalized), we present a \textit{hypothetical} example of command-line interaction in the future \texttt{HARK} modeling environment, omitting the YAML files with the model and parameters; some imagination is required. Analogous concepts for most of these operations would also exist in the modeling language, so that more complex (or more completely specified) model objects could be directly imported. + +[Hypothetical code example on next page for easier reading] + +\newpage + +\texttt{> from HARK import read\_yaml, AgentType, Connector, link} + +\texttt{> CS\_model\_components = read\_yaml('BasicCSmodel.yml')} + +\texttt{> CS\_model\_components.stages} + +\texttt{OUT: [basic\_consumption\_saving\_period, risk\_free\_return\_stage, transitory\_income\_stage, consumption\_choice\_stage, discount\_stage]} + +\texttt{> CS\_model\_components['basic\_consumption\_saving\_period'].parameters} + +\texttt{OUT: [Rfree, DiscFac, CRRA]} + +\texttt{> CS\_model\_components['basic\_consumption\_saving\_period'].distributions} + +\texttt{OUT: [TranShkDstn]} + +\texttt{> some\_CS\_parameters = read\_yaml('ExampleCSparams.yml')} + +\texttt{> my\_CS\_period = CS\_model\_components['basic\_consumption\_saving\_period'].copy()} + +\texttt{> my\_CS\_period.parameterize(some\_CS\_parameters)} + +\texttt{> my\_CS\_period.label('perpetual youth basic CS period')} + +\texttt{> time\_loop = Connector(tick=True, twist=\{'aLvl': 'kLvl', 'vFunc\_continuation': 'vFunc\_before\_return'\})} + +\texttt{> InfiniteCSproblem = link(my\_CS\_period, time\_loop, my\_CS\_period)} + +\texttt{> MyConsumerType = AgentType(model=InfiniteCSproblem, count=10000)} + +\texttt{> MyConsumerType.solve(method='EGM')} + +\texttt{> MyConsumerType.solution.policy} + +\texttt{OUT: [cLvl(mLvl) for perpetual youth basic CS period]} + +\texttt{> MyConsumerType.track('aLvl','cLvl')} + +\texttt{> MyConsumerType.simulate(method='montecarlo')} + +\end{document} \ No newline at end of file diff --git a/roadmap/past-and-future.md b/roadmap/past-and-future.md new file mode 100644 index 0000000..24746db --- /dev/null +++ b/roadmap/past-and-future.md @@ -0,0 +1,116 @@ +# Econ-ARK's Plans for a Modeling Language, September 21, 2024 + +## **Overview** +[Econ-ARK](https://econ-ark.org/) is developing a +[*modeling language*](https://ampl.com/wp-content/uploads/amlopt.pdf) +for representing dynamic structural models.[^1] This document summarizes what +we've done so far and what we aim to do next. + +[^1]: "Language" may not be quite the right word; the idea is closer to a specification for a standard to represent models. + +## **What We've Done So Far** +Our primary software output is +[HARK](https://github.com/econ-ark/HARK), a Python package for solving +and simulating heterogeneous agent (HA) models, either for HA-Macro or for structural micro modeling. + +- Installable from the command line (`pip install econ-ark`) + +- Extensive [documentation](https://docs.econ-ark.org) + +- [A Gentle Introduction](https://econ-ark.org/materials/gentle-intro-to-hark/). + +- Includes [variations](https://docs.econ-ark.org/Documentation/reference/index.html) + on the canonical consumption-saving problem, including: + - shocks to marginal utility of consumption, aggregate shocks, an exogenous discrete state, endogenous labor supply, portfolio allocation, and much more + +- [framework](https://docs.econ-ark.org/Documentation/reference/tools/core.html#HARK.core.Market) for representing (and solving for) aggregative equilibrium (either for the macroeconomy or, say, for an industry), using a generalized Krusell-Smith-style algorithm. + +- Can be used for structural micro as well, e.g. [endogenous pricing + of health insurance](http://www.mnwhite.org/DynInsSelPaper.pdf). + +- Has + [tools](https://github.com/econ-ark/HARK/blob/master/HARK/dcegm.py) + for discrete-continuous choice models, with an [example + implementation](https://econ-ark.org/materials/endogenousretirement/). + +- [integration](https://docs.econ-ark.org/examples/ConsNewKeynesianModel/SSJ_example.html) with the [SSJ toolkit](https://github.com/shade-econ/sequence-jacobian) to enable analysis of (e.g.) HANK models in HARK. + +- Models are [*documented* to + explain](https://docs.econ-ark.org/Documentation/reference/ConsumptionSaving/ConsRiskyAssetModel.html#HARK.ConsumptionSaving.ConsRiskyAssetModel.IndShockRiskyAssetConsumerType) usage and features. + +Econ-ARK has also designed the +[REMARK](https://github.com/econ-ark/REMARK) structure for archiving +research projects and reproductions of other papers that use HARK. Examples include +reproductions of Jeppe Druedahl's +[guide](https://econ-ark.org/materials/durableconsumertype/) to +non-convex consumption-saving models, the [deep learning +method](https://econ-ark.org/materials/deep-learning-euler-method-krusell-smith/) +from Maliar, Maliar, & Winant (2018), and Alan Lujan's $\text{EGM}^n$ +[method notebook](https://econ-ark.org/materials/sequentialegm/). + +## **Problems We're Trying to Address:** + +Current practice in computational economics research impedes reproducibility, robustness, and transparency. + +- Exact model specifications, and especially computational and numeric + details of the solution and/or estimation method, are not well + communicated in published research. + +- Economic conclusions may hinge on obscure arbitrary choices + (e.g., approximation gridpoints) + +- Key implementation details might be in online appendix, or only in the + code itself. + +- Impact of these details on conclusions are usually impossible to probe in the + refereeing and editorial processes. + +- Because it is often difficult to run someone else's handcrafted code, reproducing or replicating someone else's project often "starts from zero" (and is therefore very budensome and slow) + +- There is no easy way to directly compare two implementations of the + same project or idea, and even deciding whether two papers are + using "the same" model can be difficult. + + +## **What We're Going to Do:** + +Econ-ARK's solution is to develop a new schema for unambiguously describing the mathematical and computational structure of a model along with all details required for solution. + +- The high-level (mathematical) model description will be a lot like a [DYNARE](https://www.dynare.org/) `mod file` but capable of representing a much broader class of models (Markov decision processes, including but not limited to Bellman problems). + +- Difference in philosopy with DYNARE is that we will separate model description +from solution methods, so that problems can be specified exactly and rigorously, independently of the solution method (or before any solution method has been devised). + +- A counterpart to the abstract model description will be a "numerics" description that surfaces all of the configurations and choices for the numerical approach used + +## How We're Going to Do It + +We already have a primitive sketch of what the mathematical part of such a schema might look like, building on DYNARE and [Dolo](https://pypi.org/project/dolo) + +- Capabilities of the schema will be informed by *iterative feedback from a working-group of experts* in the field. + - If the schema can't describe a feature they want, it needs to be improved. + +- We will engage with proprietors of existing toolkits + - Make sure that the schema can represent all the things their kits can do + - Get their feedback about additional capabilities needed + +- Comprehensively survey the existing tools available outside of economics + - A thorough search has convinced us that none of them does what we need + - But several have components and ideas that we will incorporate + +## Why Will the World Be Better When We're Done? + +- Greatly reduces burden on reader / evaluator to understand what was + *actually done*-- the *first prerequisite* to independently + reproducing the work. + +- It will be possible to solve the *exact same* problem using different tools + - For debugging + - For accuracy and speed + - For transparency + +- We aim to design the schema so that it provides the information necessary to use AI / deep learning platforms not specifically designed for economics + - Allowing comparison of these new solution methods to existing + +- Common platform for interacting with multiple toolkits would + accelerate research.