Package: econ-ark
Heterogeneous Agents Resources and toolKit (HARK)HARK is a toolkit for the structural modeling of economic choices of optimizing and non-optimizing heterogeneous agents. For more information on using HARK, see theEcon-ARK Website.The Econ-ARK project uses anopen governance modeland is fiscally sponsored byNumFOCUS. Consider making atax-deductible donationto help the project pay for developer time, professional services, travel, workshops, and a variety of other needs.This project is bound by aCode of Conduct.Questions/Comments/HelpWe have aGitterEcon-ARKcommunity.Table of ContentsInstallUsageCitationSupportRelease TypesAPI DocumentationIntroductionFor Students: A Gentle Introduction to HarkFor Economists: Structural Modeling with HarkFor Computational Economics DevelopersContributing to HARKCurrent Project Team MembersFoundersTSC (Technical Steering Commitee)CollaboratorsRelease TeamContributorsDisclaimerInstallInstall fromAnaconda Cloudby running:conda install -c conda-forge econ-arkInstall fromPyPiby running:pip install econ-arkUsageWe start with almost the simplest possible consumption model: A consumer with CRRA utilityhas perfect foresight about everything except the (stochastic) date of death.The agent's problem can be written inBellman formas:To model the above problem, start by importing thePerfForesightConsumerTypemodel from the appropriateHARKmodule then create an agent instance using the appropriate paramaters:importHARKfromHARK.ConsumptionSaving.ConsIndShockModelimportPerfForesightConsumerTypePF_params={"CRRA":2.5,# Relative risk aversion"DiscFac":0.96,# Discount factor"Rfree":1.03,# Risk free interest factor"LivPrb":[0.98],# Survival probability"PermGroFac":[1.01],# Income growth factor"T_cycle":1,"cycles":0,"AgentCount":10000,}# Create an instance of a Perfect Foresight agent with the above paramatersPFexample=PerfForesightConsumerType(**PF_params)Once the model is created, ask the the agent to solve the problem with.solve():# Tell the agent to solve the problemPFexample.solve()Solving the problem populates the agent's.solutionlist attribute with solutions to each period of the problem. In the case of an infinite horizon model, there is just one element in the list, atindex-zero.You can retrieve the solution's consumption function from the.cFuncattribute:# Retrieve the consumption function of the solutionPFexample.solution[0].cFuncOr you can retrieve the solved value for human wealth normalized by permanent income from the solution's.hNrmattribute:# Retrieve the solved value for human wealth normalized by permanent incomePFexample.solution[0].hNrmFor a detailed explanation of the above example please see the demo notebookA Gentle Introduction to HARK.For more examples please visit theecon-ark/DemARKrepository.CitationIf using Econ-ARK in your work or research pleasecite our Digital Object Identifieror copy the BibTex below.[1] Carroll, Christopher D, Palmer, Nathan, White, Matthew N., Kazil, Jacqueline, Low, David C, & Kaufman, Alexander. (2017, October 3).econ-ark/HARKBibText@InProceedings{carroll_et_al-proc-scipy-2018,
  author    = { {C}hristopher {D}. {C}arroll and {A}lexander {M}. {K}aufman and {J}acqueline {L}. {K}azil and {N}athan {M}. {P}almer and {M}atthew {N}. {W}hite },
  title     = { {T}he {E}con-{A}{R}{K} and {H}{A}{R}{K}: {O}pen {S}ource {T}ools for {C}omputational {E}conomics },
  booktitle = { {P}roceedings of the 17th {P}ython in {S}cience {C}onference },
  pages     = { 25 - 30 },
  year      = { 2018 },
  editor    = { {F}atih {A}kici and {D}avid {L}ippa and {D}illon {N}iederhut and {M} {P}acer },
  doi       = { 10.25080/Majora-4af1f417-004 }
}For more on acknowledging Econ-ARKvisit our website.SupportLooking for help? Please open aGitHub issueor reach out to theTSC.Release TypesCurrent: Under active development. Code for the Current release is in the branch for its major version number (for example, v0.10.x).Development: Under active development. Code for the Current release is in the development.Current releases followSemantic Versioning. For more information please see theRelease documentation.DocumentationDocumentation for the latest release is atdocs.econ-ark.org.IntroductionFor Students: A Gentle Introduction to HARKMost of what economists have done so far with 'big data' has been like what Kepler did with astronomical data: Organizing the data, and finding patterns and regularities and interconnections.An alternative approach called 'structural modeling' aims to do, for economic data, what Newton did for astronomical data: Provide a deep and rigorous mathematical (or computational) framework that distills the essence of the underlying behavior that produces the 'big data.'The notebookA Gentle Introduction to HARKdetails how you can easily utilize our toolkit for structural modeling. Starting with a simplePerfect Foresight Modelwe solve an agent problem, then experiment with addingincome shocksand changing constructed attributes.For Economists: Structural Modeling with HARKDissatisfaction with the ability of Representative Agent models to answer important questions raised by the Great Recession has led to a strong movement in the macroeconomics literature toward 'Heterogeneous Agent' models, in which microeconomic agents (consumers; firms) solve a structural problem calibrated to match microeconomic data; aggregate outcomes are derived by explicitly simulating the equilibrium behavior of populations solving such models.The same kinds of modeling techniques are also gaining popularity among microeconomists, in areas ranging from labor economics to industrial organization. In both macroeconomics and structural micro, the chief barrier to the wide adoption of these techniques has been that programming a structural model has, until now, required a great deal of specialized knowledge and custom software development.HARK provides a robust, well-designed, open-source toolkit for building such models much more efficiently than has been possible in the past.OurDCEGM Upper Envelopenotebook illustrates using HARK to replicate theIskhakov, Jørgensen, Rust, and Schjerning paperfor solving the discrete-continuous retirement saving problem.The notebookMaking Structural Estimates From Empirical Resultsis another demonstration of using HARK to conduct a quick structural estimation based on Table 9 ofMPC Heterogeneity and Household Balance Sheetsby Fagereng, Holm, and Natvik.For Computational Economics DevelopersHARK provides a modular and extensible open-source toolkit for solving heterogeneous-agent partial-and general-equilibrium structural models. The code for such models has always been handcrafted, idiosyncratic, poorly documented, and sometimes not generously shared from leading researchers to outsiders. The result being that it can take years for a new researcher to become proficient. By building an integrated system from the bottom up using object-oriented programming techniques and other tools, we aim to provide a platform that will become a focal point for people using such models.HARK is written in Python, making significant use of libraries such as numpy and scipy which offer a wide array of mathematical and statistical functions and tools. Our modules are generally categorized into Tools (mathematical functions and techniques), Models (particular economic models and solvers) and Applications (use of tools to simulate an economic phenomenon).For more information on how you can create your own Models or use Tools and Model to create Applications please see theHARK Manual.Contributing to HARKWe want contributing to Econ-ARK to be fun, enjoyable, and educational for anyone, and everyone.Contributions go far beyond pull requests and commits. Although we love giving you the opportunity to put your stamp on HARK, we are also thrilled to receive a variety of other contributions including:Documentation updates, enhancements, designs, or bugfixesSpelling or grammar fixesREAME.md corrections or redesignsAdding unit, or functional testsTriaging GitHub issues-- e.g. pointing out the relevant files, checking for reproducibilitySearching for #econ-ark on twitterand helping someone else who needs helpAnswering questions from StackOverflow tagged withecon-arkTeaching others how to contribute to HARKBlogging, speaking about, or creating tutorials about HARKHelping others in our mailing listIf you are worried or don’t know how to start, you can always reach out to theTSCor simply submitan issueand a member can help give you guidance!After your first contribution please let us know and we will add you to the Contributors list below!To install for development see theQuickstart Guide.For more information on contributing to HARK please seethe contributing guide.
This is the guide that collaborators follow in maintaining the Econ-ARK project.DisclaimerThis is a beta version of HARK. The code has not been extensively tested as it should be. We hope it is useful, but there are absolutely no guarantees (expressed or implied) that it works or will do what you want. Use at your own risk. And please, let us know if you find bugs by posting an issue tothe GitHub page!