diff --git a/REMARKs/Aiyagari-Idiosyncratic.yml b/REMARKs/Aiyagari-Idiosyncratic.yml index 384fae27..2765a729 100644 --- a/REMARKs/Aiyagari-Idiosyncratic.yml +++ b/REMARKs/Aiyagari-Idiosyncratic.yml @@ -1,3 +1,2 @@ -name: Aiyagari-Idiosyncratic remote: https://github.com/econ-ark/Aiyagari-Idiosyncratic -title: Uninsured Idiosyncratic Risk and Aggregate Saving +tag: v1.0.0 diff --git a/REMARKs/Aiyagari.md b/REMARKs/Aiyagari.md deleted file mode 100644 index cb4f6302..00000000 --- a/REMARKs/Aiyagari.md +++ /dev/null @@ -1,51 +0,0 @@ ---- -# CFF required fields -cff-version: 1.1.0 # required (don't change) -authors: # required - - - family-names: "Huang" - given-names: "Zixuan" - # orcid: "https://orcid.org/XXXX-XXXX-XXXX-XXXX" - - - family-names: "Sun" - given-names: "Mingzuo" - # orcid: "https://orcid.org/XXXX-XXXX-XXXX-XXXX" -title: "Uninsured Idiosyncratic Risk and Aggregate Saving" # required -abstract: Aiyagari (1994) Replication # optional - -# REMARK required fields -remark-version: 1.0 # required - specify version of REMARK standard used -references: # required for replications; optional for reproductions; BibTex data from original paper - - type: article - authors: # required - - - family-names: "Aiyagari" - given-names: "S. Rao" - # orcid: https://orcid.org/XXXX-XXXX-XXXX-XXXX - title: "Uninsured Idiosyncratic Risk and Aggregate Saving" - doi: https://doi.org/10.2307/2118417 - date: 1994 - publisher: The Quarterly Journal of Economics - -# Econ-ARK website fields -github_repo_url: https://github.com/econ-ark/Aiyagari-Idiosyncratic # required -remark-name: Aiyagari-Idiosyncratic # required -notebooks: # path to any notebooks within the repo - optional - - - Aiyagari1994QJE.ipynb - -tags: # Use the relavent tag - - REMARK - - Notebook ---- - - - -# AiyagariIdiosyncratic - -This is a Replication of S. Rao Aiyagari (1994). - - -## References - -Aiyagari, S. R. (1994). Uninsured idiosyncratic risk and aggregate saving. The Quarterly Journal of Economics, 109(3), 659-684. diff --git a/REMARKs/BayerLuetticke.md b/REMARKs/BayerLuetticke.md deleted file mode 100644 index cb861ee0..00000000 --- a/REMARKs/BayerLuetticke.md +++ /dev/null @@ -1,50 +0,0 @@ ---- -# CFF Requires fields -cff-version: 1.1.0 # required (don't change) -authors: # required - - - family-names: "Lee" - given-names: "Seungcheol" - # orcid: "https://orcid.org/XXXX-XXXX-XXXX-XXXX" - - - family-names: "Park" - given-names: "Seungmoon" - # orcid: "https://orcid.org/XXXX-XXXX-XXXX-XXXX" -title: "Solving heterogeneous agent models in discrete time with many idiosyncratic states by perturbation methods" # required -abstract: "Code that solves models from the paper of Bayer and Luetikke, \"Solving heterogeneous agent models in discrete time with many idiosyncratic states by perturbation methods\"." # optional -date-released: 2021-02-02 # required - -# REMARK required fields -remark-version: 1.0 # required - specify version of REMARK standard used -references: # required for replications; optional for reproductions; BibTex data from original paper - - type: article - authors: # required - - - family-names: "Bayer" - given-names: "Christian" - # orcid: "https://orcid.org/XXXX-XXXX-XXXX-XXXX" - - - family-names: "Luetticke" - given-names: "Ralph" - # orcid: "https://orcid.org/XXXX-XXXX-XXXX-XXXX" - title: "Solving heterogeneous agent models in discrete time with many idiosyncratic states by perturbation methods" # required - date: 2018-07-14 # required - -# Econ-ARK website fields -github_repo_url: https://github.com/econ-ark/BayerLuetticke # required -remark-name: BayerLuetticke # required - -tags: # Use the relavent tags - - REMARK - - Reproduction ---- - -# Bayer Luetticke (2018) -[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/econ-ark/BayerLuetticke/HEAD) - -"Code that solves models from the paper of Bayer and Lueticke (2018), \"Solving heterogeneous agent models in discrete time with many idiosyncratic states by perturbation methods\"." - - -## References - -Bayer, C., & Luetticke, R. (2018). Solving discrete time heterogeneous agent models with aggregate risk and many idiosyncratic states by perturbation. Working paper, CEPR Discussion Paper No. DP13071. diff --git a/REMARKs/BlanchardPA2019.md b/REMARKs/BlanchardPA2019.md deleted file mode 100644 index 54147ce8..00000000 --- a/REMARKs/BlanchardPA2019.md +++ /dev/null @@ -1,47 +0,0 @@ ---- -# CFF Required fields -cff-version: 1.1.0 # required (don't change): -authors: # required - - - family-names: "Acalin" - given-names: "Julien" - orcid: https://orcid.org/0000-0002-6137-0537 -title: "Public Debt and Low Interest Rates" # required -abstract: This notebook fully replicates the analysis of the stochastic overlapping generations (OLG) model developed by Blanchard in his presidential address during the AEA meetings 2019. # optional - -# REMARK fields -remark-version: 1.1 # required - specify version of REMARK standard used -references: # required for replications; optional for reproductions; BibTex data from original paper - - type: Presidential Address - authors: # required - - - family-names: "Blanchard" - given-names: "Olivier" - # orcid: "https://orcid.org/XXXX-XXXX-XXXX-XXXX" - title: "Public Debt and Low Interest Rates" # required - doi: "https://doi.org/10.1257/aer.109.4.1197" # optional - date: 2019-04 # required - publisher: American Economic Review - -# Econ-ARK website fields? -github_repo_url: https://github.com/econ-ark/BlanchardPA2019 # required -remark-name: BlanchardPA2019 # required -notebooks: # path to any notebooks within the repo - optional - - - Code/Python/BlanchardPA2019.ipynb - -tags: # Use the relavent tags - - REMARK - - Replication - ---- - -# Public Debt and Low Interest Rates - -This notebook fully replicates the analysis of the stochastic overlapping generations (OLG) model developed by Blanchard in his presidential address during the AEA meetings 2019. - -## References - -Blanchard, O. (2019). Public debt and low interest rates. American Economic Review, 109(4), 1197-1229. - - diff --git a/REMARKs/BufferStock-LifeCycle.md b/REMARKs/BufferStock-LifeCycle.md deleted file mode 100644 index 0bf28fa3..00000000 --- a/REMARKs/BufferStock-LifeCycle.md +++ /dev/null @@ -1,52 +0,0 @@ ---- -# CFF required fields -cff-version: 1.1.0 # required (don't change) -authors: # required - - - family-names: "Carroll" - given-names: "Christopher D." - orcid: "https://orcid.org/0000-0003-3732-9312" - - - family-names: "Yusuf" - given-names: "Suha Kulu" - # orcid: "https://orcid.org/XXXX-XXXX-XXXX-XXXX" - - - family-names: "Son" - given-names: "Jeongwon (John)" - # orcid: "https://orcid.org/XXXX-XXXX-XXXX-XXXX" -title: "Buffer-Stock Saving and the Life Cycle/Permanent Income Hypothesis" # required -abstract: This is a replication of Carroll (1997), Buffer-Stock Saving and the Life Cycle/Permanent Income Hypothesis. # optional - -# REMARK required fields -remark-version: 1.0 # required - specify version of REMARK standard used -references: - - type: article - authors: # required - - - family-names: "Carroll" - given-names: "Christopher D." - orcid: "https://orcid.org/0000-0003-3732-9312" - title: "Buffer-Stock Saving and the Life Cycle/Permanent Income Hypothesis" # required - doi: "https://doi.org/10.1162/003355397555109" # optional - date: 1997-02-01 # required - publisher: "The Quarterly Journal of Economics" - -# Econ-ARK website fields -github_repo_url: https://github.com/econ-ark/BufferStock-LifeCycle # required -remark-name: BufferStock-LifeCycle # required -notebooks: # path to any notebooks within the repo - optional - - - Code/Python/BufferStock-LifeCycle.ipynb - -tags: # Use the relavent tags - - REMARK - - Notebook ---- - -# BufferStock-LifeCycle - -This is a replication of Carroll (1997), Buffer-Stock Saving and the Life Cycle/Permanent Income Hypothesis. - -## References - -Carroll, C. D. (1997). Buffer-stock saving and the life cycle/permanent income hypothesis. The Quarterly Journal of Economics, CXII, 1-55 diff --git a/REMARKs/BufferStockTheory-Problems.md b/REMARKs/BufferStockTheory-Problems.md deleted file mode 100644 index 64956c5d..00000000 --- a/REMARKs/BufferStockTheory-Problems.md +++ /dev/null @@ -1,54 +0,0 @@ ---- -# CFF required fields -cff-version: "1.1.0" # required (don't change) -message: "BufferStockTheory problems in notebook context" # required -authors: # required - - - family-names: "Carroll" - given-names: "Christopher D." - orcid: "https://orcid.org/0000-0003-3732-9312" -title: "Theoretical Foundations of Buffer Stock Saving: Problems" # required -abstract: "This adds some PhD student problems to the BufferStockTheory repo" # abstract: optional -date-released: 2022-01-24 # required - -# REMARK required fields -remark-version: "1.0" # required -references: # required for replications; optional for reproductions; BibTex data from original paper - - type: exercise - authors: # required - - - family-names: "Carroll" - given-names: "Christopher D." - orcid: "https://orcid.org/0000-0003-3732-9312" - title: Theoretical Foundations of Buffer Stock Saving - doi: "https://doi.org/10.5281/zenodo.4088918" # optional - # date: 20XX-XX-XX - # publisher : "Publisher information" - -# Econ-ARK website fields? -github_repo_url: https://github.com/econ-ark/BufferStockTheory # required -remark-name: BufferStockTheory # required -title-original-paper: Theoretical Foundations of Buffer Stock Saving # optional -notebooks: # path to any notebooks within the repo - optional - - - Code/Python/BufferStockTheory-Problems.ipynb - -identifiers-paper: # required for Replications; optional for Reproductions - - - type: url - value: https://llorracc.github.io/BufferStockTheory - - - type: doi - value: "https://doi.org/10.5281/zenodo.4088918" -date-published-original-paper: 2020-09-14 # required for Replications; optional for Reproductions - -tags: # Use the relavent tags - - REMARK - -keywords: # optional - - Problems - ---- -# BufferStockTheory-Problems - -This adds some PhD student problems to the BufferStockTheory repo. diff --git a/REMARKs/BufferStockTheory.md b/REMARKs/BufferStockTheory.md deleted file mode 100644 index 7a1c233b..00000000 --- a/REMARKs/BufferStockTheory.md +++ /dev/null @@ -1,57 +0,0 @@ ---- -# CFF required fields -cff-version: "1.1.0" # required (don't change) -message: "For a consumption/saving problem with transitory and permanent shocks and unbounded (CRRA) utility, this paper derives conditions under which a nondegenerate solution exists, and under which a target wealth ratio exists; all results are paired with illustrative numerical solutions." # required -authors: # required - - - family-names: "Carroll" - given-names: "Christopher D." - orcid: "https://orcid.org/0000-0003-3732-9312" -title: BufferStockTheory # required -date-released: 2020-10-11 # required -abstract: "This paper builds foundations for rigorous and intuitive understanding of 'buffer stock' saving models (Bewley (1977)-like models with a wealth target), pairing each theoretical result with quantitative illustrations. After describing conditions under which a consumption function exists, the paper articulates stricter Growth Impatience' conditions that guarantee alternative forms of stability --- either at the population level, or for individual consumers. Together, the numerical tools and analytical results constitute a comprehensive toolkit for understanding buffer stock models." # abstract: optional - -# REMARK required fields -remark-version: "1.0" # required -references: # required for replications; optional for reproductions; BibTex data from original paper - - type: article - authors: # required - - - family-names: "Carroll" - given-names: "Christopher D." - orcid: "https://orcid.org/0000-0003-3732-9312" - title: Theoretical Foundations of Buffer Stock Saving - doi: "https://doi.org/10.5281/zenodo.4088918" # optional - # date: 20XX-XX-XX - # publisher : "Publisher information" -repository: https://github.com/econ-ark/BufferStockTheory # optional - -# Econ-ARK website fields? -github_repo_url: https://github.com/econ-ark/BufferStockTheory # required -remark-name: BufferStockTheory # required -title-original-paper: Theoretical Foundations of Buffer Stock Saving # optional -notebooks: # path to any notebooks within the repo - optional - - - BufferStockTheory.ipynb -dashboards: # path to any dahsboards within the repo - optional - - - BufferStockTheory-dashboard.ipynb -identifiers-paper: # required for Replications; optional for Reproductions - - - type: url - value: https://llorracc.github.io/BufferStockTheory - - - type: doi - value: "https://doi.org/10.5281/zenodo.4088918" -date-published-original-paper: 2020-09-14 # required for Replications; optional for Reproductions - -tags: # Use the relavent tags - - REMARK - - Reproduction - -keywords: # optional - - Consumption - ---- -# BufferstockTheory -"This paper builds foundations for rigorous and intuitive understanding of `buffer stock' saving models (Bewley (1977)-like models with a wealth target), pairing each theoretical result with quantitative illustrations. After describing conditions under which a consumption function exists, the paper articulates stricter `Growth Impatience' conditions that guarantee alternative forms of stability --- either at the population level, or for individual consumers. Together, the numerical tools and analytical results constitute a comprehensive toolkit for understanding buffer stock models. diff --git a/REMARKs/CGMPortfolio.md b/REMARKs/CGMPortfolio.md deleted file mode 100644 index f58e06c7..00000000 --- a/REMARKs/CGMPortfolio.md +++ /dev/null @@ -1,76 +0,0 @@ ---- -# CFF required fields -cff-version: "1.1.0" # required -message: "For a consumption/saving problem with transitory and permanent shocks and unbounded (CRRA) utility, this paper derives conditions under which a nondegenerate solution exists, and under which a target wealth ratio exists; all results are paired with illustrative numerical solutions." # required -authors: # required - - - family-names: "Velásquez-Giraldo" - given-names: "Mateo" - orcid: 0000-0001-7243-6776 - - - family-names: "Zahn" - given-names: "Matthew" - orcid: 0000-0003-1148-2036 -title: "REMARK: Consumption and Portfolio Choice Over the Life Cycle" # required -abstract: "This REMARK is an attempt to reproduce the main results of Cocco, Gomes, & Maenhout (2005), 'Consumption and Portfolio Choice Over the Life Cycle' (https://academic.oup.com/rfs/article-abstract/18/2/491/1599892)" # abstract: optional -date-released: 2020-08-13 # required - -# REMARK required fields -remark-version: 1.0 # required -references: # Formatted metadata of original paper, from BibTex - - type: article - authors: # required - - - family-names: "Cocco" - given-names: "Joao F." - # orcid: "https://orcid.org/XXXX-XXXX-XXXX-XXXX" - - - family-names: "Gomes" - given-names: "Francisco J." - # orcid: "https://orcid.org/XXXX-XXXX-XXXX-XXXX" - - - family-names: "Maenhout" - given-names: "Pascal J." - # orcid: "https://orcid.org/XXXX-XXXX-XXXX-XXXX" - title: "Consumption and Portfolio Choice over the Life Cycle" # required - doi: "https://doi.org/10.1093/rfs/hhi017" # optional - date: 2005-02-10 - publisher : "The Review of Financial Studies" - -# Econ-ARK website fields -github_repo_url: https://github.com/econ-ark/CGMPortfolio # required -remark-name: CGMPortfolio # required -notebooks: # path to any notebooks within the repo - optional - - - Code/Python/CGMPortfolio.ipynb -identifiers-paper: # required for Replications; optional for Reproductions - - - type: url - value: https://academic.oup.com/rfs/article-abstract/18/2/491/1599892 - - - type: doi - value: https://doi.org/10.1093/rfs/hhi017 -date-published-original-paper: 2005-02-10 # required for Replications; optional for Reproductions - -tags: # Use the relavent tags - - REMARK - -identifiers: # optional - - - type: url - value: "https://github.com/econ-ark/CGMPortfolio" - -keywords: # optional - - Portfolio - - Risky Assets - - Consumption - - Life Cycle ---- - -# CGMPortfolio - -This REMARK is an attempt to reproduce the main results of Cocco, Gomes, & Maenhout (2005), 'Consumption and Portfolio Choice Over the Life Cycle' (https://academic.oup.com/rfs/article-abstract/18/2/491/1599892) - -## References - -Cocco, J. F., Gomes, F. J., & Maenhout, P. J. (2005). Consumption and portfolio choice over the life cycle. The Review of Financial Studies, 18(2), 491-533. diff --git a/REMARKs/DistributionOfWealthMPC.md b/REMARKs/DistributionOfWealthMPC.md deleted file mode 100644 index 82fb2a51..00000000 --- a/REMARKs/DistributionOfWealthMPC.md +++ /dev/null @@ -1,68 +0,0 @@ ---- -# CFF required fields -cff-version: 1.1.0 # required (don't change) -message: The results of this paper are now generated in an updated repository using a more modern version of HARK, https://github.com/econ-ark/DistributionOfWealthMPC. Any followup work should build on the updated code in that repository. # optional -authors: # required - - - family-names: "Carroll" - given-names: "Christopher D." - orcid: "https://orcid.org/0000-0003-3732-9312" - - - family-names: "Slacalek" - given-names: "Jiri" - # orcid: "https://orcid.org/XXXX-XXXX-XXXX-XXXX" - - - family-names: "Kiichi" - given-names: "Tokuoka" - # orcid: "https://orcid.org/XXXX-XXXX-XXXX-XXXX" - - - family-names: "White" - given-names: "Matthew" - # orcid: "https://orcid.org/XXXX-XXXX-XXXX-XXXX" -title: "The distribution of wealth and the marginal propensity to consume" - -# REMARK required fields -remark-version: 2.0 -references: - - type: article - authors: # required - - - family-names: "Carroll" - given-names: "Christopher D." - orcid: "https://orcid.org/0000-0003-3732-9312" - - - family-names: "Slacalek" - given-names: "Jiri" - # orcid: "https://orcid.org/XXXX-XXXX-XXXX-XXXX" - - - family-names: "Kiichi" - given-names: "Tokuoka" - # orcid: "https://orcid.org/XXXX-XXXX-XXXX-XXXX" - - - family-names: "White" - given-names: "Matthew N." - # orcid: "https://orcid.org/XXXX-XXXX-XXXX-XXXX" - title: "The distribution of wealth and the marginal propensity to consume" # required - doi: "https://doi.org/10.3982/QE694" - date: 2017-11-20 - publisher: Quantitative Economics - -# Econ-ARK website fields -github_repo_url: https://github.com/econ-ark/DistributionOfWealthMPC -remark-name: DistributionofWealthMPC - -tags: # Use the relavent tags - - REMARK - - Replication ---- - - -# DistributionofWealthMPC -The results of the paper [The Distribution of Wealth and the MPC](https://onlinelibrary.wiley.com/doi/abs/10.3982/QE694) now generated in an updated repository using a more modern version of HARK, [DistributionOfWealthMPC](https://github.com/econ-ark/DistributionOfWealthMPC). Any followup work should build on the updated code in that repository. - -You should be able to reproduce all the results using the `reproduce.sh` script. - -## References - -Carroll, C., Slacalek, J., Tokuoka, K., & White, M. N. (2017). The distribution of wealth and the marginal propensity to consume. Quantitative Economics, 8(3), 977-1020. - diff --git a/REMARKs/DurableConsumerType.md b/REMARKs/DurableConsumerType.md deleted file mode 100644 index 764c917f..00000000 --- a/REMARKs/DurableConsumerType.md +++ /dev/null @@ -1,55 +0,0 @@ ---- -# CFF required fields -cff-version: 1.1.0 # required (don't change) -authors: # required - - - family-names: "Monninger" - given-names: "Adrian B." - orcid: "https://orcid.org/0000-0001-5978-5621" -title: "A Guide on Solving Non-convex Consumption-Saving Models" # required -abstract: This REMARK replicates Druedahl, J. (2021). A guide on solving non-convex consumption-saving models. - # optional -date-released: 2022-09-01 # required - -# REMARK required fields -remark-version: 1.0 # required - specify version of REMARK standard used -references: # required for replications; optional for reproductions; BibTex data from original paper - - type: article - authors: # required - - - family-names: "Druedahl" - given-names: "Jeppe" - # orcid: https://orcid.org/XXXX-XXXX-XXXX-XXXX - title: "A guide on solving non-convex consumption-saving models" - doi: https://doi.org/10.1007/s10614-020-10045-x - date: 2021 - publisher: Computational Economics -repository: "https://github.com/NumEconCopenhagen/ConsumptionSavingNotebooks" # optional (when original paper has own repository) - -# Econ-ARK website fields -github_repo_url: https://github.com/econ-ark/DurableConsumerType_REMARK # required -remark-name: DurableConsumerType # required -notebooks: # path to any notebooks within the repo - optional - - - code/python/DurableModel_Notebook.ipynb - -tags: # Use the relavent tag - - REMARK - - Notebook - -keywords: # optional - - Econ-ARK - - DurableConsumerType - - Discrete-Choice ---- - - - -# DurableConsumerType - -This REMARK replicates Druedahl, J. (2021). A guide on solving non-convex consumption-saving models. - - -## References - -Druedahl, J. (2021). A guide on solving non-convex consumption-saving models. Computational Economics, 58(3), 747-775. diff --git a/REMARKs/EndogenousRetirement.md b/REMARKs/EndogenousRetirement.md deleted file mode 100644 index 8d7be879..00000000 --- a/REMARKs/EndogenousRetirement.md +++ /dev/null @@ -1,38 +0,0 @@ ---- -# CFF required fields -cff-version: 1.1.0 # required (don't change) -authors: # required - - family-names: "Carroll" - given-names: "Christopher D." - orcid: "https://orcid.org/0000-0003-3732-9312" -title: "Endogenous Retirement: A Canonical Discrete-Continuous Problem" # required -abstract: Endogenous Retirement - A Canonical Discrete-Continuous Problem. This REMARK demonstrates a solution to the difficult problem of solving for the optimal retirement date given that consumption and asset choices are continuous. - -# REMARK required fields -remark-version: "1.0" # required - specify version of REMARK standard used -references: - - type: article - authors: # required - - - family-names: "Carroll" - given-names: "Christopher D." - orcid: "https://orcid.org/0000-0003-3732-9312" - title: "Endogenous Retirement: A Canonical Discrete-Continuous Problem" # required - # doi: "" - # date: "" - # publisher: "" - -# Econ-ARK website fields -github_repo_url: https://github.com/econ-ark/EndogenousRetirement # required -remark-name: EndogeneousRetirement # required -notebooks: # path to any notebooks within the repo - optional - - Endogenous-Retirement.ipynb - -tags: # Use the relavent tags - - REMARK - - Reproduction ---- - -# Endogenous Retirement: A Canonical Discrete-Continuous Problem - -This REMARK demonstrates a solution to the difficult problem of solving for the optimal retirement date given that consumption and asset choices are continuous. diff --git a/REMARKs/EpiExp.md b/REMARKs/EpiExp.md deleted file mode 100644 index 90f3842b..00000000 --- a/REMARKs/EpiExp.md +++ /dev/null @@ -1,59 +0,0 @@ ---- -# CFF required fields -cff-version: "1.1.0" # required -message: "Repository to reproduce results and text of paper" # required -authors: # required - - - family-names: "Carroll" - given-names: "Christopher D." - orcid: "https://orcid.org/0000-0003-3732-9312" - - - family-names: "Wang" - given-names: "Tao" - orcid: "https://orcid.org/0000-0003-4806-8592" -title: "Epidemiological Expectations in Economics" # required -abstract: "‘Epidemiological’ models of belief formation put social interactions at their core; such models are the main (almost, the only) tool used by non-economists to study the dynamics of beliefs in populations. We survey the (comparatively) small literature in which economists attempting to model the consequences of beliefs about the future – ‘expectations’ – have employed what we view as a full-fledged epidemiological approach to explore an economic question. We draw connections to related work on narrative economics, news/rumor spreading, ‘contagion,’ and the spread of online content. Finally, we discuss a number of promising directions for future research." # abstract: optional -date-released: 2021-09-29 # required - -# REMARK required fields -remark-version: "1.0" -references: - - type: Handbook-Chapter - authors: # required - - - family-names: "Carroll" - given-names: "Christopher D." - orcid: "https://orcid.org/0000-0003-3732-9312" - - - family-names: "Wang" - given-names: "Tao" - orcid: "https://orcid.org/0000-0003-4806-8592" - title: "Epidemiological Expectations in Economics" # required - # doi: "Original paper DOI" # optional - date: 2022-03-22 # required - # publisher: "Publisher information" - -# Econ-ARK website fields -github_repo_url: "https://github.com/econ-ark/EpiExp" -remark-name: EpiExp -notebooks: - - SIR_Ndlib.ipynb - -identifiers-paper: - - - type: doi - value: https://doi.org/10.5281/zenodo.6363391 - -tags: # Use the relavent tags - - REMARK - -keywords: # optional - - Epidemiology - - Expectations - ---- - -# EpiExp - -## References -Carroll, C., Wang, T. (forthcoming). Epidemiological Expectations in Economics. Handbook of Economic Expectations. diff --git a/REMARKs/GanongNoelUI.md b/REMARKs/GanongNoelUI.md deleted file mode 100644 index 48a56eb8..00000000 --- a/REMARKs/GanongNoelUI.md +++ /dev/null @@ -1,98 +0,0 @@ ---- -# CFF required fields -cff-version: 1.1.0 # required (don't change) -# message: If you use this software, please cite it as below. # optional -authors: # required - - family-names: "Ganong" - given-names: "Peter" - # orcid: "https://orcid.org/XXXX-XXXX-XXXX-XXXX" - - family-names: "Noel" - given-names: "Pascal" - # orcid: "https://orcid.org/XXXX-XXXX-XXXX-XXXX" -title: "Consumer Spending during Unemployment: Positive and Normative Implications" # required -abstract: Analysis of Models for "Consumer Spending During Unemployment- Positive and Normative Implications" - -# REMARK required fields -remark-version: "1.0" # required - specify version of REMARK standard used -references: # required for replications; optional for reproductions; BibTex data from original paper - - type: article - authors: # required - - - family-names: "Ganong" - given-names: "Peter" - # orcid: "https://orcid.org/XXXX-XXXX-XXXX-XXXX" - - - family-names: "Noel" - given-names: "Pascal" - # orcid: "https://orcid.org/XXXX-XXXX-XXXX-XXXX" - title: "Consumer Spending During Unemployment: Positive and Normative Implications" # required - doi: "https://doi.org/10.1257/aer.20170537" # optional - date: 2019-07 # required - publisher: "The American Economic Review" - -# Econ-ARK website fields -github_repo_url: "https://github.com/econ-ark/GanongNoelUI" # required -remark-name: "GanongNoelUI" # required -title-original-paper: "Consumer Spending During Unemployment: Positive and Normative Implications" # optional - -tags: # Use the relavent tags - - REMARK - - Replication - ---- - - Analysis of Models for "Consumer Spending During Unemployment: Positive and Normative Implications" - -By Peter Ganong and Pascal Noel - -We thank Xian Ng for outstanding research assistance. Please send feedback and questions to ganong@uchicago.edu. - -## Directory Structure - 1. `code/` - all estimation and analysis code - 2. `input/` - model estimation targets from JP Morgan Chase Institute (JPMCI) data - 3. `out/` - code output including figures, logfiles, and raw tables - 4. `Parameters/` - environment parameters for estimation and analysis; stored model estimation results - 5. `tables/` - formatted tables - -## Files in the `code/` directory - -### Master Scripts: do_min.py, do_mid.py, do_all.py -The master scripts in the code directory re-run the code. To call the script from the command line, go to the `code/` directory and enter 'python '. Note that this project is built on python 2.7 - 1. `do_min.py`: Solves the consumption and job search models using estimated parameters in `Parameters/model_params_main.json` to replicate the plots in the paper. - 2. `do_mid.py`: `do_min.py` + computes the standard errors on the parameter estimates, and performs the welfare simulations in the paper. - 3. `do_all.py`: `do_mid.py` + estimates the model parameters again using model targets from JPMCI data. -To simply replicate the results, it is sufficient to run one of the scripts above. - - -### Setup scripts - 1. `setup_estimation_parameters.py` reads in `Parameters/params_ui_reemp.json` to build the estimation environment - 2. `build_JPMC_targets.py` builds the model estimation targets from files in `input/` and writes to `Parameters/JPMC_inputs.py`. It only needs to be run once. - -### Model Solving, Estimation, and Simulation scripts - 3. `solve_cons.py` - contains a function that takes environment and preference parameters and computes optimal consumption in each period as a function of cash-on-hand. It solves this problem using backwards induction for a finite horizon. - 4. `job_search.py` extends `solve_cons.py`. Takes environment and preference parameters and computes optimal consumption and job search in each period as a function of cash-on-hand. - * Agent chooses search effort with an isoelastic cost and with the gains from search equal to V_emp(a) - V_unemp(a). - * To accomplish the above, we compute a value function which sums over utility in each period. We do not need the value function to compute optimal consumption, but we do need it to compute optimal job search effort. - 5. `sparsity.py` solves the sparse model from Gabaix (2016) in the UI context. - 6. `estimate_models.py` takes environmental parameters and consumption and job search moments and solves for the preference parameters that generate consumption and job search behavior similar to the moments. Relies on the class in `job_search.py`. By default, solves for the models in the paper one at a time. Can also be used to solve multiple models at once on a cluster. - 7. `agent_history.py` With a given set of environmental and preference parameters, simulates employment histories, consumption behavior, and job search behavior for N agents. - -### Plotting and Replication scripts - 8. `model_plotting.py` contains plotting functions. `make_plots.py` uses the `rpy2` package to create some wrappers for making PDF plots in R. - 9. `model_plots.py` produces plots using the estimated preference parameters contained in `Parameters/model_params_main.json` and `Parameters/model_params_sec.json`. - 10. `model_welfare.py` performs the simulations for lifecycle welfare analysis. - 11. `comp_SEs.py` calculates standard errors for estimated models. - Note: all output is in the `/out/` directory. - -### Other files - * `est_robust_gamma.py` estimates models with different risk aversion parameters. - * `estimate_models_helper.py` contains helper functions for estimating many models simultaneously on a cluster. - * `grid_submit.sh` shell script for submitting jobs to a cluster. Edit as necessary. - * `make_plots.py` contains aesthetic options for plots. - * `prelim.py` is a helper script for setting up the model environment. - * `est_models_in/` contains `initial_conditions_master.json` for estimating the models in the paper. csv files in the directory are examples of different initial conditions for model estimation. Convert to JSON for estimation using function in `estimate_models_helper.py` -* `est_models_out` logs final estimates as JSON files when estimating preference parameters for multiple models at the same time on a cluste. Convert to csv using function in `estimate_models_helper.py` - -## References - -Ganong, P., & Noel, P. (2019). Consumer spending during unemployment: Positive and normative implications. American economic review, 109(7), 2383-2424. diff --git a/REMARKs/KrusellSmith.md b/REMARKs/KrusellSmith.md deleted file mode 100644 index 4aff2e63..00000000 --- a/REMARKs/KrusellSmith.md +++ /dev/null @@ -1,53 +0,0 @@ ---- -# CFF required fields -cff-version: "1.1.0" # required (don't change) -authors: # required - - family-names: "Carroll" - given-names: "Christopher D." - orcid: "https://orcid.org/0000-0003-3732-9312" -title: "Income and Wealth Heterogeneity in the Macroeconomy" # required -abstract: "Income and wealth heterogeneity in the macroeconomy" # optional - -# REMARK required fields -remark-version: "1.0" # required - specify version of REMARK standard used -references: # required for replications; optional for reproductions; BibTex data from original paper - - type: article - authors: # required - - - family-names: "Krusell" - given-names: "Per" - # orcid: "https://orcid.org/XXXX-XXXX-XXXX-XXXX" - - - family-names: "Smith, Jr." - given-names: "Anthony A." - # orcid: "https://orcid.org/XXXX-XXXX-XXXX-XXXX" - title: "Income and Wealth Heterogeneity in the Macroeconomy" # required - doi: "https://doi.org/10.1086/250034" # optional - date: 1998-10 # required - publisher: "Journal of Political Economy" - -# Econ-ARK website fields -github_repo_url: https://github.com/econ-ark/KrusellSmith -remark-name: KrusellSmith # required -notebooks: # path to any notebooks within the repo - optional - - - Code/Python/KrusellSmith.ipynb - -tags: # Use the relavent tags - - REMARK - - Notebook - ---- - - - -# KrusellSmith - -[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/econ-ark/KrusellSmith/HEAD) - -This is a Replication of Krusell and Smith, 1998. - - -## References - -Krusell, P., & Smith, Jr, A. A. (1998). Income and wealth heterogeneity in the macroeconomy. Journal of political Economy, 106(5), 867-896. diff --git a/REMARKs/LiqConstr.md b/REMARKs/LiqConstr.md deleted file mode 100644 index 3ffa6fcf..00000000 --- a/REMARKs/LiqConstr.md +++ /dev/null @@ -1,71 +0,0 @@ ---- -# CFF required fields -cff-version: "1.1.0" # required -message: "This paper shows that liquidity constraints and precautionary saving are closely related to each other, since both can be thought of is \"counterclockwise concavifications\" of the consumption function.; all results are paired with illustrative numerical solutions." # required -authors: # required - - - family-names: "Carroll" - given-names: "Christopher D." - orcid: "https://orcid.org/0000-0003-3732-9312" - - - family-names: "Kimball" - given-names: "Miles S." - # orcid: "https://orcid.org/XXXX-XXXX-XXXX-XXXX" - - - family-names: "Holm" - given-names: "Martin B." - # orcid: "https://orcid.org/XXXX-XXXX-XXXX-XXXX" -title: "Liquidity Constraints and Precautionary Saving" # required -abstract: "We provide the analytical explanation of strong interactions between precautionary sav- ing and liquidity constraints that are regularly observed in numerical solutions to consump- tion/saving models. The effects of constraints and of uncertainty spring from the same cause: concavification of the consumption function, which can be induced either by constraints or by uncertainty. Concavification propagates back to consumption functions in prior periods. But, surprisingly, once a linear consumption function has been concavified by the presence of either risks or constraints, the introduction of additional concavifiers in a given period can reduce the precautionary motive in earlier periods at some levels of wealth." # abstract: optional -date-released: 2020-09-14 # required - -# REMARK required fields -remark-version: "1.0" # required - specify version of REMARK standard used -references: # required for replications; optional for reproductions; BibTex data from original paper - - type: article - authors: # required - - - family-names: "Carroll" - given-names: "Christopher D." - orcid: "https://orcid.org/0000-0003-3732-9312" - - - family-names: "Kimball" - given-names: "Miles S." - # orcid: "https://orcid.org/XXXX-XXXX-XXXX-XXXX" - - - family-names: "Holm" - given-names: "Martin B." - # orcid: "https://orcid.org/XXXX-XXXX-XXXX-XXXX" - title: "Liquidity Constraints and Precautionary Savings" # required - doi: "https://doi.org/10.1016/j.jet.2021.105276" # optional - date: 2021-07 # required - publisher: "Journal of Economic Theory" #optional - -# Econ-ARK website fields -github_repo_url: https://github.com/econ-ark/LiqConstr # required -remark-name: LiqConstr # required -notebooks: # path to any notebooks within the repo - optional - - - LiqConstr.ipynb -dashboards: # path to any dahsboards within the repo - optional - - - LiqConstr-Dashboard.ipynb -tags: # Use the relavent tags - - REMARK - - Reproduction - -keywords: # optional - - liquidity constraints - - uncertainty - - precautionary saving - ---- - -# Liquidity Constraints and Precautionary Saving - -The LiqConstr directory contains code to reproduce the figures of the paper [Liquidity Constraints and Precautionary Saving](http://econ.jhu.edu/people/ccarroll/papers/LiqConstr/) by Carroll, Holm, and Kimball, -and the LaTeX source to produce the paper once the figures have been created. - -## References - -Carroll, C. D., Holm, M. B., & Kimball, M. S. (2021). Liquidity constraints and precautionary saving. Journal of Economic Theory, 195, 105276. diff --git a/REMARKs/Pandemic.md b/REMARKs/Pandemic.md deleted file mode 100644 index 7aa48040..00000000 --- a/REMARKs/Pandemic.md +++ /dev/null @@ -1,77 +0,0 @@ ---- -# CFF required fields -cff-version: "1.1.0" # required (don't change) -message: "To predict the effects of the 2020 U.S. CARES Act on consumption, we extend a model that matches responses of households to past consumption stimulus packages; all results are paired with illustrative numerical solutions." # required -authors: # required - - - family-names: "Carroll" - given-names: "Christopher D." - orcid: "https://orcid.org/0000-0003-3732-9312" - - - family-names: "Crawley" - given-names: "Edmund" - # orcid: "https://orcid.org/XXXX-XXXX-XXXX-XXXX" - - - family-names: "Slacalek" - given-names: "Jiri" - # orcid: "https://orcid.org/XXXX-XXXX-XXXX-XXXX" - - - family-names: "White" - given-names: "Matthew N." - # orcid: "https://orcid.org/XXXX-XXXX-XXXX-XXXX" -title: "Modeling the Consumption Response to the CARES Act" # required -abstract: "To predict the effects of the 2020 U.S. CARES Act on consumption, we extend a model that matches responses of households to past consumption stimulus packages. The extension allows us to account for two novel features of the coronavirus crisis. First, during the lockdown, many types of spending are undesirable or impossible. Second, some of the jobs that disappear during the lockdown will not reappear when it is lifted. We estimate that, if the lockdown is short-lived, the combination of expanded unemployment insurance benefits and stimulus payments should be sufficient to allow a swift recovery in consumer spending to its pre-crisis levels. If the lockdown lasts longer, an extension of enhanced unemployment benefits will likely be necessary if consumption spending is to recover." # abstract: optional - -# REMARK required fields -remark-version: "1.0" # required -references: # required for replications; optional for reproductions; BibTex data from original paper - - type: article - authors: # required - - - family-names: "Carroll" - given-names: "Christopher D." - orcid: "https://orcid.org/0000-0003-3732-9312" - - - family-names: "Crawley" - given-names: "Edmund" - # orcid: "https://orcid.org/XXXX-XXXX-XXXX-XXXX" - - - family-names: "Slacalek" - given-names: "Jiri" - # orcid: "https://orcid.org/XXXX-XXXX-XXXX-XXXX" - - - family-names: "White" - given-names: "Matthew N." - # orcid: "https://orcid.org/XXXX-XXXX-XXXX-XXXX" - title: "Modeling the Consumption Response to the CARES Act" # required - doi: "https://doi.org/10.3386/w27876" # optional - date: 2020-09-14 # required - publisher: "NBER" - -# Econ-ARK website fields -github_repo_url: https://github.com/econ-ark/Pandemic # required -remark-name: Pandemic # required -dashboards: # path to any dahsboards within the repo - optional - - - Code/Python/dashboard.ipynb - -tags: # Use the relavent tags - - REMARK - - Notebook - -keywords: # optional - - Consumption - - COVID-19 - - Stimulus - - Fiscal Policy ---- - -# Pandemic-Consumption-Response - -[![badge](https://img.shields.io/badge/Launch-Dashboard-579ACA.svg?logo=data:image/png;base64,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)](https://xhrtcvh6l53u.curvenote.dev/services/binder/v2/gh/econ-ark/Pandemic/HEAD?urlpath=/voila/render/Code/Python/dashboard.ipynb) - -This repository is a complete software archive for the paper "Modeling the Consumption Response to the CARES Act" by Carroll, Crawley, Slacalek, and White (2020). This README file provides instructions for running our code on your own computer, as well as adjusting the parameters of the model to produce alternate versions of the figures in the paper. - -## References - -Carroll, C. D., Crawley, E., Slacalek, J., & White, M. N. (2020). Modeling the consumption response to the CARES Act (No. w27876). National Bureau of Economic Research. diff --git a/REMARKs/PortfolioChoiceBlogPost.md b/REMARKs/PortfolioChoiceBlogPost.md deleted file mode 100644 index 4b00dcfa..00000000 --- a/REMARKs/PortfolioChoiceBlogPost.md +++ /dev/null @@ -1,37 +0,0 @@ ---- -# CFF required fields -cff-version: 1.1.0 # required (don't change) -authors: # required - - family-names: "Carroll" - given-names: "Christopher D." - orcid: "https://orcid.org/0000-0003-3732-9312" -title: Optimal Financial Investment over the Life Cycle - Blog Post -abstract: A blog post (https://econ-ark.github.io/PortfolioChoiceBlogPost/PortfolioChoiceBlogPost.html) showcasing use of HARK to the portfolio choice allocation problem. - -# REMARK required fields -remark-version: "1.0" # required - specify version of REMARK standard used -references: # required for replications; optional for reproductions; BibTex data from original paper - - type: Blogpost - authors: # required - - - family-names: "Carroll" - given-names: "Christopher D." - orcid: "https://orcid.org/0000-0003-3732-9312" - title: "Optimal Financial Investment over the Life Cycle - Blog Post" # required - -# Econ-ARK website fields -github_repo_url: https://github.com/econ-ark/PortfolioChoiceBlogPost -remark-name: "PortfolioChoiceBlogPost" -notebooks: # path to any notebooks within the repo - optional - - PortfolioChoiceBlogPost.ipynb -tags: - - REMARK - - Replication - - Notebook - - Blog ---- - -# PortfolioChoiceBlogPost - -A [blog post](https://econ-ark.github.io/PortfolioChoiceBlogPost/PortfolioChoiceBlogPost.html) showcasing use of HARK to the portfolio choice allocation problem. - diff --git a/REMARKs/RiskyContrib.md b/REMARKs/RiskyContrib.md deleted file mode 100644 index 327f2ba1..00000000 --- a/REMARKs/RiskyContrib.md +++ /dev/null @@ -1,63 +0,0 @@ ---- -# CFF required fields -cff-version: "1.1.0" # required (don't change) -authors: # required - - - family-names: "Velásquez-Giraldo" - given-names: "Mateo" - orcid: https://orcid.org/0000-0001-7243-6776 -title: "A Two-Asset Savings Model with an Income-Contribution Scheme" # required -abstract: "This paper develops a two-asset consumption-savings model and serves as -the documentation of an open-source implementation of methods to solve and -simulate it in the HARK toolkit. The model represents an agent who can -save using two different assets---one risky and the other risk-free---to insure -against fluctuations in his income, but faces frictions to transferring funds between -assets. The flexibility of its implementation and its inclusion in the HARK -toolkit will allow users to adapt the model to realistic life-cycle calibrations, and -also to embedded it in heterogeneous-agents macroeconomic models." # optional -date-released: 2021-06-17 # required - -# REMARK required fields -remark-version: "v1.0.1" # required -references: # required for replications; optional for reproductions; BibTex data from original paper - - type: article - authors: # required - - - family-names: "Velásquez-Giraldo" - given-names: "Mateo" - orcid: https://orcid.org/0000-0001-7243-6776 - - - family-names: "Author 2 Last Name" - given-names: "Author 2 First Name" - orcid: "https://orcid.org/XXXX-XXXX-XXXX-XXXX" - title: "A Two-Asset Savings Model with an Income-Contribution Scheme" # required - doi: "https://zenodo.org/badge/DOI/10.5281/zenodo.4974234.svg" # optional - -# Econ-ARK website fields -github_repo_url: https://github.com/econ-ark/RiskyContrib # required -remark-name: RiskyContrib # required -notebooks: # path to any notebooks within the repo - optional - - - Code/Python/RiskyContrib.ipynb - -tags: # Use the relavent tags - - REMARK - -keywords: # optional - - Lifecycle - - Portfolio Choice - - Social Security - - Open Source - ---- - -# A Two-Asset Savings Model with an Income-Contribution Scheme - -This paper develops a two-asset consumption-savings model and serves as -the documentation of an open-source implementation of methods to solve and -simulate it in the HARK toolkit. The model represents an agent who can -save using two different assets---one risky and the other risk-free---to insure -against fluctuations in his income, but faces frictions to transferring funds between -assets. The flexibility of its implementation and its inclusion in the HARK -toolkit will allow users to adapt the model to realistic life-cycle calibrations, and -also to embedded it in heterogeneous-agents macroeconomic models. diff --git a/REMARKs/SequentialEGM.md b/REMARKs/SequentialEGM.md deleted file mode 100644 index 6e866852..00000000 --- a/REMARKs/SequentialEGM.md +++ /dev/null @@ -1,77 +0,0 @@ ---- -# CFF required fields -cff-version: 1.2.0 -message: "If you use this software, please cite it as below." -authors: - - family-names: "Lujan" - given-names: "Alan" -title: "EGM$^n$: The Sequential Endogenous Grid Method" -abstract: | - Heterogeneous agent models with multiple decisions are often - solved using inefficient grid search methods that require many - evaluations and are slow. This paper provides a novel method for - solving such models using an extension of the Endogenous Grid - Method (EGM) that uses Gaussian Process Regression (GPR) to - interpolate functions on unstructured grids. First, I propose an - intuitive and strategic procedure for decomposing a problem into - subproblems which allows the use of efficient solution methods. - Second, using an exogenous grid of post-decision states and - solving for an endogenous grid of pre-decision states that obey a - first-order condition greatly speeds up the solution process. - Third, since the resulting endogenous grid can often be - non-rectangular at best and unstructured at worst, GPR provides - an efficient and accurate method for interpolating the value, - marginal value, and decision functions. Applied sequentially to - each decision within the problem, the method is able to solve - heterogeneous agent models with multiple decisions in a fraction - of the time and with less computational resources than are - required by standard methods currently used. Software to - reproduce these methods is available under the - https://econ-ark.org/ project for the python programming - language. - - -# REMARK required fields -remark-version: 1.0 # required - specify version of REMARK standard used - -# Econ-ARK website fields -github_repo_url: https://github.com/alanlujan91/SequentialEGM -remark-name: "SequentialEGM" -notebooks: - - code/EGMN/example_ConsPensionModel.ipynb - -tags: # Use the relavent tag - - REMARK - - Notebook - -identifiers-paper: - - type: url - value: https://alanlujan91.github.io/SequentialEGM/egmn/ ---- - -# EGM$^n$ The Sequential Endogenous Grid Method" - -[![badge](https://img.shields.io/badge/Launch-Curvenote-E66581.svg?logo=data:image/png;base64,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)](https://josecon.curve.space/articles/018dc338-e64c-7c68-9b37-4f3d092f4252) - -Heterogeneous agent models with multiple decisions are often -solved using inefficient grid search methods that require many -evaluations and are slow. This paper provides a novel method for -solving such models using an extension of the Endogenous Grid -Method (EGM) that uses Gaussian Process Regression (GPR) to -interpolate functions on unstructured grids. First, I propose an -intuitive and strategic procedure for decomposing a problem into -subproblems which allows the use of efficient solution methods. -Second, using an exogenous grid of post-decision states and -solving for an endogenous grid of pre-decision states that obey a -first-order condition greatly speeds up the solution process. -Third, since the resulting endogenous grid can often be -non-rectangular at best and unstructured at worst, GPR provides -an efficient and accurate method for interpolating the value, -marginal value, and decision functions. Applied sequentially to -each decision within the problem, the method is able to solve -heterogeneous agent models with multiple decisions in a fraction -of the time and with less computational resources than are -required by standard methods currently used. Software to -reproduce these methods is available under the - project for the python programming -language. diff --git a/REMARKs/SequentialEGM.yml b/REMARKs/SequentialEGM.yml new file mode 100644 index 00000000..dcd72100 --- /dev/null +++ b/REMARKs/SequentialEGM.yml @@ -0,0 +1,3 @@ +name: Sequential Endogenous Grid Method +remote: https://github.com/alanlujan91/SequentialEGM +title: 'EGM^n: The Sequential Endogenous Grid Method' diff --git a/REMARKs/SolvingMicroDSOPs.md b/REMARKs/SolvingMicroDSOPs.md deleted file mode 100644 index 9eab07fd..00000000 --- a/REMARKs/SolvingMicroDSOPs.md +++ /dev/null @@ -1,52 +0,0 @@ ---- -# CFF required fields -cff-version: "1.1.0" # required -authors: # required - - family-names: "Carroll" - given-names: "Christopher D." - orcid: "https://orcid.org/0000-0003-3732-9312" - - family-names: "Lujan" - given-names: "Alan" - orcid: "https://orcid.org/0000-0002-5289-7054" - - family-names: "Wang" - given-names: "Tao" - orcid: "https://orcid.org/0000-0003-4806-8592" -title: "Solution Methods for Microeconomic Dynamic Stochastic Optimization Problems" # required -abstract: "These notes describe tools for solving microeconomic dynamic stochastic optimization problems, and show how to use those tools for efficiently estimating a standard life cycle consumption/saving model using microeconomic data. No attempt is made at a systematic overview of the many possible technical choices; instead, I present a specific set of methods that have proven useful in my own work (and explain why other popular methods, such as value function iteration, are a bad idea). Paired with these notes is Mathematica, Matlab, and Python software that solves the problems described in the text." # abstract: optional -date-released: 2021-02-20 # required - -# REMARK required fields -remark-version: "1.0" # required -references: - - type: lecture-notes - authors: # required - - family-names: "Carroll" - given-names: "Christopher D." - orcid: "https://orcid.org/0000-0003-3732-9312" - title: "Solution Methods for Microeconomic Dynamic Stochastic Optimization Problems" - repository: "https://github.com/llorracc/SolvingMicroDSOPs" # optional - -# Econ-ARK website fields -github_repo_url: https://github.com/econ-ark/SolvingMicroDSOPs # required -remark-name: SolvingMicroDSOPs # required -notebooks: # path to any notebooks within the repo - optional - - SolvingMicroDSOPs.ipynb - -identifiers: # optional - - type: url - value: "https://llorracc.github.io/SolvingMicroDSOPs" - -tags: - - REMARK - - Replication - - Teaching - - Tutorial - -keywords: # optional - - Consumption - - Saving ---- - -# Solution Methods for Microeconomic Dynamic Stochastic Optimization Problems - -These notes describe tools for solving microeconomic dynamic stochastic optimization problems, and show how to use those tools for efficiently estimating a standard life cycle consumption/saving model using microeconomic data. No attempt is made at a systematic overview of the many possible technical choices; instead, I present a specific set of methods that have proven useful in my own work (and explain why other popular methods, such as value function iteration, are a bad idea). Paired with these notes is Mathematica, Matlab, and Python software that solves the problems described in the text. diff --git a/REMARKs/beyond-the-streetlight.md b/REMARKs/beyond-the-streetlight.md deleted file mode 100644 index d649ebd8..00000000 --- a/REMARKs/beyond-the-streetlight.md +++ /dev/null @@ -1,54 +0,0 @@ ---- -# CFF required fields -cff-version: 1.1.0 # required (don't change) -message: If you use this software, please cite it as below. # optional -authors: # required - - family-names: Edwards - given-names: Decory - #orcid: "https://orcid.org/XXXX-XXXX-XXXX-XXXX" - - family-names: Carroll - given-names: Christopher - orcid: https://orcid.org/0000-0003-3732-9312 -title: Beyond the streetlight # required -abstract: This repository provides an analysis of the trend in forecast errors made by the Tealbook/Greenbook(GB) and the Survey of Professional Forecasters(SPF) for measures of the unemployment rate and real growth in personal consumption expenditures from 1982 to 2017. # optional -version: 1.0.4 # optional Version of the software released -date-released: 2023-11-06 # required - -# REMARK required fields -remark-version: 1.0 # required - specify version of REMARK standard used -references: # required for replications; optional for reproductions; BibTex data from original paper - - type: article - authors: # required - - family-names: "Corrado" - given-names: "Carol" - #orcid: "https://orcid.org/XXXX-XXXX-XXXX-XXXX" - - family-names: "Kennickell" - given-names: "Arthur" - #orcid: "https://orcid.org/XXXX-XXXX-XXXX-XXXX" - title: "100 years of Economic Measurement in the Division of Research & Statistics: Beyond the streetlight" # required - #doi: "Original paper DOI" # optional - date: 2023-10-24 # required - publisher: "R&S Centennial Conference" -#repository: "URL of repository" # optional (when original paper has own repository) - -# Econ-ARK website fields -github_repo_url: https://github.com/dedwar65/beyond-the-streetlight # required -remark-name: beyond-the-streetlight # required -title-original-paper: "100 years of Economic Measurement in the Division of Research & Statistics: Beyond the streetlight" # optional -notebooks: # path to any notebooks within the repo - optional - - RS100_Discussion_Slides.ipynb - -tags: # Use the relavent tags - - REMARK - - Notebook - -keywords: # optional - - Econ-ARK - - Greenbook - - Forecast errors - ---- - -# Abstract - -This repository provides an analysis of the trend in forecast errors made by the Tealbook/Greenbook(GB) and the Survey of Professional Forecasters(SPF) for measures of the unemployment rate and real growth in personal consumption expenditures from 1982 to 2017. The data on forecasts for unemployment and consumption made by the federal reserve (Tealbook/Greenbook) and the mean across private forcasters are provided by the Philidelphia Fed. Data on realized values of the forecasted variables are provided by the St. Louis Fed. diff --git a/REMARKs/cAndCwithStickyE.md b/REMARKs/cAndCwithStickyE.md deleted file mode 100644 index cd10596d..00000000 --- a/REMARKs/cAndCwithStickyE.md +++ /dev/null @@ -1,86 +0,0 @@ ---- -# CFF required fields -cff-version: 1.1.0 # required (don't change) -authors: # required - - - family-names: "Carroll" - given-names: "Christopher D." - orcid: "https://orcid.org/0000-0003-3732-9312" - - - family-names: "Crawley" - given-names: "Edmund" - # orcid: "https://orcid.org/XXXX-XXXX-XXXX-XXXX" - - - family-names: "Slacalek" - given-names: "Jiri" - # orcid: "https://orcid.org/XXXX-XXXX-XXXX-XXXX" - - - family-names: "Kiichi" - given-names: "Tokuoka" - # orcid: "https://orcid.org/XXXX-XXXX-XXXX-XXXX" - - - family-names: "White" - given-names: "Matthew" - # orcid: "https://orcid.org/XXXX-XXXX-XXXX-XXXX" -title: "Sticky Expectations and Consumption Dynamics" # required -abstract: "Sticky Expectations and Consumption Dynamics." # abstract: optional - -# REMARK required fields -remark-version: 1.0 -references: - - type: article - authors: # required - - - family-names: "Carroll" - given-names: "Christopher D." - orcid: "https://orcid.org/0000-0003-3732-9312" - - - family-names: "Crawley" - given-names: "Edmund" - # orcid: "https://orcid.org/XXXX-XXXX-XXXX-XXXX" - - - family-names: "Slacalek" - given-names: "Jiri" - # orcid: "https://orcid.org/XXXX-XXXX-XXXX-XXXX" - - - family-names: "Kiichi" - given-names: "Tokuoka" - # orcid: "https://orcid.org/XXXX-XXXX-XXXX-XXXX" - - - family-names: "White" - given-names: "Matthew N." - # orcid: "https://orcid.org/XXXX-XXXX-XXXX-XXXX" - title: "Sticky Expectations and Consumption Dynamics" # required - doi: "https://doi.org/10.1257/mac.20180286" # optional - date: 2020-07 # required - publisher: "American Economic Journal: Macroeconomics" - -# Econ-ARK website fields -github_repo_url: https://github.com/econ-ark/cAndCwithStickyE # required -remark-name: cAndCwithStickyE # required - -tags: # Use the relavent tags - - REMARK - - Reproduction - ---- -# cAndCwithStickyE is a Reproduction - -This is a reproduction of the results in the paper "Sticky Expectations and Consumption Dynamics" by Carroll, Crawley, Slacalek, Tokuoka, and White. The [html version](http://econ.jhu.edu/people/ccarroll/papers/cAndCwithStickyE) contains links to resources including the PDF version, the presentation slides, a repo containing the paper and code, and related material - -The root directory contains three files: - -* `do_min.py` executes the representative agent version of the model -* `do_mid.py` reproduces some of the core results of the paper -* `do_all.py` reproduces all computational results in the paper - -Any of these can be run using ipython from the command line, for example: - -ipython do_min.py - -In all cases, there should be a message that indicates how long it takes to run the code on a particular computer with a particular configuration. - -## References - -Carroll, C. D., Crawley, E., Slacalek, J., Tokuoka, K., & White, M. N. (2020). Sticky expectations and consumption dynamics. American economic journal: macroeconomics, 12(3), 40-76. - diff --git a/REMARKs/ctDiscrete.md b/REMARKs/ctDiscrete.md deleted file mode 100644 index 41f8e8f5..00000000 --- a/REMARKs/ctDiscrete.md +++ /dev/null @@ -1,49 +0,0 @@ ---- -# CFF required fields -cff-version: 1.1.0 # required (don't change) -#message: If you use this software, please cite it as below. # optional -authors: # required - - family-names: "Carroll" - given-names: "Christopher D." - orcid: "https://orcid.org/0000-0003-3732-9312" -title: "A Tractable Model of Buffer Stock Saving" # required -abstract: 'Analytically tractable model of the effects of nonfinancial risk on intertemporal choice' # optional - -# REMARK required fields -remark-version: "1.0" # required - specify version of REMARK standard used -references: # required for replications; optional for reproductions; BibTex data from original paper - - type: article - authors: # required - - - family-names: "Carroll" - given-names: "Christopher D." - orcid: "https://orcid.org/0000-0003-3732-9312" - - - family-names: "Toche" - given-names: "Patrick" - # orcid: "https://orcid.org/XXXX-XXXX-XXXX-XXXX" - title: "A Tractable Model of Buffer Stock Saving" # required - doi: "https://doi.org/10.3386/w15265" # optional - date: 2009-08 # required - publisher: "NBER" - -# Econ-ARK website fields -github_repo_url: https://github.com/econ-ark/ctDiscrete # required -remark-name: ctDiscrete # required -notebooks: # path to any notebooks within the repo - optional - - Code/HARK/Examples/ctDiscrete/TractableBufferStockModel.ipynb - -tags: # Use the relavent tags - - REMARK - - Replication ---- - -# TractableBufferStockModel - -This is a replication of the results of the paper ["A Tractable Model of Buffer Stock Saving"](http://www.econ2.jhu.edu/people/ccarroll/papers/ctDiscrete.pdf) by Carroll and Toche - - -## References - -Carroll, C. D., & Toche, P. (2009). A tractable model of buffer stock saving (No. w15265). National Bureau of Economic Research. - diff --git a/REMARKs/deep-learning-euler-method-krusell-smith.md b/REMARKs/deep-learning-euler-method-krusell-smith.md deleted file mode 100644 index 405bd5ac..00000000 --- a/REMARKs/deep-learning-euler-method-krusell-smith.md +++ /dev/null @@ -1,76 +0,0 @@ ---- -# CFF required fields -cff-version: 1.2.0 -title: "Deep learning for solving dynamic economic models" -message: >- - If you use this software, please cite it using the - metadata from this file. -type: software -authors: - - given-names: Lilia - family-names: Maliar - affiliation: >- - a The Graduate Center, City University of New York, - CEPR, and Hoover Institution, Stanford University - - given-names: Serguei - family-names: Maliar - affiliation: Santa Clara University - - given-names: Pablo - family-names: Winant - affiliation: ESCP Business School and CREST/Ecole Polytechnique -identifiers: - - type: doi - value: 10.1016/j.jmoneco.2021.07.004 -abstract: >- - We introduce a unified deep learning method that solves - dynamic economic models by casting them into nonlinear - regression equations. We derive such equations for three - fundamental objects of economic dynamics – lifetime reward - functions, Bellman equations and Euler equations. We - estimate the decision functions on simulated data using a - stochastic gradient descent method. We introduce an - all-in-one integration operator that facilitates - approximation of high-dimensional integrals. We use neural - networks to perform model reduction and to handle - multicollinearity. Our deep learning method is tractable - in large-scale problems, e.g., Krusell and Smith (1998). - We provide a TensorFlow code that accommodates a variety - of applications. -keywords: - - Artificial intelligence - - Machine learning - - Deep learning - - Neural network - - Stochastic gradient - - Dynamic models - - Model reduction - - Dynamic programming - - Bellman equation - - Euler equation - - Value function -references: - - type: article - authors: - - family-names: "Krusell" - given-names: "Per" - - family-names: "Smith, Jr." - given-names: "Anthony A." - title: "Income and Wealth Heterogeneity in the Macroeconomy" - doi: "10.1086/250034" - date-released: 1998-10-01 - publisher: - name: "Journal of Political Economy" - -# REMARK fields -remark-version: "v1.0.0" -remark-name: "DeepLearningKrusselSmith" -github_repo_url: https://github.com/marcmaliar/deep-learning-euler-method-krusell-smith/ -notebooks: - - code/python/Main_KS.ipynb ---- - -# Deep learning for solving dynamic economic models - -This notebook solves a version of Krusell and Smith's (1998) heterogenous-agent model with idiosyncrastic and aggregate shocks, incomplete markets and borrowing constraints. It uses a deep learning Euler-equation method introduced by Maliar, Maliar and Winant (2018) in the paper "Deep learning for solving dynamic economic models", Journal of Monetary Economics 122, pp 76-101. https://lmaliar.ws.gc.cuny.edu/files/2021/09/JME2021.pdf - -We show a version of the Euler equation method that minimizes the sum of squared residuals in the equilibrium conditions. See [https://deepecon.org](https://deepecon.org) for documentation, updates and the other versions of the deep learning method (Bellman equation and life-time reward). diff --git a/REMARKs/template.md b/REMARKs/template.md deleted file mode 100644 index 0190322b..00000000 --- a/REMARKs/template.md +++ /dev/null @@ -1,77 +0,0 @@ ---- -# CFF required fields -cff-version: 1.1.0 # required (don't change) -message: If you use this software, please cite it as below. # optional -authors: # required - - family-names: Holmes - given-names: Mycroft - orcid: "https://orcid.org/XXXX-XXXX-XXXX-XXXX" -title: My Research Tool Example # required -abstract: Replication of Paper X # optional -version: 1.0.4 # optional Version of the software released -date-released: 2017-12-18 # required - -# REMARK required fields -remark-version: "" # required - specify version of REMARK standard used -references: # required for replications; optional for reproductions; BibTex data from original paper - - type: article - authors: # required - - - family-names: "Author 1 Last Name" - given-names: "Author 1 First Name" - orcid: "https://orcid.org/XXXX-XXXX-XXXX-XXXX" - - - family-names: "Author 2 Last Name" - given-names: "Author 2 First Name" - orcid: "https://orcid.org/XXXX-XXXX-XXXX-XXXX" - title: "Title of original paper" # required - doi: "Original paper DOI" # optional - date: 20XX-XX-XX # required - publisher: "Publisher information" -repository: "URL of repository" # optional (when original paper has own repository) - -# Econ-ARK website fields -github_repo_url: Link to git repo hosting the code # required -remark-name: template # required -title-original-paper: Name of the paper if available # optional -notebooks: # path to any notebooks within the repo - optional - - path_to_notebook.ipynb - -dashboards: # path to any dashboards within the repo - optional - - - path_to_dashboard.ipynb -identifiers-paper: # required for Replications; optional for Reproductions - - - type: url - value: template - - - type: doi - value: doi:template -date-published-original-paper: 2020-09-14 # required for Replications; optional for Reproductions - -tags: # Use the relavent tags - - REMARK - - Notebook - -identifiers: # optional - - - type: url - value: "URL to project page" - - - type: doi - value: "DOI link if available" - -keywords: # optional - - Econ-ARK - - Sample - - Template - ---- - -# Template metadata for REMARKs - -Abstract - -## References - -Reference in APA style diff --git a/cli.py b/cli.py index dd30adc7..7adcc3b6 100644 --- a/cli.py +++ b/cli.py @@ -7,6 +7,7 @@ from json import loads from os import getenv import re +from shutil import rmtree from yaml import safe_load from yaml.scanner import ScannerError @@ -21,6 +22,12 @@ from subprocess import run, PIPE, STDOUT from urllib.parse import urlsplit +def concrete_path(path): + p = Path(path) + if not p.exists(): + raise ValueError(f'{path} does not exist!') + return p + @dataclass class Metadata: remote: str @@ -36,6 +43,18 @@ def flat(self): del d['yaml'] return d +def add_remark_arg_group(subparser, required=True): + group = subparser.add_mutually_exclusive_group(required=required) + group.add_argument( + 'remark', + default=[], + nargs='*', + type=concrete_path, + help='path(s) to REMARK metadata files (located under REMARKs/*.yml).' + ) + group.add_argument('--all', action='store_true', help='pull/clone all REMARKs found in REMARKs/*.md') + return group + def parse_paths_from_standard(text): lines = text.splitlines() @@ -43,6 +62,8 @@ def parse_paths_from_standard(text): d = Path() for prev, cur in zip(*(islice(it, i, None) for i, it in enumerate(tee(lines, 2)))): + if not cur.strip() or cur.startswith('#'): + continue _, _, prev_part = prev.partition('--') _, _, cur_part = cur.partition('--') cur_part, prev_part = cur_part.strip(), prev_part.strip() @@ -71,22 +92,17 @@ def git_clone(local_repo_path, *, remote): ['git', 'clone', '--depth', '1', '--single-branch', remote, local_repo_path] ) -def git_pull(local_repo_path, *, remote_name=None): +def git_pull(local_repo_path): return run(['git', 'pull'], cwd=local_repo_path) -def git_update_remotes(local_repo_path, *, remote_dict): - returns = {} - for name, url in remote_dict.items(): - returns[name] = run(['git', 'remote', 'set-url', name, url], cwd=local_repo_path) - if returns[name].returncode != 0: - returns[name] = run(['git', 'remote', 'add', name, url], cwd=local_repo_path) - return returns +def git_checkout(local_repo_path, *, identifier): + return run(['git', 'checkout', identifier], cwd=local_repo_path) def build_docker(local_repo, image_name): cmd = ['repo2docker', '--no-run', '--image-name', image_name, local_repo.resolve()] return run(cmd, stdout=PIPE, stderr=STDOUT, encoding='utf-8') -def execute_docker(local_repo, image_name): +def execute_docker(local_repo, image_name, script): # repo2docker names the Python execution conda environment: "kernel" | "notebook" # kernel is used if the notebook env has incompat libraries or Python version # notebook should be used in other cases. @@ -111,7 +127,7 @@ def execute_docker(local_repo, image_name): cmd_prefix = [] return run( - [*docker_prefix, *cmd_prefix, 'bash', './reproduce.sh'], + [*docker_prefix, *cmd_prefix, 'bash', script], stdout=PIPE, stderr=STDOUT, encoding='utf-8' ) @@ -120,19 +136,19 @@ def clean_docker(image_name): return run(cmd, encoding='utf-8') def build_conda(local_repo): - cmd = ['conda', 'env', 'update', '-f', 'binder/environment.yml', '--prefix', './condaenv'] + cmd = ['conda', 'env', 'update', '-f', 'binder/environment.yml', '--prefix', './.condaenv'] proc = run(cmd, stdout=PIPE, stderr=STDOUT, encoding='utf-8', cwd=local_repo) if proc.returncode == 0: - with open(local_repo / 'condaenv' / '.gitignore', 'w') as f: + with open(local_repo / '.condaenv' / '.gitignore', 'w') as f: f.write('*') return proc -def execute_conda(local_repo): - cmd = ['conda', 'run', '-p', './condaenv', getenv('SHELL', default='/bin/bash'), 'reproduce.sh'] +def execute_conda(local_repo, script): + cmd = ['conda', 'run', '-p', './.condaenv', getenv('SHELL', default='/bin/bash'), script] return run(cmd, stdout=PIPE, stderr=STDOUT, encoding='utf-8', cwd=local_repo) def clean_conda(local_repo): - cmd = ['conda', 'env', 'remove', '--prefix', './condaenv', '--yes', '--quiet'] + cmd = ['conda', 'env', 'remove', '--prefix', './.condaenv', '--yes', '--quiet'] return run(cmd, encoding='utf-8', cwd=local_repo) if __name__ == '__main__': @@ -149,7 +165,8 @@ def clean_conda(local_repo): for p in git_root.joinpath('REMARKs').glob('*.yml'): with open(p) as f: data = safe_load(f) - metadata[p.stem] = Metadata( + data['name'] = p.stem + metadata[p.relative_to(git_root)] = Metadata( local=repo_home / data['name'], remote=data['remote'], yaml=data, @@ -159,73 +176,72 @@ def clean_conda(local_repo): subparsers = parser.add_subparsers(dest='action') # pull/fetch - pull_parser = subparsers.add_parser('pull') - pull_group = pull_parser.add_mutually_exclusive_group(required=True) - pull_group.add_argument('remark', default=[], nargs='*') - pull_group.add_argument('--all', action='store_true') - + pull_parser = subparsers.add_parser('pull', help='clone/pulls REMARK github repositories locally') + add_remark_arg_group(pull_parser) # lint - lint_parser = subparsers.add_parser('lint') - lint_group = lint_parser.add_mutually_exclusive_group(required=True) - lint_group.add_argument('remark', nargs='*', default=[]) - lint_group.add_argument('--all', action='store_true') - + lint_parser = subparsers.add_parser('lint', help='check compatibility of REMARK repositories against STANDARD.md') + add_remark_arg_group(lint_parser) + lint_parser.add_argument('--include-optional', action='store_true', help='include optional files when checking against STANDARD.md') # build - build_parser = subparsers.add_parser('build') + build_parser = subparsers.add_parser('build', help='build docker images/conda environments for REMARK repositories') build_parser.add_argument('type', choices=['docker', 'conda']) build_parser.add_argument('--jobs', '-J', default=4, type=int) - - build_group = build_parser.add_mutually_exclusive_group(required=True) - build_group.add_argument('remark', default=[], nargs='*') - build_group.add_argument('--all', action='store_true') - + add_remark_arg_group(build_parser) # execute - execute_parser = subparsers.add_parser('execute') - execute_parser.add_argument('type', choices=['docker', 'conda']) - execute_parser.add_argument('--jobs', '-J', default=4, type=int) - - execute_group = execute_parser.add_mutually_exclusive_group(required=True) - execute_group.add_argument('remark', default=[], nargs='*') - execute_group.add_argument('--all', action='store_true') + execute_parser = subparsers.add_parser('execute', help='execute REMARK reproduce_min.sh (falling back to reproduce.sh) within their built environments') + execute_parser.add_argument('type', choices=['docker', 'conda'], help='execute within a built docker image or a conda environment') + execute_parser.add_argument('--jobs', '-J', default=4, type=int, help='number of REMARKs to execute in parallel') + execute_parser.add_argument('--no-min', action='store_true', help='ignore reproduce_min.sh') + add_remark_arg_group(execute_parser) # log - log_parser = subparsers.add_parser('logs') + log_parser = subparsers.add_parser('logs', help='show most recent return codes from previous build/execute attempt') + add_remark_arg_group(log_parser) # clean - clean_parser = subparsers.add_parser('clean') - clean_parser.add_argument('type', choices=['docker', 'conda']) - - clean_group = clean_parser.add_mutually_exclusive_group(required=True) - clean_group.add_argument('remark', default=[], nargs='*') - clean_group.add_argument('--all', action='store_true') + clean_parser = subparsers.add_parser('clean', help='remove build environments') + clean_parser.add_argument('type', choices=['repo', 'docker', 'conda']) + add_remark_arg_group(clean_parser) args = parser.parse_args() - if args.action == 'pull': to_pull = metadata.keys() if args.all else args.remark - for name in to_pull: - mdata = metadata[name] - print(f'Updating {name} @ {mdata.local}') + for path in to_pull: + mdata = metadata[path] + print(f'Updating {path} @ {mdata.local}') if git_exists(mdata.local): git_pull(mdata.local) else: git_clone(mdata.local, remote=mdata.remote) + + if 'tag' in mdata.yaml: + git_checkout(mdata.local, identifier=f'tags/{mdata.yaml["tag"]}') print('-' * 20, end='\n\n') elif args.action == 'lint': to_lint = metadata.keys() if args.all else args.remark with open(git_root / 'STANDARD.md') as f: standard = re.search( - f'## the remark standard.*```(.*?)```', + f'```\n\..*?```', f.read(), flags=re.I | re.DOTALL - ).group(1).strip() - requirements = [*parse_paths_from_standard(standard)] - for remark in to_lint: - mdata = metadata[remark] + ).group(0).strip('`').strip() + + if args.include_optional: + requirements = [ + p.with_name(p.name.rstrip('?')) for p in parse_paths_from_standard(standard) + ] + else: + requirements = [ + p for p in parse_paths_from_standard(standard) + if not p.name.endswith('?') + ] + + for path in to_lint: + mdata = metadata[path] messages = [] for req in requirements: @@ -234,7 +250,7 @@ def clean_conda(local_repo): if messages: print( - f' {remark} '.center(50, '-'), + f' {path} '.center(50, '-'), mdata.local, *(f'- {m}' for m in messages), sep='\n', @@ -244,11 +260,7 @@ def clean_conda(local_repo): elif args.action == 'build': report_dir = remark_home / 'logs' / 'build' report_dir.mkdir(exist_ok=True, parents=True) - - if args.remark: - to_build = args.remark - elif args.all: - to_build = metadata.keys() + to_build = metadata.keys() if args.all else args.remark with ThreadPoolExecutor(min(len(to_build), args.jobs)) as pool: def submitter(name): @@ -260,15 +272,14 @@ def wrapper(*args, **kwargs): return _submitter futures = {} - for name in to_build: - mdata = metadata[name] + for path in to_build: + mdata = metadata[path] if args.type == 'docker': - fut = submitter(name)(build_docker, mdata.local, mdata.image_name) + fut = submitter(path)(build_docker, mdata.local, mdata.image_name) elif args.type == 'conda': - fut = submitter(name)(build_conda, mdata.local) + fut = submitter(path)(build_conda, mdata.local) futures[fut] = (mdata, args.type) - for comp in as_completed(futures): mdata, build_type = futures[comp] proc = comp.result() @@ -288,27 +299,36 @@ def wrapper(*args, **kwargs): elif args.action == 'execute': report_dir = remark_home / 'logs' / 'execute' report_dir.mkdir(exist_ok=True, parents=True) - if args.remark: - to_build = args.remark - elif args.all: - to_build = metadata.keys() + to_execute = metadata.keys() if args.all else args.remark with ThreadPoolExecutor(min(len(to_build), args.jobs)) as pool: - def submitter(name): + def submitter(path): def _submitter(func, *args, **kwargs): def wrapper(*args, **kwargs): - print(f'Executing {name}') + print(f'Executing {path}') return func(*args, **kwargs) return pool.submit(wrapper, *args, **kwargs) return _submitter futures = {} - for name in to_build: - mdata = metadata[name] + for path in to_build: + mdata = metadata[path] + script = 'reproduce.sh' + if (mdata.local / 'reproduce_min.sh').exists() and not args.no_min: + script = 'reproduce_min.sh' if args.type == 'docker': - fut = submitter(name)(execute_docker, mdata.local, mdata.image_name) + fut = submitter(path)( + execute_docker, + local_repo=mdata.local, + image_name=mdata.image_name, + script=script + ) elif args.type == 'conda': - fut = submitter(name)(execute_conda, mdata.local) + fut = submitter(path)( + execute_conda, + local_repo=mdata.local, + script=script + ) futures[fut] = (mdata, args.type) @@ -330,28 +350,27 @@ def wrapper(*args, **kwargs): elif args.action == 'logs': results = defaultdict(lambda: defaultdict(dict)) - padding = max(len(k) for k in metadata.keys()) - for name in metadata.keys(): + padding = max(len(str(k)) for k in metadata.keys()) + for path in metadata.keys(): + name = path.stem report_dir = remark_home / 'logs' for log_file in sorted(report_dir.glob(f'*/*{name}*_rc.log')): name, log_type, _ = log_file.name.rsplit('_', maxsplit=2) - results[log_file.parent.name][name][log_type] = log_file.read_text() + results[log_file.parent.name][name][log_type] = log_file.read_text().strip() for log_type, logs in results.items(): - padding = max(len(k) for k in logs) + padding = max(len(str(k)) for k in logs) print(f'{log_type:-^{padding}}') for name, rc in logs.items(): print(f'{name: <{padding}} = {rc}') elif args.action == 'clean': - if args.remark: - to_build = args.remark - elif args.all: - to_build = metadata.keys() - - for name in to_build: + to_clean = metadata.keys() if args.all else args.remark + for name in to_clean: mdata = metadata[name] - if args.type == 'docker': + if args.type == 'repo': + rmtree(mdata.local) + elif args.type == 'docker': clean_docker(mdata.image_name) elif args.type == 'conda': clean_conda(mdata.local)