├── README.md ├── Courses ├── Lectures-04 │ └── HA-Macro-OSM │ │ └── syllabus │ │ └── syllabus.pdf ├── HA-Macro │ ├── 2019-07-Budapest │ │ └── syllabus │ │ │ ├── Syllabus.pdf │ │ │ ├── Other │ │ │ └── readingvgse.pdf │ │ │ ├── Syllabus.css │ │ │ └── Syllabus.md │ └── 2020-01-Oslo │ │ └── syllabus │ │ ├── Syllabus-Oslo.pdf │ │ └── Syllabus-Oslo.md └── Lectures-05 │ └── HA-Macro-Goethe-SAFE │ └── syllabus │ └── syllabus.pdf ├── Assignments ├── PerfectForesightCRRA-Impatience.txt.txt ├── PerfectForesightCRRA-Impatience.md └── TractableBufferStock-Interactive-Problems.md ├── .gitignore ├── LICENSE └── notebooks ├── PerfForesightCRRA-Impatience-Solutions - Jamie.ipynb ├── TractableBufferStock-Interactive-Problems.ipynb ├── TractableBufferStock-Interactive-Solutions-Jamie.ipynb └── PerfForesightCRRA-Impatience-Problems.ipynb /README.md: -------------------------------------------------------------------------------- 1 | # TITLARK 2 | Teaching and Instructional Tools for Learning the ARK 3 | -------------------------------------------------------------------------------- /Courses/Lectures-04/HA-Macro-OSM/syllabus/syllabus.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jamie-L-Cross/TITLARK/master/Courses/Lectures-04/HA-Macro-OSM/syllabus/syllabus.pdf -------------------------------------------------------------------------------- /Courses/HA-Macro/2019-07-Budapest/syllabus/Syllabus.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jamie-L-Cross/TITLARK/master/Courses/HA-Macro/2019-07-Budapest/syllabus/Syllabus.pdf -------------------------------------------------------------------------------- /Courses/HA-Macro/2020-01-Oslo/syllabus/Syllabus-Oslo.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jamie-L-Cross/TITLARK/master/Courses/HA-Macro/2020-01-Oslo/syllabus/Syllabus-Oslo.pdf -------------------------------------------------------------------------------- /Courses/Lectures-05/HA-Macro-Goethe-SAFE/syllabus/syllabus.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jamie-L-Cross/TITLARK/master/Courses/Lectures-05/HA-Macro-Goethe-SAFE/syllabus/syllabus.pdf -------------------------------------------------------------------------------- /Courses/HA-Macro/2019-07-Budapest/syllabus/Other/readingvgse.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jamie-L-Cross/TITLARK/master/Courses/HA-Macro/2019-07-Budapest/syllabus/Other/readingvgse.pdf -------------------------------------------------------------------------------- /Assignments/PerfectForesightCRRA-Impatience.txt.txt: -------------------------------------------------------------------------------- 1 | # Effects of 'Impatience' On Consumption Function 2 | 3 | The notebook [PerfForesightCRRA-Impatience-Problems](https://github.com/econ-ark/QuARK/blob/master/notebooks/PerfForesightCRRA-Impatience-Problems.ipynb) asks you to explore the relationship between various impatience factors and the consumption function. 4 | 5 | In your [Virtual Machine](https://github.com/econ-ark/econ-ark-tools/tree/master/Virtual/Machine/VirtualBox), your assignment is: 6 | 7 | 1. Change to the `GitHub/econ-ark` directory 8 | 1. `git clone https://github.com/econ-ark/TITLARK` to get the teaching tools repo 9 | 1. `cd TITLARK/notebooks` 10 | 1. Obtain a local copy of the notebook. Options: 11 | 1. Go to the link above, and click 'Raw' to see a text version; then "Save As ..." text to `TITLARK/notebooks` 12 | 1. `curl -L https://raw.githubusercontent.com/econ-ark/QuARK/master/notebooks/PerfForesightCRRA-Impatience-Problems.ipynb` 13 | 1. Make a copy of the notebook to put your solutions in: 14 | * `cp PerfForesightCRRA-Impatience-Problems.ipynb PerfForesightCRRA-Impatience-Problems-And-Solutions.ipynb` 15 | 1. From the command line, 16 | * launch a `jupyter notebook` 17 | * read through your `-And-Solutions` copy of the notebook 18 | * after any code cell containing `# PROBLEM`: 19 | * You should create a code cell that begins with the text `# SOLUTION` 20 | * These should contain your code for answering the corresponding question -------------------------------------------------------------------------------- /Assignments/PerfectForesightCRRA-Impatience.md: -------------------------------------------------------------------------------- 1 | # Effects of 'Impatience' On Consumption Function 2 | 3 | The notebook [PerfForesightCRRA-Impatience-Problems](https://github.com/econ-ark/QuARK/blob/master/notebooks/PerfForesightCRRA-Impatience-Problems.ipynb) asks you to explore the relationship between various impatience factors and the consumption function. 4 | 5 | In your [Virtual Machine](https://github.com/econ-ark/econ-ark-tools/tree/master/Virtual/Machine/VirtualBox), your assignment is: 6 | 7 | 1. Change to the `GitHub/econ-ark` directory 8 | 1. `git clone https://github.com/econ-ark/TITLARK` to get the teaching tools repo 9 | 1. `cd TITLARK/notebooks` 10 | 1. Obtain a local copy of the notebook. Options: 11 | 1. Go to the link above, and click 'Raw' to see a text version; then "Save As ..." text to `TITLARK/notebooks` 12 | 1. `curl -L https://raw.githubusercontent.com/econ-ark/QuARK/master/notebooks/PerfForesightCRRA-Impatience-Problems.ipynb > PerfForesightCRRA-Impatience-Problems.ipynb` 13 | 1. Make a copy of the notebook to put your solutions in: 14 | * `cp PerfForesightCRRA-Impatience-Problems.ipynb PerfForesightCRRA-Impatience-Problems-And-Solutions.ipynb` 15 | 1. From the command line, 16 | * launch a `jupyter notebook` 17 | * read through your `-And-Solutions` copy of the notebook 18 | * after any code cell containing `# PROBLEM`: 19 | * You should create a code cell that begins with the text `# SOLUTION` 20 | * These should contain your code for answering the corresponding question 21 | -------------------------------------------------------------------------------- /Assignments/TractableBufferStock-Interactive-Problems.md: -------------------------------------------------------------------------------- 1 | # What Happens As the GIF Approaches Its Limit? 2 | 3 | (If you do not yet have a fork of TITLARK on your virtual machine, you might want to read the [instructions here](https://github.com/econ-ark/HARK/blob/master/doc/guides/contributing/issues.md#linking-your-fork-to-your-local-clone) which cover a slightly different case -- for making contributions to the HARK repo -- but it should be easy to translate to TITLARK) 4 | 5 | Your assignment is: 6 | 7 | 1. Update your local fork of the TITLARK repo 8 | * Google should tell you the commands you need to use 9 | * The term for the original repo, is the "upstream" repo 10 | * If you can't figure out how to do this, you can 11 | 1. Delete the original fork from last week 12 | 1. Make a new fork 13 | * Please do NOT make a new fork without first deleting your original 14 | * GitHub keeps track of all the forks 15 | * It becomes hopelessly confusing if one person has several forks 16 | 1. In TITLARK/notebooks you will find `TractableBufferStock-Interactive-Problems.ipynb` 17 | 1. Make a branch called '[your-github-username]TractableSolution' 18 | * if I were a student: `git checkout -b ccarrollATjhueconTractableSolution` 19 | 1. In the branch, make a copy and make it writeable: 20 | * `cp TractableBufferStock-Interactive-Problems.ipynb TractableBufferStock-Interactive-Solutions.ipynb` 21 | * `chmod u+w TractableBufferStock-Interactive-Solutions.ipynb` 22 | 1. Open the notebook 23 | * `jupyter notebook` from the command line in the notebooks directory 24 | 1. Read through this notebook, and solve the problem at the end 25 | 1. When you have finished solving the problem: 26 | 1. "push" your local copy to the your "remote" version of the fork on GitHub.com 27 | 1. From your GitHub.com account, issue a "pull request" to the upstream master 28 | -------------------------------------------------------------------------------- /Courses/HA-Macro/2019-07-Budapest/syllabus/Syllabus.css: -------------------------------------------------------------------------------- 1 | 2 | /* start css.sty */ 3 | .ecti-1200{ font-style: italic;} 4 | .ecti-1200{ font-style: italic;} 5 | .ecti-1200{ font-style: italic;} 6 | .ecti-1200{ font-style: italic;} 7 | .ecrm-2074{font-size:166%;} 8 | .ectt-1200{ font-family: monospace;} 9 | .ectt-1200{ font-family: monospace;} 10 | .ectt-1200{ font-family: monospace;} 11 | .ectt-1200{ font-family: monospace;} 12 | .small-caps{font-variant: small-caps; } 13 | p.noindent { text-indent: 0em } 14 | td p.noindent { text-indent: 0em; margin-top:0em; } 15 | p.nopar { text-indent: 0em; } 16 | p.indent{ text-indent: 1.5em } 17 | @media print {div.crosslinks {visibility:hidden;}} 18 | a img { border-top: 0; border-left: 0; border-right: 0; } 19 | center { margin-top:1em; margin-bottom:1em; } 20 | td center { margin-top:0em; margin-bottom:0em; } 21 | .Canvas { position:relative; } 22 | img.math{vertical-align:middle;} 23 | li p.indent { text-indent: 0em } 24 | li p:first-child{ margin-top:0em; } 25 | li p:last-child, li div:last-child { margin-bottom:0.5em; } 26 | li p~ul:last-child, li p~ol:last-child{ margin-bottom:0.5em; } 27 | .enumerate1 {list-style-type:decimal;} 28 | .enumerate2 {list-style-type:lower-alpha;} 29 | .enumerate3 {list-style-type:lower-roman;} 30 | .enumerate4 {list-style-type:upper-alpha;} 31 | div.newtheorem { margin-bottom: 2em; margin-top: 2em;} 32 | .obeylines-h,.obeylines-v {white-space: nowrap; } 33 | div.obeylines-v p { margin-top:0; margin-bottom:0; } 34 | .overline{ text-decoration:overline; } 35 | .overline img{ border-top: 1px solid black; } 36 | td.displaylines {text-align:center; white-space:nowrap;} 37 | .centerline {text-align:center;} 38 | .rightline {text-align:right;} 39 | div.pic-tabular {text-align:center;} 40 | div.verbatim {font-family: monospace; white-space: nowrap; text-align:left; clear:both; } 41 | .fbox {padding-left:3.0pt; padding-right:3.0pt; text-indent:0pt; border:solid black 0.4pt; } 42 | div.fbox {display:table} 43 | div.center div.fbox {text-align:center; clear:both; padding-left:3.0pt; padding-right:3.0pt; text-indent:0pt; border:solid black 0.4pt; } 44 | div.minipage{width:100%;} 45 | div.center, div.center div.center {text-align: center; margin-left:1em; margin-right:1em;} 46 | div.center div {text-align: left;} 47 | div.flushright, div.flushright div.flushright {text-align: right;} 48 | div.flushright div {text-align: left;} 49 | div.flushleft {text-align: left;} 50 | .underline{ text-decoration:underline; } 51 | .underline img{ border-bottom: 1px solid black; margin-bottom:1pt; } 52 | .framebox-c, .framebox-l, .framebox-r { padding-left:3.0pt; padding-right:3.0pt; text-indent:0pt; border:solid black 0.4pt; } 53 | .framebox-c {text-align:center;} 54 | .framebox-l {text-align:left;} 55 | .framebox-r {text-align:right;} 56 | span.thank-mark{ vertical-align: super } 57 | span.footnote-mark sup.textsuperscript, span.footnote-mark a sup.textsuperscript{ font-size:80%; } 58 | td p:first-child{ margin-top:0em; } 59 | td p:last-child{ margin-bottom:0em; } 60 | div.td00{ margin-left:0pt; margin-right:0pt; } 61 | div.td01{ margin-left:0pt; margin-right:5pt; } 62 | div.td10{ margin-left:5pt; margin-right:0pt; } 63 | div.td11{ margin-left:5pt; margin-right:5pt; } 64 | table[rules] {border-left:solid black 0.4pt; border-right:solid black 0.4pt; } 65 | td.td00{ padding-left:0pt; padding-right:0pt; } 66 | td.td01{ padding-left:0pt; padding-right:5pt; } 67 | td.td10{ padding-left:5pt; padding-right:0pt; } 68 | td.td11{ padding-left:5pt; padding-right:5pt; } 69 | table[rules] {border-left:solid black 0.4pt; border-right:solid black 0.4pt; } 70 | .hline hr, .cline hr{ height : 1px; margin:0px; } 71 | .tabbing-right {text-align:right;} 72 | span.TEX {letter-spacing: -0.125em; } 73 | span.TEX span.E{ position:relative;top:0.5ex;left:-0.0417em;} 74 | a span.TEX span.E {text-decoration: none; } 75 | span.LATEX span.A{ position:relative; top:-0.5ex; left:-0.4em; font-size:85%;} 76 | span.LATEX span.TEX{ position:relative; left: -0.4em; } 77 | div.float, div.figure {margin-left: auto; margin-right: auto;} 78 | div.float img {text-align:center;} 79 | div.figure img {text-align:center;} 80 | .marginpar {width:20%; float:right; text-align:left; margin-left:auto; margin-top:0.5em; font-size:85%; text-decoration:underline;} 81 | .marginpar p{margin-top:0.4em; margin-bottom:0.4em;} 82 | table.equation {width:100%;} 83 | .equation td{text-align:center; } 84 | td.equation { margin-top:1em; margin-bottom:1em; } 85 | td.equation-label { width:5%; text-align:center; } 86 | div.pic-eqnarray {text-align:center;} 87 | div.pic-eqnarray-star {text-align:center;} 88 | div.pmatrix {text-align:center;} 89 | table.pmatrix {width:100%;} 90 | div.pic-array {text-align:center;} 91 | span.pmatrix img{vertical-align:middle;} 92 | div.pmatrix {text-align:center;} 93 | table.pmatrix {width:100%;} 94 | span.bar-css {text-decoration:overline;} 95 | img.cdots{vertical-align:middle;} 96 | .partToc a, .partToc, .likepartToc a, .likepartToc {line-height: 200%; font-weight:bold; font-size:110%;} 97 | .index-item, .index-subitem, .index-subsubitem {display:block} 98 | div.caption {text-indent:-2em; margin-left:3em; margin-right:1em; text-align:left;} 99 | div.caption span.id{font-weight: bold; white-space: nowrap; } 100 | h1.partHead{text-align: center} 101 | p.bibitem { text-indent: -2em; margin-left: 2em; margin-top:0.6em; margin-bottom:0.6em; } 102 | p.bibitem-p { text-indent: 0em; margin-left: 2em; margin-top:0.6em; margin-bottom:0.6em; } 103 | .paragraphHead, .likeparagraphHead { margin-top:2em; font-weight: bold;} 104 | .subparagraphHead, .likesubparagraphHead { font-weight: bold;} 105 | .quote {margin-bottom:0.25em; margin-top:0.25em; margin-left:1em; margin-right:1em; text-align:justify;} 106 | .verse{white-space:nowrap; margin-left:2em} 107 | div.maketitle {text-align:center;} 108 | h2.titleHead{text-align:center;} 109 | div.maketitle{ margin-bottom: 2em; } 110 | div.author, div.date {text-align:center;} 111 | div.thanks{text-align:left; margin-left:10%; font-size:85%; font-style:italic; } 112 | div.author{white-space: nowrap;} 113 | .quotation {margin-bottom:0.25em; margin-top:0.25em; margin-left:1em; } 114 | .abstract p {margin-left:5%; margin-right:5%;} 115 | div.abstract {width:100%;} 116 | span.footnote-mark sup.textsuperscript, span.footnote-mark a sup.textsuperscript{ font-size:80%; } 117 | div.verbatiminput {font-family: monospace; white-space: nowrap; } 118 | .equation td{text-align:center; } 119 | .equation-star td{text-align:center; } 120 | table.equation-star { width:100%; } 121 | table.equation { width:100%; } 122 | div.align {text-align: center;} 123 | table.multline, table.multline-star {width:100%;} 124 | td.gather {text-align:center; } 125 | table.gather {width:100%;} 126 | div.gather-star {text-align:center;} 127 | td p:first-child{ margin-top:0em; } 128 | td p:last-child{ margin-bottom:0em; } 129 | div.td00{ margin-left:0pt; margin-right:0pt; } 130 | div.td01{ margin-left:0pt; margin-right:5pt; } 131 | div.td10{ margin-left:5pt; margin-right:0pt; } 132 | div.td11{ margin-left:5pt; margin-right:5pt; } 133 | table[rules] {border-left:solid black 0.4pt; border-right:solid black 0.4pt; } 134 | td.td00{ padding-left:0pt; padding-right:0pt; } 135 | td.td01{ padding-left:0pt; padding-right:5pt; } 136 | td.td10{ padding-left:5pt; padding-right:0pt; } 137 | td.td11{ padding-left:5pt; padding-right:5pt; } 138 | table[rules] {border-left:solid black 0.4pt; border-right:solid black 0.4pt; } 139 | .hline hr, .cline hr{ height : 1px; margin:0px; } 140 | table.boxedverbatim {width:100%;} 141 | pre.boxedverbatim{border:solid 1px; padding-right:1em;} 142 | table.boxedverbatim {text-align:center;} 143 | .listinginput p{ margin-bottom:0em; margin-top:0em; } 144 | span.accentset span.accent{font-size:80%; position:relative; top:-1.7ex; left:-0.6em;} 145 | span.underaccent span.accent{font-size:80%; position:relative; top:1.6ex; left:-0.6em;} 146 | .uline{ text-decoration:underline; } 147 | .uuline{ text-decoration:underline; } 148 | span.sout {text-decoration: line-through } 149 | span.xout {text-decoration: line-through } 150 | span.uwave {text-decoration:underline } 151 | .underline-d{ border-bottom: 3px double black; margin-bottom:1pt; } 152 | .rotatebox{display: inline-block;} 153 | .figure img.graphics {margin-left:10%;} 154 | .lstlisting .label{margin-right:0.5em; } 155 | div.lstlisting{font-family: monospace; white-space: nowrap; margin-top:0.5em; margin-bottom:0.5em; } 156 | div.lstinputlisting{ font-family: monospace; white-space: nowrap; } 157 | .lstinputlisting .label{margin-right:0.5em;} 158 | div.caption {text-align:left;font-size:83%;text-indent:0em; margin-left:2em; margin-right:2em; } 159 | div.caption span.id{font-variant: small-caps; white-space: nowrap; } 160 | .figure div.caption{text-align: center;} 161 | div.figure{text-align:center;clear:both;overflow:auto;width:100%;margin-bottom:1em;} 162 | div.float{text-align:center;clear:both;overflow:auto;width:100%;margin-bottom:1em;} 163 | .table div.caption{text-align: center;} 164 | div.table{text-align:center;clear:both;overflow:auto;width:100%;margin-bottom:1em;} 165 | .subfigure img{display:block; margin-left:auto; margin-right:auto} 166 | /* end css.sty */ 167 | 168 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | 2 | # Created by https://www.gitignore.io/api/latex,emacs,macos,python,ipython 3 | # Edit at https://www.gitignore.io/?templates=latex,emacs,macos,python,ipython 4 | 5 | ### Emacs ### 6 | # -*- mode: gitignore; -*- 7 | *~ 8 | \#*\# 9 | /.emacs.desktop 10 | /.emacs.desktop.lock 11 | *.elc 12 | auto-save-list 13 | tramp 14 | .\#* 15 | 16 | # Org-mode 17 | .org-id-locations 18 | *_archive 19 | 20 | # flymake-mode 21 | *_flymake.* 22 | 23 | # eshell files 24 | /eshell/history 25 | /eshell/lastdir 26 | 27 | # elpa packages 28 | /elpa/ 29 | 30 | # reftex files 31 | *.rel 32 | 33 | # AUCTeX auto folder 34 | /auto/ 35 | 36 | # cask packages 37 | .cask/ 38 | dist/ 39 | 40 | # Flycheck 41 | flycheck_*.el 42 | 43 | # server auth directory 44 | /server/ 45 | 46 | # projectiles files 47 | .projectile 48 | 49 | # directory configuration 50 | .dir-locals.el 51 | 52 | # network security 53 | /network-security.data 54 | 55 | 56 | #!! ERROR: ipython is undefined. Use list command to see defined gitignore types !!# 57 | 58 | ### LaTeX ### 59 | ## Core latex/pdflatex auxiliary files: 60 | *.aux 61 | *.lof 62 | *.log 63 | *.lot 64 | *.fls 65 | *.out 66 | *.toc 67 | *.fmt 68 | *.fot 69 | *.cb 70 | *.cb2 71 | .*.lb 72 | 73 | ## Intermediate documents: 74 | *.dvi 75 | *.xdv 76 | *-converted-to.* 77 | # these rules might exclude image files for figures etc. 78 | # *.ps 79 | # *.eps 80 | # *.pdf 81 | 82 | ## Generated if empty string is given at "Please type another file name for output:" 83 | .pdf 84 | 85 | ## Bibliography auxiliary files (bibtex/biblatex/biber): 86 | *.bbl 87 | *.bcf 88 | *.blg 89 | *-blx.aux 90 | *-blx.bib 91 | *.run.xml 92 | 93 | ## Build tool auxiliary files: 94 | *.fdb_latexmk 95 | *.synctex 96 | *.synctex(busy) 97 | *.synctex.gz 98 | *.synctex.gz(busy) 99 | *.pdfsync 100 | 101 | ## Build tool directories for auxiliary files 102 | # latexrun 103 | latex.out/ 104 | 105 | ## Auxiliary and intermediate files from other packages: 106 | # algorithms 107 | *.alg 108 | *.loa 109 | 110 | # achemso 111 | acs-*.bib 112 | 113 | # amsthm 114 | *.thm 115 | 116 | # beamer 117 | *.nav 118 | *.pre 119 | *.snm 120 | *.vrb 121 | 122 | # changes 123 | *.soc 124 | 125 | # comment 126 | *.cut 127 | 128 | # cprotect 129 | *.cpt 130 | 131 | # elsarticle (documentclass of Elsevier journals) 132 | *.spl 133 | 134 | # endnotes 135 | *.ent 136 | 137 | # fixme 138 | *.lox 139 | 140 | # feynmf/feynmp 141 | *.mf 142 | *.mp 143 | *.t[1-9] 144 | *.t[1-9][0-9] 145 | *.tfm 146 | 147 | #(r)(e)ledmac/(r)(e)ledpar 148 | *.end 149 | *.?end 150 | *.[1-9] 151 | *.[1-9][0-9] 152 | *.[1-9][0-9][0-9] 153 | *.[1-9]R 154 | *.[1-9][0-9]R 155 | *.[1-9][0-9][0-9]R 156 | *.eledsec[1-9] 157 | *.eledsec[1-9]R 158 | *.eledsec[1-9][0-9] 159 | *.eledsec[1-9][0-9]R 160 | *.eledsec[1-9][0-9][0-9] 161 | *.eledsec[1-9][0-9][0-9]R 162 | 163 | # glossaries 164 | *.acn 165 | *.acr 166 | *.glg 167 | *.glo 168 | *.gls 169 | *.glsdefs 170 | 171 | # gnuplottex 172 | *-gnuplottex-* 173 | 174 | # gregoriotex 175 | *.gaux 176 | *.gtex 177 | 178 | # htlatex 179 | *.4ct 180 | *.4tc 181 | *.idv 182 | *.lg 183 | *.trc 184 | *.xref 185 | 186 | # hyperref 187 | *.brf 188 | 189 | # knitr 190 | *-concordance.tex 191 | # TODO Comment the next line if you want to keep your tikz graphics files 192 | *.tikz 193 | *-tikzDictionary 194 | 195 | # listings 196 | *.lol 197 | 198 | # makeidx 199 | *.idx 200 | *.ilg 201 | *.ind 202 | *.ist 203 | 204 | # minitoc 205 | *.maf 206 | *.mlf 207 | *.mlt 208 | *.mtc[0-9]* 209 | *.slf[0-9]* 210 | *.slt[0-9]* 211 | *.stc[0-9]* 212 | 213 | # minted 214 | _minted* 215 | *.pyg 216 | 217 | # morewrites 218 | *.mw 219 | 220 | # nomencl 221 | *.nlg 222 | *.nlo 223 | *.nls 224 | 225 | # pax 226 | *.pax 227 | 228 | # pdfpcnotes 229 | *.pdfpc 230 | 231 | # sagetex 232 | *.sagetex.sage 233 | *.sagetex.py 234 | *.sagetex.scmd 235 | 236 | # scrwfile 237 | *.wrt 238 | 239 | # sympy 240 | *.sout 241 | *.sympy 242 | sympy-plots-for-*.tex/ 243 | 244 | # pdfcomment 245 | *.upa 246 | *.upb 247 | 248 | # pythontex 249 | *.pytxcode 250 | pythontex-files-*/ 251 | 252 | # tcolorbox 253 | *.listing 254 | 255 | # thmtools 256 | *.loe 257 | 258 | # TikZ & PGF 259 | *.dpth 260 | *.md5 261 | *.auxlock 262 | 263 | # todonotes 264 | *.tdo 265 | 266 | # vhistory 267 | *.hst 268 | *.ver 269 | 270 | # easy-todo 271 | *.lod 272 | 273 | # xcolor 274 | *.xcp 275 | 276 | # xmpincl 277 | *.xmpi 278 | 279 | # xindy 280 | *.xdy 281 | 282 | # xypic precompiled matrices 283 | *.xyc 284 | 285 | # endfloat 286 | *.ttt 287 | *.fff 288 | 289 | # Latexian 290 | TSWLatexianTemp* 291 | 292 | ## Editors: 293 | # WinEdt 294 | *.bak 295 | *.sav 296 | 297 | # Texpad 298 | .texpadtmp 299 | 300 | # LyX 301 | *.lyx~ 302 | 303 | # Kile 304 | *.backup 305 | 306 | # KBibTeX 307 | *~[0-9]* 308 | 309 | # auto folder when using emacs and auctex 310 | ./auto/* 311 | *.el 312 | 313 | # expex forward references with \gathertags 314 | *-tags.tex 315 | 316 | # standalone packages 317 | *.sta 318 | 319 | ### LaTeX Patch ### 320 | # glossaries 321 | *.glstex 322 | 323 | ### macOS ### 324 | # General 325 | .DS_Store 326 | .AppleDouble 327 | .LSOverride 328 | 329 | # Icon must end with two \r 330 | Icon 331 | 332 | # Thumbnails 333 | ._* 334 | 335 | # Files that might appear in the root of a volume 336 | .DocumentRevisions-V100 337 | .fseventsd 338 | .Spotlight-V100 339 | .TemporaryItems 340 | .Trashes 341 | .VolumeIcon.icns 342 | .com.apple.timemachine.donotpresent 343 | 344 | # Directories potentially created on remote AFP share 345 | .AppleDB 346 | .AppleDesktop 347 | Network Trash Folder 348 | Temporary Items 349 | .apdisk 350 | 351 | ### Python ### 352 | # Byte-compiled / optimized / DLL files 353 | __pycache__/ 354 | *.py[cod] 355 | *$py.class 356 | 357 | # C extensions 358 | *.so 359 | 360 | # Distribution / packaging 361 | .Python 362 | build/ 363 | develop-eggs/ 364 | downloads/ 365 | eggs/ 366 | .eggs/ 367 | lib/ 368 | lib64/ 369 | parts/ 370 | sdist/ 371 | var/ 372 | wheels/ 373 | share/python-wheels/ 374 | *.egg-info/ 375 | .installed.cfg 376 | *.egg 377 | MANIFEST 378 | 379 | # PyInstaller 380 | # Usually these files are written by a python script from a template 381 | # before PyInstaller builds the exe, so as to inject date/other infos into it. 382 | *.manifest 383 | *.spec 384 | 385 | # Installer logs 386 | pip-log.txt 387 | pip-delete-this-directory.txt 388 | 389 | # Unit test / coverage reports 390 | htmlcov/ 391 | .tox/ 392 | .nox/ 393 | .coverage 394 | .coverage.* 395 | .cache 396 | nosetests.xml 397 | coverage.xml 398 | *.cover 399 | .hypothesis/ 400 | .pytest_cache/ 401 | 402 | # Translations 403 | *.mo 404 | *.pot 405 | 406 | # Django stuff: 407 | local_settings.py 408 | db.sqlite3 409 | 410 | # Flask stuff: 411 | instance/ 412 | .webassets-cache 413 | 414 | # Scrapy stuff: 415 | .scrapy 416 | 417 | # Sphinx documentation 418 | docs/_build/ 419 | 420 | # PyBuilder 421 | target/ 422 | 423 | # Jupyter Notebook 424 | .ipynb_checkpoints 425 | 426 | # IPython 427 | profile_default/ 428 | ipython_config.py 429 | 430 | # pyenv 431 | .python-version 432 | 433 | # celery beat schedule file 434 | celerybeat-schedule 435 | 436 | # SageMath parsed files 437 | *.sage.py 438 | 439 | # Environments 440 | .env 441 | .venv 442 | env/ 443 | venv/ 444 | ENV/ 445 | env.bak/ 446 | venv.bak/ 447 | 448 | # Spyder project settings 449 | .spyderproject 450 | .spyproject 451 | 452 | # Rope project settings 453 | .ropeproject 454 | 455 | # mkdocs documentation 456 | /site 457 | 458 | # mypy 459 | .mypy_cache/ 460 | .dmypy.json 461 | dmypy.json 462 | 463 | # Pyre type checker 464 | .pyre/ 465 | 466 | ### Python Patch ### 467 | .venv/ 468 | 469 | # End of https://www.gitignore.io/api/latex,emacs,macos,python,ipython 470 | # Custom for CDC papers 471 | *.bibkey 472 | *.dep 473 | 474 | # economics.bib will be nonexistent on local machine, but should exist and be of zero size on remote 475 | # This requires it to exist but be empty on first commit, and ignored thereafter 476 | economics.bib 477 | *.tmp 478 | 479 | 480 | # Items below from https://gist.github.com/paulcbetts/2802523 481 | *.doc diff=astextplain 482 | *.DOC diff=astextplain 483 | *.docx diff=astextplain 484 | *.DOCX diff=astextplain 485 | *.dot diff=astextplain 486 | *.DOT diff=astextplain 487 | *.pdf diff=astextplain 488 | *.PDF diff=astextplain 489 | *.rtf diff=astextplain 490 | *.RTF diff=astextplain 491 | 492 | 493 | *.jpg binary 494 | *.png binary 495 | *.gif binary 496 | 497 | *.cs -text diff=csharp 498 | *.vb -text 499 | *.c -text 500 | *.cpp -text 501 | *.cxx -text 502 | *.h -text 503 | *.hxx -text 504 | *.py -text 505 | *.rb -text 506 | *.java -text 507 | *.html -text 508 | *.htm -text 509 | *.css -text 510 | *.scss -text 511 | *.sass -text 512 | *.less -text 513 | *.js -text 514 | *.lisp -text 515 | *.clj -text 516 | *.sql -text 517 | *.php -text 518 | *.lua -text 519 | *.m -text 520 | *.asm -text 521 | *.erl -text 522 | *.fs -text 523 | *.fsx -text 524 | *.hs -text 525 | # Custom for ShareLaTeX; allows configuration of ShareLaTeX without configuring other installations 526 | latexmkrc 527 | 528 | # 529 | _region_.* 530 | # Things marked in any of these ways are kept only locally 531 | *_pri* 532 | *_pri_* 533 | Private 534 | private 535 | 536 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright [yyyy] [name of copyright owner] 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /notebooks/PerfForesightCRRA-Impatience-Solutions - Jamie.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# Perfect Foresight Model Impatience Conditions" 8 | ] 9 | }, 10 | { 11 | "cell_type": "code", 12 | "execution_count": null, 13 | "metadata": { 14 | "code_folding": [ 15 | 0 16 | ] 17 | }, 18 | "outputs": [], 19 | "source": [ 20 | "# Initial notebook set up\n", 21 | "\n", 22 | "%matplotlib inline\n", 23 | "import matplotlib.pyplot as plt\n", 24 | "\n", 25 | "# The first step is to be able to bring things in from different directories\n", 26 | "import sys \n", 27 | "import os\n", 28 | "\n", 29 | "sys.path.insert(0, os.path.abspath('../lib'))\n", 30 | "\n", 31 | "import numpy as np\n", 32 | "import HARK \n", 33 | "from time import clock\n", 34 | "from copy import deepcopy\n", 35 | "mystr = lambda number : \"{:.4f}\".format(number)\n", 36 | "from HARK.utilities import plotFuncs\n", 37 | "\n", 38 | "# These last two will make our charts look nice\n", 39 | "plt.style.use('seaborn-darkgrid')\n", 40 | "palette = plt.get_cmap('Dark2')" 41 | ] 42 | }, 43 | { 44 | "cell_type": "markdown", 45 | "metadata": {}, 46 | "source": [ 47 | "After using the Jupyter notebook [Gentle-Intro-To-HARK-PerfForesightCRRA](https://github.com/econ-ark/DemARK/blob/Course-Choice/notebooks/Gentle-Intro-To-HARK-PerfForesightCRRA.ipynb) to learn the basics of HARK, answer the following questions:" 48 | ] 49 | }, 50 | { 51 | "cell_type": "markdown", 52 | "metadata": {}, 53 | "source": [ 54 | "\n", 55 | "\n", 56 | "[PerfectForesightCRRA](http://www.econ2.jhu.edu/people/ccarroll/public/lecturenotes/Consumption/PerfForesightCRRA) defines several 'impatience' conditions that are useful in understanding the model. We will use here the HARK toolkit's solution to the permanent-income-normalized version of the model, which constructs a consumption function for the ratio of consumption to permanent income.\n", 57 | "\n", 58 | "The handout claims that in order for the perfect foresight consumption model to be useful, it is necessary to impose\n", 59 | "the 'return impatience condition' (RIC):\n", 60 | "\n", 61 | "\\begin{eqnarray}\n", 62 | " \\frac{(R \\beta)^{1/\\rho}}{R} & < & 1\n", 63 | "\\end{eqnarray}\n", 64 | "\n", 65 | "and defines some other similar inequalities that help characterize what happens in the model (or whether it has a solution at all).\n", 66 | "\n", 67 | "This question asks you to explore numerically what happens to the consumption function as these conditions get close to failing.\n", 68 | "\n", 69 | "Specifically, given the default set of parameter values used in the notebook below, you should:\n", 70 | "\n", 71 | "1. Plot the consumption function for a perfect foresight consumer with those defaultparameter values, along with the \"sustainable\" level of consumption that would preserve wealth\n", 72 | "1. Calculate the numerical values of the three impatience conditions\n", 73 | "0. Calculate the values of $\\beta$ and $G$ such that the impatience factors on the LHS of the two equations would be exactly equal to 1\n", 74 | "\n", 75 | "Next, along with the sustainable consumption function, you should plot a sequence of consumption functions of a HARK `PerfForesightConsumerType` consumer, for a set of parameter values that go from the default value toward some interesting point:\n", 76 | "\n", 77 | "1. For some sequence of values of $\\beta$ that go from the default value to some value very close to the point where the RIC fails\n", 78 | " * Actually, we do this one for you to show how to do it generically\n", 79 | "0. For some sequence of values of $G$ that go from the default value to some value just below the maximum possible value of $G$. (Why is it the maximum possible value?)\n", 80 | "0. For some sequence of values of $\\rho$ that go from the default value to some value that is very large\n", 81 | "\n", 82 | "and in each case you should explain, using analytical mathematical reasoning, the numerical result you get. (You can just type your answers in the notebook)." 83 | ] 84 | }, 85 | { 86 | "cell_type": "markdown", 87 | "metadata": {}, 88 | "source": [ 89 | "\n", 90 | "\n", 91 | "\n", 92 | "\n" 93 | ] 94 | }, 95 | { 96 | "cell_type": "code", 97 | "execution_count": 1, 98 | "metadata": {}, 99 | "outputs": [], 100 | "source": [ 101 | "# Import the machinery for solving the perfect foresight model and the default parameters\n", 102 | "\n", 103 | "from HARK.ConsumptionSaving.ConsIndShockModel import PerfForesightConsumerType # Import the consumer type\n", 104 | "import HARK.ConsumptionSaving.ConsumerParameters as Params # Import default parameters\n", 105 | "\n", 106 | "# Now extract the default values of the parameters of interest\n", 107 | "\n", 108 | "CRRA = Params.CRRA \n", 109 | "Rfree = Params.Rfree \n", 110 | "DiscFac = Params.DiscFac\n", 111 | "PermGroFac = Params.PermGroFac\n", 112 | "rfree = Rfree-1" 113 | ] 114 | }, 115 | { 116 | "cell_type": "code", 117 | "execution_count": 2, 118 | "metadata": {}, 119 | "outputs": [], 120 | "source": [ 121 | "# Now create a perfect foresight consumer example, \n", 122 | "PFagent = PerfForesightConsumerType(**Params.init_perfect_foresight)\n", 123 | "PFagent.cycles = 0 # We need the consumer to be infinitely lived\n", 124 | "PFagent.LivPrb = [1.0] # Suppress the possibility of dying\n", 125 | "\n", 126 | "# Solve the agent's problem\n", 127 | "PFagent.solve()" 128 | ] 129 | }, 130 | { 131 | "cell_type": "code", 132 | "execution_count": null, 133 | "metadata": { 134 | "scrolled": true 135 | }, 136 | "outputs": [], 137 | "source": [ 138 | "# Plot the consumption function \n", 139 | "\n", 140 | "# Remember, after invoking .solve(), the consumption function is stored as PFagent.solution[0].cFunc\n", 141 | "\n", 142 | "# Set out some range of market resources that we want to plot consumption for\n", 143 | "\n", 144 | "mMin = 0\n", 145 | "mMax = 20\n", 146 | "numPoints = 100\n", 147 | "m_range = np.linspace(mMin, mMax, numPoints) # This creates an array of points in the given range\n", 148 | "\n", 149 | "# Feed our range of market resources into our consumption function in order to get consumption at each point\n", 150 | "\n", 151 | "cHARK = PFagent.solution[0].cFunc(m_range) # Because the input m_range is an array, the output cHARK is too\n", 152 | "\n", 153 | "# Construct the 45 degree line where value on vertical axis matches horizontal\n", 154 | "degree45 = m_range # This will be the array of y points identical to the x points\n", 155 | "\n", 156 | "# Find the value of consumption at the largest value of m\n", 157 | "c_max = PFagent.solution[0].cFunc([mMax])\n", 158 | "\n", 159 | "# Use matplotlib package (imported in first cell) to plot the consumption function\n", 160 | "plt.figure(figsize=(9,6)) # set the figure size\n", 161 | "plt.ylim(0.,c_max[0]*1.1) # set the range for the vertical axis with a 10 percent margin at top\n", 162 | "plt.plot(m_range, cHARK, 'b', label='Consumption Function from HARK') # Plot m's on the x axis, versus our c on the y axis, and make the line blue, with a label\n", 163 | "plt.xlabel('Market resources m') # x axis label\n", 164 | "plt.ylabel('Consumption c') # y axis label\n", 165 | "\n", 166 | "# The plot is named plt and it hangs around like a variable \n", 167 | "# but is not displayed until you do a plt.show()\n", 168 | "\n", 169 | "plt.plot(m_range, degree45 , 'g', label='c = m') # Add 45 degree line\n", 170 | "plt.legend() # construct the legend\n", 171 | "\n", 172 | "plt.show() # show the plot" 173 | ] 174 | }, 175 | { 176 | "cell_type": "code", 177 | "execution_count": null, 178 | "metadata": { 179 | "scrolled": true 180 | }, 181 | "outputs": [], 182 | "source": [ 183 | "# QUESTION: Now calculate and plot the \"sustainable\" level of consumption that leaves wealth untouched\n", 184 | "# and plot it against the perfect foresight solution\n", 185 | "\n", 186 | "cSustainable = 0. + 0.*(m_range-1+0.) # For any given level of m, the level of c that would leave wealth unchanged\n", 187 | "# Obviously, 0 is the wrong formula here -- you should fill in the right one\n", 188 | "\n", 189 | "plt.figure(figsize=(9,6)) # set the figure size\n", 190 | "plt.xlabel('Market resources m') # x axis label\n", 191 | "plt.ylabel('Consumption c') # y axis label\n", 192 | "\n", 193 | "plt.plot(m_range, cSustainable , 'k', label='Sustainable c') # Add sustainable c line\n", 194 | "plt.plot(m_range, cHARK, 'b', label='c Function')\n", 195 | "plt.legend()\n", 196 | "\n", 197 | "plt.show() # show the plot" 198 | ] 199 | }, 200 | { 201 | "cell_type": "code", 202 | "execution_count": null, 203 | "metadata": {}, 204 | "outputs": [], 205 | "source": [ 206 | "# Compute the values of the impatience conditions under default parameter values\n", 207 | "\n", 208 | "Pat_df = 0. # Plug in the formula for the absolute patience factor\n", 209 | "PatR_df = 0. # Plug in the formula for the return patience factor\n", 210 | "PatG_df = 0. # Plug in the formula for the growth patience factor\n", 211 | "\n", 212 | "DiscFac_lim = 0. # The limiting value such that the RIC exactly fails\n", 213 | "PermGroFac_lim = 0. # The limiting value such that the GIC exactly fails" 214 | ] 215 | }, 216 | { 217 | "cell_type": "code", 218 | "execution_count": null, 219 | "metadata": {}, 220 | "outputs": [], 221 | "source": [ 222 | "# The code below is an example to show you how to plot a set of consumption functions\n", 223 | "# for a sequence of values of the discount factor. You should be\n", 224 | "# to adapt this code to solve the rest of the sproblem posed above\n", 225 | "\n", 226 | "howClose=0.01 # How close to come to the limit where the impatience condition fails\n", 227 | "DiscFac_min = 0.8\n", 228 | "DiscFac_max = DiscFac_lim-howClose # \n", 229 | "numPoints = 10\n", 230 | "DiscFac_list = np.linspace(DiscFac_min, DiscFac_max, numPoints) # Create a list of beta values\n", 231 | "\n", 232 | "plt.figure(figsize=((9,6))) # set the plot size\n", 233 | "\n", 234 | "plt.plot(m_range, cSustainable , 'k', label='Sustainable c') # Add sustainable c line\n", 235 | "for i in range(len(DiscFac_list)):\n", 236 | " PFagent.DiscFac = DiscFac_list[i]\n", 237 | " PFagent.solve()\n", 238 | " cHARK = PFagent.solution[0].cFunc(m_range)\n", 239 | " plt.plot(m_range, cHARK, label='Consumption Function, $\\\\beta$= '+str(PFagent.DiscFac))\n", 240 | "\n", 241 | "PFagent.DiscFac = Params.DiscFac # return discount factor to default value\n", 242 | "PFagent.solve() # It's polite to leave the PFagent back with its default solution\n", 243 | "plt.xlabel('Market resources m') # x axis label\n", 244 | "plt.ylabel('Consumption c') # y axis label\n", 245 | "plt.legend() # show legend\n", 246 | "plt.show() # plot chart\n" 247 | ] 248 | }, 249 | { 250 | "cell_type": "code", 251 | "execution_count": null, 252 | "metadata": {}, 253 | "outputs": [], 254 | "source": [ 255 | "# Now plot the consumption functions for alternate values of G as described above\n", 256 | "# Note the tricky fact that PermGroFac is a list of values because it could \n", 257 | "# be representing some arbitrary sequence of growth rates" 258 | ] 259 | }, 260 | { 261 | "cell_type": "code", 262 | "execution_count": null, 263 | "metadata": {}, 264 | "outputs": [], 265 | "source": [ 266 | "# PROBLEM: What is the upper bound for possible values of G? Why?\n", 267 | "\n", 268 | "PermGro_min = PermGroFac[0]\n", 269 | "PermGro_max = PermGro_min # Replace with correct answer\n", 270 | "PermGroArray = np.linspace(PermGro_min, PermGro_max, numPoints, endpoint=True)\n", 271 | "PermGroList = PermGroArray.tolist() # Make growth factors a list\n", 272 | "\n", 273 | "# Copy and modify the code above for plotting the consumption functions (starting with plt.figure(figsize=...))" 274 | ] 275 | }, 276 | { 277 | "cell_type": "code", 278 | "execution_count": null, 279 | "metadata": {}, 280 | "outputs": [], 281 | "source": [ 282 | "# PROBLEM: \n", 283 | "# Now plot the consumption functions for values of rho above the default value" 284 | ] 285 | } 286 | ], 287 | "metadata": { 288 | "kernelspec": { 289 | "display_name": "Python 3", 290 | "language": "python", 291 | "name": "python3" 292 | }, 293 | "language_info": { 294 | "codemirror_mode": { 295 | "name": "ipython", 296 | "version": 3 297 | }, 298 | "file_extension": ".py", 299 | "mimetype": "text/x-python", 300 | "name": "python", 301 | "nbconvert_exporter": "python", 302 | "pygments_lexer": "ipython3", 303 | "version": "3.6.9" 304 | } 305 | }, 306 | "nbformat": 4, 307 | "nbformat_minor": 4 308 | } 309 | -------------------------------------------------------------------------------- /notebooks/TractableBufferStock-Interactive-Problems.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# The Tractable Buffer Stock Model\n", 8 | "\n", 9 | "
Generator: BufferStockTheory-make/notebooks_byname
" 10 | ] 11 | }, 12 | { 13 | "cell_type": "markdown", 14 | "metadata": {}, 15 | "source": [ 16 | "The [TractableBufferStock](http://www.econ2.jhu.edu/people/ccarroll/public/LectureNotes/Consumption/TractableBufferStock/) model is a (relatively) simple framework that captures all of the qualitative, and many of the quantitative features of optimal consumption in the presence of labor income uncertainty. " 17 | ] 18 | }, 19 | { 20 | "cell_type": "code", 21 | "execution_count": 1, 22 | "metadata": { 23 | "code_folding": [ 24 | 0 25 | ] 26 | }, 27 | "outputs": [], 28 | "source": [ 29 | "# This cell has a bit of (uninteresting) initial setup.\n", 30 | "\n", 31 | "import matplotlib.pyplot as plt\n", 32 | "\n", 33 | "import numpy as np\n", 34 | "import HARK \n", 35 | "from time import clock\n", 36 | "from copy import deepcopy\n", 37 | "mystr = lambda number : \"{:.3f}\".format(number)\n", 38 | "\n", 39 | "from ipywidgets import interact, interactive, fixed, interact_manual\n", 40 | "import ipywidgets as widgets\n", 41 | "from HARK.utilities import plotFuncs" 42 | ] 43 | }, 44 | { 45 | "cell_type": "code", 46 | "execution_count": 2, 47 | "metadata": { 48 | "code_folding": [ 49 | 0 50 | ] 51 | }, 52 | "outputs": [], 53 | "source": [ 54 | "# Import the model from the toolkit\n", 55 | "from HARK.ConsumptionSaving.TractableBufferStockModel import TractableConsumerType" 56 | ] 57 | }, 58 | { 59 | "cell_type": "markdown", 60 | "metadata": {}, 61 | "source": [ 62 | "The key assumption behind the model's tractability is that there is only a single, stark form of uncertainty: So long as an employed consumer remains employed, that consumer's labor income $P$ will rise at a constant rate $\\Gamma$:\n", 63 | "\\begin{align}\n", 64 | "P_{t+1} &= \\Gamma P_{t}\n", 65 | "\\end{align}\n", 66 | "\n", 67 | "But, between any period and the next, there is constant hazard $p$ that the consumer will transition to the \"unemployed\" state. Unemployment is irreversible, like retirement or disability. When unemployed, the consumer receives a fixed amount of income (for simplicity, zero). (See the [linked handout](http://www.econ2.jhu.edu/people/ccarroll/public/LectureNotes/Consumption/TractableBufferStock/) for details of the model).\n", 68 | "\n", 69 | "Defining $G$ as the growth rate of aggregate wages/productivity, we assume that idiosyncratic wages grow by $\\Gamma = G/(1-\\mho)$ where $(1-\\mho)^{-1}$ is the growth rate of idiosyncratic productivity ('on-the-job learning', say). (This assumption about the relation between idiosyncratic income growth and idiosyncratic risk means that an increase in $\\mho$ is a mean-preserving spread in human wealth; again see [the lecture notes](http://www.econ2.jhu.edu/people/ccarroll/public/LectureNotes/Consumption/TractableBufferStock/)).\n", 70 | "\n", 71 | "Under CRRA utility $u(C) = \\frac{C^{1-\\rho}}{1-\\rho}$, the problem can be normalized by $P$. Using lower case for normalized varibles (e.g., $c = C/P$), the normalized problem can be expressed by the Bellman equation:\n", 72 | "\n", 73 | "\\begin{eqnarray*}\n", 74 | "v_t({m}_t) &=& \\max_{{c}_t} ~ U({c}_t) + \\beta \\Gamma^{1-\\rho} \\overbrace{\\mathbb{E}[v_{t+1}^{\\bullet}]}^{=p v_{t+1}^{u}+(1-p)v_{t+1}^{e}} \\\\\n", 75 | "& s.t. & \\\\\n", 76 | "{m}_{t+1} &=& (m_{t}-c_{t})\\mathcal{R} + \\mathbb{1}_{t+1},\n", 77 | "\\end{eqnarray*}\n", 78 | "where $\\mathcal{R} = R/\\Gamma$, and $\\mathbb{1}_{t+1} = 1$ if the consumer is employed (and zero if unemployed).\n", 79 | "\n", 80 | "Under plausible parameter values the model has a target level of $\\check{m} = M/P$ (market resources to permanent income) with an analytical solution that exhibits plausible relationships among all of the parameters. \n", 81 | "\n", 82 | "Defining $\\gamma = \\log \\Gamma$ and $r = \\log R$, the handout shows that an approximation of the target is given by the formula:\n", 83 | "\n", 84 | "\\begin{align}\n", 85 | "\\check{m} & = 1 + \\left(\\frac{1}{(\\gamma-r)+(1+(\\gamma/\\mho)(1-(\\gamma/\\mho)(\\rho-1)/2))}\\right)\n", 86 | "\\end{align}\n" 87 | ] 88 | }, 89 | { 90 | "cell_type": "code", 91 | "execution_count": 3, 92 | "metadata": { 93 | "code_folding": [ 94 | 0 95 | ] 96 | }, 97 | "outputs": [], 98 | "source": [ 99 | "# Define a parameter dictionary and representation of the agents for the tractable buffer stock model\n", 100 | "TBS_dictionary = {'UnempPrb' : .00625, # Prob of becoming unemployed; working life of 1/UnempProb = 160 qtrs\n", 101 | " 'DiscFac' : 0.975, # Intertemporal discount factor\n", 102 | " 'Rfree' : 1.01, # Risk-free interest factor on assets\n", 103 | " 'PermGroFac' : 1.0025, # Permanent income growth factor (uncompensated)\n", 104 | " 'CRRA' : 2.5} # Coefficient of relative risk aversion\n", 105 | "MyTBStype = TractableConsumerType(**TBS_dictionary)" 106 | ] 107 | }, 108 | { 109 | "cell_type": "markdown", 110 | "metadata": {}, 111 | "source": [ 112 | "## Target Wealth\n", 113 | "\n", 114 | "Whether the model exhibits a \"target\" or \"stable\" level of the wealth-to-permanent-income ratio for employed consumers depends on whether the 'Growth Impatience Condition' (the GIC) holds:\n", 115 | "\n", 116 | "\\begin{align}\\label{eq:GIC}\n", 117 | " \\left(\\frac{(R \\beta (1-\\mho))^{1/\\rho}}{\\Gamma}\\right) & < 1\n", 118 | "\\\\ \\left(\\frac{(R \\beta (1-\\mho))^{1/\\rho}}{G (1-\\mho)}\\right) &< 1\n", 119 | "\\\\ \\left(\\frac{(R \\beta)^{1/\\rho}}{G} (1-\\mho)^{-\\rho}\\right) &< 1\n", 120 | "\\end{align}\n", 121 | "and recall (from [PerfForesightCRRA](http://econ.jhu.edu/people/ccarroll/public/lecturenotes/consumption/PerfForesightCRRA/)) that the perfect foresight 'Growth Impatience Factor' is \n", 122 | "\\begin{align}\\label{eq:PFGIC}\n", 123 | "\\left(\\frac{(R \\beta)^{1/\\rho}}{G}\\right) &< 1\n", 124 | "\\end{align}\n", 125 | "so since $\\mho > 0$, uncertainty makes it harder to be 'impatient.' To understand this, think of someone who, in the perfect foresight model, was 'poised': Exactly on the knife edge between patience and impatience. Now add a precautionary saving motive; that person will now (to some degree) be pushed off the knife edge in the direction of 'patience.' So, in the presence of uncertainty, the conditions on parameters other than $\\mho$ must be stronger in order to guarantee 'impatience' in the sense of wanting to spend enough for your wealth to decline _despite_ the extra precautionary motive." 126 | ] 127 | }, 128 | { 129 | "cell_type": "code", 130 | "execution_count": 4, 131 | "metadata": { 132 | "code_folding": [ 133 | 0, 134 | 3 135 | ] 136 | }, 137 | "outputs": [ 138 | { 139 | "data": { 140 | "application/vnd.jupyter.widget-view+json": { 141 | "model_id": "0bc9ab5bc75f43d29652727eb2874a8a", 142 | "version_major": 2, 143 | "version_minor": 0 144 | }, 145 | "text/plain": [ 146 | "interactive(children=(FloatSlider(value=0.975, continuous_update=False, description='$\\\\beta$', max=0.99, min=…" 147 | ] 148 | }, 149 | "metadata": {}, 150 | "output_type": "display_data" 151 | } 152 | ], 153 | "source": [ 154 | "# Define a function that plots the employed consumption function and sustainable consumption function \n", 155 | "# for given parameter values\n", 156 | "\n", 157 | "def makeTBSplot(DiscFac,CRRA,Rfree,PermGroFac,UnempPrb,mMax,mMin,cMin,cMax,plot_emp,plot_ret,plot_mSS,show_targ):\n", 158 | " MyTBStype.DiscFac = DiscFac\n", 159 | " MyTBStype.CRRA = CRRA\n", 160 | " MyTBStype.Rfree = Rfree\n", 161 | " MyTBStype.PermGroFac = PermGroFac\n", 162 | " MyTBStype.UnempPrb = UnempPrb\n", 163 | " \n", 164 | " try:\n", 165 | " MyTBStype.solve()\n", 166 | " except:\n", 167 | " print('Unable to solve; parameter values may be too close to their limiting values') \n", 168 | " \n", 169 | " plt.xlabel('Market resources ${m}_t$')\n", 170 | " plt.ylabel('Consumption ${c}_t$')\n", 171 | " plt.ylim([cMin,cMax])\n", 172 | " plt.xlim([mMin,mMax])\n", 173 | " \n", 174 | " m = np.linspace(mMin,mMax,num=100,endpoint=True)\n", 175 | " if plot_emp:\n", 176 | " c = MyTBStype.solution[0].cFunc(m)\n", 177 | " c[m==0.] = 0.\n", 178 | " plt.plot(m,c,'-b')\n", 179 | " \n", 180 | " if plot_mSS:\n", 181 | " plt.plot([mMin,mMax],[(MyTBStype.PermGroFacCmp/MyTBStype.Rfree + mMin*(1.0-MyTBStype.PermGroFacCmp/MyTBStype.Rfree)),(MyTBStype.PermGroFacCmp/MyTBStype.Rfree + mMax*(1.0-MyTBStype.PermGroFacCmp/MyTBStype.Rfree))],'--k')\n", 182 | " \n", 183 | " if plot_ret:\n", 184 | " c = MyTBStype.solution[0].cFunc_U(m)\n", 185 | " plt.plot(m,c,'-g')\n", 186 | " \n", 187 | " if show_targ:\n", 188 | " mTarg = MyTBStype.mTarg\n", 189 | " cTarg = MyTBStype.cTarg\n", 190 | " targ_label = r'$\\left(\\frac{1}{(\\gamma-r)+(1+(\\gamma/\\mho)(1-(\\gamma/\\mho)(\\rho-1)/2))}\\right) $' #+ mystr(mTarg) + '\\n$\\check{c}^* = $ ' + mystr(cTarg)\n", 191 | " plt.annotate(targ_label,xy=(0.0,0.0),xytext=(0.2,0.1),textcoords='axes fraction',fontsize=18)\n", 192 | " plt.plot(mTarg,cTarg,'ro')\n", 193 | " plt.annotate('↙️ m target',(mTarg,cTarg),xytext=(0.25,0.2),ha='left',textcoords='offset points')\n", 194 | " \n", 195 | " plt.show()\n", 196 | " return None\n", 197 | "\n", 198 | "# Define widgets to control various aspects of the plot\n", 199 | "\n", 200 | "# Define a slider for the discount factor\n", 201 | "DiscFac_widget = widgets.FloatSlider(\n", 202 | " min=0.9,\n", 203 | " max=0.99,\n", 204 | " step=0.0002,\n", 205 | " value=TBS_dictionary['DiscFac'], # Default value\n", 206 | " continuous_update=False,\n", 207 | " readout_format='.4f',\n", 208 | " description='$\\\\beta$')\n", 209 | "\n", 210 | "# Define a slider for relative risk aversion\n", 211 | "CRRA_widget = widgets.FloatSlider(\n", 212 | " min=1.0,\n", 213 | " max=5.0,\n", 214 | " step=0.01,\n", 215 | " value=TBS_dictionary['CRRA'], # Default value\n", 216 | " continuous_update=False,\n", 217 | " readout_format='.2f',\n", 218 | " description='$\\\\rho$')\n", 219 | "\n", 220 | "# Define a slider for the interest factor\n", 221 | "Rfree_widget = widgets.FloatSlider(\n", 222 | " min=1.01,\n", 223 | " max=1.04,\n", 224 | " step=0.0001,\n", 225 | " value=TBS_dictionary['Rfree'], # Default value\n", 226 | " continuous_update=False,\n", 227 | " readout_format='.4f',\n", 228 | " description='$R$')\n", 229 | "\n", 230 | "\n", 231 | "# Define a slider for permanent income growth\n", 232 | "PermGroFac_widget = widgets.FloatSlider(\n", 233 | " min=1.00,\n", 234 | " max=1.015,\n", 235 | " step=0.0002,\n", 236 | " value=TBS_dictionary['PermGroFac'], # Default value\n", 237 | " continuous_update=False,\n", 238 | " readout_format='.4f',\n", 239 | " description='$G$')\n", 240 | "\n", 241 | "# Define a slider for unemployment (or retirement) probability\n", 242 | "UnempPrb_widget = widgets.FloatSlider(\n", 243 | " min=0.000001,\n", 244 | " max=TBS_dictionary['UnempPrb']*2, # Go up to twice the default value\n", 245 | " step=0.00001,\n", 246 | " value=TBS_dictionary['UnempPrb'],\n", 247 | " continuous_update=False,\n", 248 | " readout_format='.5f',\n", 249 | " description='$\\\\mho$')\n", 250 | "\n", 251 | "# Define a text box for the lower bound of {m}_t\n", 252 | "mMin_widget = widgets.FloatText(\n", 253 | " value=0.0,\n", 254 | " step=0.1,\n", 255 | " description='$m$ min',\n", 256 | " disabled=False)\n", 257 | "\n", 258 | "# Define a text box for the upper bound of {m}_t\n", 259 | "mMax_widget = widgets.FloatText(\n", 260 | " value=50.0,\n", 261 | " step=0.1,\n", 262 | " description='$m$ max',\n", 263 | " disabled=False)\n", 264 | "\n", 265 | "# Define a text box for the lower bound of {c}_t\n", 266 | "cMin_widget = widgets.FloatText(\n", 267 | " value=0.0,\n", 268 | " step=0.1,\n", 269 | " description='$c$ min',\n", 270 | " disabled=False)\n", 271 | "\n", 272 | "# Define a text box for the upper bound of {c}_t\n", 273 | "cMax_widget = widgets.FloatText(\n", 274 | " value=1.5,\n", 275 | " step=0.1,\n", 276 | " description='$c$ max',\n", 277 | " disabled=False)\n", 278 | "\n", 279 | "# Define a check box for whether to plot the employed consumption function\n", 280 | "plot_emp_widget = widgets.Checkbox(\n", 281 | " value=True,\n", 282 | " description='Plot employed $c$ function',\n", 283 | " disabled=False)\n", 284 | "\n", 285 | "# Define a check box for whether to plot the retired consumption function\n", 286 | "plot_ret_widget = widgets.Checkbox(\n", 287 | " value=False,\n", 288 | " description='Plot retired $c$ function',\n", 289 | " disabled=False)\n", 290 | "\n", 291 | "# Define a check box for whether to plot the sustainable consumption line\n", 292 | "plot_mSS_widget = widgets.Checkbox(\n", 293 | " value=True,\n", 294 | " description='Plot sustainable $c$ line',\n", 295 | " disabled=False)\n", 296 | "\n", 297 | "# Define a check box for whether to show the target annotation\n", 298 | "show_targ_widget = widgets.Checkbox(\n", 299 | " value=True,\n", 300 | " description = 'Show target $(m,c)$',\n", 301 | " disabled = False)\n", 302 | "\n", 303 | "# Make an interactive plot of the tractable buffer stock solution\n", 304 | "\n", 305 | "# To make some of the widgets not appear, replace X_widget with fixed(desired_fixed_value) in the arguments below.\n", 306 | "interact(makeTBSplot,\n", 307 | " DiscFac = DiscFac_widget,\n", 308 | " CRRA = CRRA_widget,\n", 309 | " Rfree = Rfree_widget,\n", 310 | " PermGroFac = PermGroFac_widget,\n", 311 | " UnempPrb = UnempPrb_widget,\n", 312 | " mMin = mMin_widget,\n", 313 | " mMax = mMax_widget,\n", 314 | " cMin = cMin_widget,\n", 315 | " cMax = cMax_widget,\n", 316 | " show_targ = show_targ_widget,\n", 317 | " plot_emp = plot_emp_widget,\n", 318 | " plot_ret = plot_ret_widget,\n", 319 | " plot_mSS = plot_mSS_widget,\n", 320 | " );\n", 321 | "\n" 322 | ] 323 | }, 324 | { 325 | "cell_type": "markdown", 326 | "metadata": {}, 327 | "source": [ 328 | "# PROBLEM\n", 329 | "\n", 330 | "Your task is to make a simplified slider that involves only $\\beta$. \n", 331 | "\n", 332 | "First, create a variable `betaMax` equal to the value of $\\beta$ at which the Growth Impatience Factor is exactly equal to 1 (that is, the consumer is exactly on the border between patience and impatience). (Hint: The formula for this is [here](http://www.econ2.jhu.edu/people/ccarroll/public/LectureNotes/Consumption/TractableBufferStock/#GIFMax)).\n", 333 | "\n", 334 | "Next, create a slider/'widget' like the one above, but where all variables except $\\beta$ are set to their default values, and the slider takes $\\beta$ from 0.05 below its default value up to `betaMax - 0.01`. (The numerical solution algorithm becomes unstable when the GIC is too close to being violated, so you don't want to go all the way up to `betaMax.`)\n", 335 | "\n", 336 | "Explain the logic of the result that you see.\n", 337 | "\n", 338 | "(Hint: You do not need to copy and paste (then edit) the entire contents of the cell that creates the widgets above; you only need to modify the `DiscFac_widget`)" 339 | ] 340 | } 341 | ], 342 | "metadata": { 343 | "jupytext": { 344 | "cell_metadata_filter": "collapsed,code_folding", 345 | "encoding": "# -*- coding: utf-8 -*-", 346 | "formats": "ipynb,py:percent" 347 | }, 348 | "kernel_info": { 349 | "name": "python3" 350 | }, 351 | "kernelspec": { 352 | "display_name": "Python 3", 353 | "language": "python", 354 | "name": "python3" 355 | }, 356 | "language_info": { 357 | "codemirror_mode": { 358 | "name": "ipython", 359 | "version": 3 360 | }, 361 | "file_extension": ".py", 362 | "mimetype": "text/x-python", 363 | "name": "python", 364 | "nbconvert_exporter": "python", 365 | "pygments_lexer": "ipython3", 366 | "version": "3.6.9" 367 | }, 368 | "latex_envs": { 369 | "LaTeX_envs_menu_present": true, 370 | "autoclose": false, 371 | "autocomplete": true, 372 | "bibliofile": "biblio.bib", 373 | "cite_by": "apalike", 374 | "current_citInitial": 1, 375 | "eqLabelWithNumbers": true, 376 | "eqNumInitial": 1, 377 | "hotkeys": { 378 | "equation": "Ctrl-E", 379 | "itemize": "Ctrl-I" 380 | }, 381 | "labels_anchors": false, 382 | "latex_user_defs": false, 383 | "report_style_numbering": false, 384 | "user_envs_cfg": false 385 | }, 386 | "nteract": { 387 | "version": "0.14.4" 388 | } 389 | }, 390 | "nbformat": 4, 391 | "nbformat_minor": 4 392 | } 393 | -------------------------------------------------------------------------------- /Courses/HA-Macro/2019-07-Budapest/syllabus/Syllabus.md: -------------------------------------------------------------------------------- 1 | Hands-On Heterogeneous Agent Macroeconomics Using the [Econ-ARK/HARK](http://econ-ark.org) Toolkit 2 | 3 | [Christopher D. Carroll](http://www.econ2.jhu.edu/people/ccarroll) 4 | 5 | Syllabus for Hands-On Heterogeneous Agent Macroeconomics 6 | 7 | BI Business School/University of Oslo 8 | 9 | Spring, 2020 10 | 11 | Because Representative Agent (‘RA’) models were not useful for understanding much of what happened in the Great Recession, policymakers including Larry [Summers](#XsummersWolf2) ([2011](#XsummersWolf2)), Fed Chair Janet [Yellen](#XyellenHetero) ([2016](#XyellenHetero)), former IMF Chief Economist Olivier [Blanchard](#XblanchardDSGE) ([2016](#XblanchardDSGE)), ECB Governing Board Member Benoit [Coeure](#XcoeureHetero) ([2013](#XcoeureHetero)), and Bank of England Chief Economist Andy [Haldane](#XhaldaneDappled) ([2016](#XhaldaneDappled)) have suggested that incorporation of heterogeneity (for example, across borrowers and lenders) must be an essential part of the agenda in developing new and better models. In confirmation of that intuition, a number of recent papers, most notably [Kaplan, Moll, and Violante](#XkmvHANK) ([2018](#XkmvHANK)) and [Krueger, Mitman, and Perri](#XkmpHandbook) ([2016](#XkmpHandbook)), have developed models that include a realistic description of microeconomic heterogeneity, and have shown that such models can generate more sensible macroeconomic implications than RA models for important questions like the operation of fiscal and monetary policy. 12 | 13 | This course will provide a hands-on introduction to the construction of models with ‘serious’ heterogeneity (that is, heterogeneity that matches the microeconomic facts that theory suggests should matter for macroeconomic outcomes like consumption dynamics); why such heterogeneous agent (‘HA’) models have implications different from those of RA models; and how existing HA models can be adapted to new questions. (‘Hands-On’ means that students with their own laptops will run the and experiment with the code that solves these models in class.) 14 | 15 | The course will have two main elements: Lectures explaining the conceptual foundations of the models work; and hands-on demonstrations of live working versions of such models using the open-source [Econ-ARK/HARK](http://econ-ark.org/HARK) toolkit. 16 | 17 | Students should bring a laptop on which they have permissions to install and run new software. Prior to class, on that laptop, students should have installed the [anaconda3](https://www.anaconda.com/what-is-anaconda/) stack, which is a distribution of python 3 that includes a robust set of extra tools that are useful for doing computational work. A good guide to installing anaconda is [here](https://github.com/mmcky/nyu-econ-370/blob/master/install-local-guide.pdf). 18 | 19 | (In “readings” below, starred readings are strongly suggested) 20 | 21 | ### 1 Preliminaries 22 | 23 | 1. Install [Anaconda](https://docs.anaconda.com/anaconda/install): [https://docs.anaconda.com/anaconda/install](https://docs.anaconda.com/anaconda/install) 24 | 2. Get Git 25 | - [Get the command-line tool](https://atlassian.com/git/tutorials/install-git): [https://atlassian.com/git/tutorials/install-git](https://atlassian.com/git/tutorials/install-git) 26 | - [Get a GitHub Account](https://github.com/join) 27 | - [Download the GitHub Desktop App](https://desktop.github.com) 28 | - And connect it to your online GitHub account 29 | 3. [Install HARK](https://github.com/https://github.com/econ-ark/HARK#Installing-Hark): Go to “Quick Start” in the README.md 30 | - Follow the instructions for installing HARK for Anaconda 31 | 4. Clone the [DemARK](https://github.com/econ-ark/DemARK) and [REMARK](https://github.com/econ-ark/REMARK) repos 32 | - git clone https://github.com/econ-ark/DemARK 33 | - git clone https://github.com/econ-ark/REMARK 34 | 5. Using python from the command line: 35 | - pip install nose 36 | - python -c import HARK ; print(HARK.\_\_file\_\_) 37 | - cd \[root directory for HARK\] 38 | - python -m nose 39 | 40 | ### 2 Motivation 41 | 42 | Models with serious microfoundations yield fundamentally different conclusions than RA models about core questions in macroeconomics. 43 | 44 | 1. How monetary policy works 45 | - HA channels account for most of the mechanism of monetary transmission 46 | 2. Whether fiscal policy works 47 | - ‘serious’ HA models are consistent with evidence of MPC’s of 0.5 48 | 3. What made the Great Recession Great 49 | - RA models: Mostly a supply shock 50 | - HA models: Mostly a demand shock 51 | 52 | Slides: 53 | 54 | - [Intro to Monetary Policy with Heterogeneity](https://github.com/llorracc/resources/blob/master/Slides/CrawleyMonPolicywithHeterogeniety.pdf), [Crawley](#XCrawleyMonPolicywithHeterogeneity) ([2019](#XCrawleyMonPolicywithHeterogeneity)) 55 | 56 | Readings: 57 | 58 | - [Ahn et al](http://www.princeton.edu/~moll/WIMM.pdf) ([2017](#XakmwwInequality)), Introduction, Conclusion 59 | - Compact and well written discussion of the state and progress of HA macro. 60 | - [Carroll and Crawley](#XakmwwInequality-Discuss) ([2017](#XakmwwInequality-Discuss)), [Sections 1, 2, and 4](http://econ.jhu.edu/people/ccarroll/discuss/2017-04_NBER_Macro-Annual/akmwwInequality/) 61 | - This discussion of that paper puts the relationship of HA to RA models in context. 62 | 63 | ### 3 Micro Models 64 | 65 | #### 3.1 Micro Consumption Theory Refresher 66 | 67 | The course will assume that students are familiar with standard quantitative tools for solving RA models, like DYNARE. The bulk of the “hands-on” part of the course will therefore involve learning and using tools for solving micro problems with ‘serious’ microfoundations. 68 | 69 | ##### 3.1.1 The Infinite Horizon Perfect Foresight Model 70 | 71 | Absolute, Return, and Growth Impatience 72 | 73 | Notes: 74 | 75 | - [Consumption Under Perfect Foresight and CRRA Utility](http://econ.jhu.edu/people/ccarroll/public/LectureNotes/Consumption/PerfForesightCRRA/) 76 | - [The Certainty Equivalent Consumption Function](http://econ.jhu.edu/people/ccarroll/public/LectureNotes/Consumption/ConsumptionFunction/) 77 | 78 | ##### 3.1.2 Consumption With Labor Income Uncertainty 79 | 80 | - Notes: [A Tractable Model of Buffer Stock Saving](http://econ.jhu.edu/people/ccarroll/public/LectureNotes/Consumption/TractableBufferStock/) 81 | - Notebook: [Interactive Demo](https://mybinder.org/v2/gh/econ-ark/DemARK/master?filepath=notebooks/TractableBufferStockQuickDemo.ipynb) 82 | 83 | Readings 84 | 85 | - [Carroll](#Xcarroll:death) ([2001](#Xcarroll:death)) 86 | 87 | ##### 3.1.3 Rate-Of-Return Uncertainty without Labor Income 88 | 89 | Under CRRA utility, without labor income risk: 90 | 91 | 1. The consumption function is linear 92 | 2. An increase in risk reduces consumption and the MPC 93 | 94 | Notes: [Consumption out of Risky Assets](http://econ.jhu.edu/people/ccarroll/public/LectureNotes/Consumption/CRRA-RateRisk/) 95 | 96 | [Consumption With Portfolio Choice](http://econ.jhu.edu/people/ccarroll/public/LectureNotes/AssetPricing/C-With-Optimal-Portfolio/) 97 | 98 | Origins: [Merton](#Xmerton:restat) ([1969](#Xmerton:restat)), [Samuelson](#Xsamuelson:portfolio) ([1969](#Xsamuelson:portfolio)) 99 | 100 | ##### 3.1.4 Habits 101 | 102 | Notes: 103 | 104 | - [Consumption Models with Habit Formation](http://econ.jhu.edu/people/ccarroll/public/LectureNotes/Consumption/Habits/) 105 | 106 | ### 4 Computational Tools 107 | 108 | #### 4.1 Vision for the Econ-ARK Project 109 | 110 | - [Intro-To-Econ-ARK](https://github.com/econ-ark/PARK/blob/master/Intro-To-Econ-ARK-Overlay.pdf) 111 | 112 | ### 5 Hands-On Introduction 113 | 114 | Here we will explain how to begin using the [Econ-ARK](http://econ-ark.org) toolkit for heterogeneous agent macro modeling. Students will be taught how to use the toolkit to solve increasingly sophisticated models, starting with partial equilibrium perfect foresight models and ending with some exercises using a full general equilibrium micro-macro model with idiosyncratic and aggregate risks. 115 | 116 | #### 5.1 A Gentle Introduction 117 | 118 | This section builds our first simple models using the toolkit 119 | 120 | ##### 5.1.1 Perfect Foresight 121 | 122 | Notebook: [A Gentle Introduction to HARK - Perfect Foresight](https://mybinder.org/v2/gh/econ-ark/DemARK/master?filepath=notebooks/Gentle-Intro-To-HARK-PerfForesightCRRA.ipynb) 123 | 124 | ##### 5.1.2 Adding ‘Serious’ Income Uncertainty 125 | 126 | Notebook: [A Gentle Introduction to Buffer Stock Saving](https://mybinder.org/v2/gh/econ-ark/DemARK/master?filepath=notebooks/Gentle-Intro-To-HARK-Buffer-Stock-Model.ipynb) 127 | 128 | #### 5.2 Liquidity Constraints, Precautionary Saving, and Impatience 129 | 130 | 1. The Growth Impatience Condition 131 | 2. Liquidity Constraints and Precautionary Saving 132 | 3. Impatience and Target Wealth 133 | 134 | Notebook: [BufferStockTheory Problems](https://econ-ark.org/materials/BufferStockTheory-Problems.ipynb) 135 | 136 | #### 5.3 ‘Serious’ Wealth Inequality 137 | 138 | Notebook: [Micro-and-Macro-Implications-of-Very-Impatient-HHs-Problems](https://mybinder.org/v2/gh/econ-ark/DemARK/master?filepath=notebooks/Micro-and-Macro-Implications-of-Very-Impatient-HHs-Problems.ipynb) 139 | 140 | References: [Carroll, Slacalek, Tokuoka, and White](#XcstwMPC) ([2017](#XcstwMPC)) 141 | 142 | #### 5.4 Matching the Distribution – of the MPC 143 | 144 | - : [Figure 5,](http://www.econ2.jhu.edu/people/ccarroll/papers/cstwMPC/#x1-130075) [Carroll, Slacalek, Tokuoka, and White](#XcstwMPC) ([2017](#XcstwMPC)) 145 | - : [Figure 10b,](https://github.com/llorracc/Figures/blob/master/Crawley-MPC-By-Liquid-Assets.png) [Crawley and Kuchler](#XckConsumption) ([2018](#XckConsumption)) 146 | 147 | #### 5.5 Hands-On with Real HA Models 148 | 149 | For an economy in steady state (that is, with constant factor prices like interest rates and wages), models with ‘serious’ income heterogeneity have been solvable in partial equilibrium since about 1990 ([Zeldes](#XzeldesStochastic) ([1989](#XzeldesStochastic)), [Deaton](#XdeatonLiqConstr) ([1991](#XdeatonLiqConstr))). Calculating an equilibrium distribution of wealth that results from those policy functions and matching it to the total amount of observed wealth (and a corresponding interest rate) was first done by [Hubbard, Skinner, and Zeldes](#Xhsz:importance) ([1994](#Xhsz:importance)) using a supercomputer. [Aiyagari](#Xaiyagari:ge) ([1994](#Xaiyagari:ge)) proposed a radically simple model that did not attempt to match the distributions of wealth and income, but could be solved without a supercomputer. 150 | 151 | In a rational expectations steady state, there are no expected changes in interest rates, wages, or the distribution. Aggregate fluctuations make calculation of an RE equilibrium massively more difficult, because: 152 | 153 | 1. Meaningful aggregate fluctuations will change the distribution of wealth and income 154 | 2. The amount of aggregate saving depends on how aggregate wealth and income are distributed 155 | 3. The amount of saving determines future factor prices 156 | 4. In principle, RE therefore requires that everyone know the entire distribution of wealth, income, and any other state variables in the population 157 | 158 | The problem therefore suffers from a severe case of the “curse of dimensionality.” (That is, it’s really hard!). The first paper to tackle the problem was [Krusell and Smith](#XksHetero) ([1998](#XksHetero)). Work by [Bayer and Luetticke](#XblSolving) ([2018](#XblSolving)) builds on all of the prior work to construct a reasonable HANK model that can be solved in a few minutes on a laptop. The key contribution of [Krusell and Smith](#XksHetero) ([1998](#XksHetero)) was to discover that, in practice, highly accurate predictions of future aggregate states could be made using only the mean of the current aggregate capital stock 159 | 160 | Notebook: [KrusellSmith.ipynb](https://mybinder.org/v2/gh/econ-ark/DemARK/master?filepath=notebooks/KrusellSmith.ipynb) 161 | 162 | #### 5.6 The Micro Steady State and Macro Fluctuations 163 | 164 | A problem with solving methods using the original Krusell Smith method is that the computational challenge was so great that only the simplest such models could be solved, and the ability to construct standard tools like impulse response functions to aggregate shocks was very limited. 165 | 166 | [Reiter](#XreiterSolving) ([2009](#XreiterSolving)) showed how to solve such problems several orders of magnitude faster; the essence of his idea was to solve the micro problem for the steady-state distribution, and then capture business cycle fluctuations by figuring out how to perturb the decision rules and the distribution appropriately. 167 | 168 | Building on his work, the last few years have seen great further strides in speed and power of such tools. 169 | 170 | References: 171 | 172 | - [Reiter](#XreiterSolving) ([2009](#XreiterSolving)) 173 | - [Boppart, Krusell, and Mitman](#XbmpMITshocks) ([2018](#XbmpMITshocks)) 174 | - [Ahn, Kaplan, Moll, Winberry, and Wolf](#XakmwwInequality) ([2017](#XakmwwInequality)) 175 | - [Bayer and Luetticke](#XblSolving) ([2018](#XblSolving)) 176 | 177 | #### 5.7 The Bayer-Luetticke Method 178 | 179 | - Notebooks: 180 | - [OneAsset HANK Model](https://mybinder.org/v2/gh/econ-ark/HARK/master?filepath=HARK/BayerLuetticke/notebooks/OneAsset-HANK.ipynb) 181 | - [TwoAsset HANK Model](https://mybinder.org/v2/gh/econ-ark/HARK/master?filepath=HARK/BayerLuetticke/notebooks/TwoAsset.ipynb) 182 | - [DCT-Copula-Illustration](https://mybinder.org/v2/gh/econ-ark/HARK/master?filepath=HARK/BayerLuetticke/notebooks/DCT-Copula-Illustration.ipynb) 183 | 184 | #### 5.8 Other Literature 185 | 186 | References: 187 | 188 | - [Monetary Policy Transmission with Many Agents](https://github.com/llorracc/Resources/blob/master/Papers/SSinHANK.pdf), [Crawley and Lee](#XSSinHANK) ([2019](#XSSinHANK)) 189 | - [Macroprudential Policies in a Heterogeneous Agent Model of Housing Default](https://pdfs.semanticscholar.org/8e9d/dfe7c204bbfa8a23f42f4931461fb467fc08.pdf?_ga=2.95712860.1156899890.1563925023-1991616136.1563925023), [Khan](#XkhanMacroPru) ([2019](#XkhanMacroPru)) 190 | - [Redistribution, risk premia, and the macroeconomy](https://github.com/llorracc/resources/blob/master/Slides/klRiskPremia.pdf), [Kekre and Lenel](#XklRiskPremia) ([2019](#XklRiskPremia)) 191 | - [The Missing Intercept: A Sufficient Statistics Approach to General Equilibrium Effects](https://github.com/llorracc/resources/blob/master/Slides/wolfGE-invariance.pdf), [Wolf](#XwolfGEInvariance) ([2019](#XwolfGEInvariance)) 192 | 193 | ### References 194 | 195 | ahn, sehyoun, greg kaplan, benjamin moll, thomas winberry, and christian wolf (2017): “When Inequality Matters for Macro and Macro Matters for Inequality,” NBER Macroeconomics Annual, 32. 196 | 197 | aiyagari, s. rao (1994): “Uninsured Idiosyncratic Risk and Aggregate Saving,” Quarterly Journal of Economics, 109, 659–684. 198 | 199 | bayer, christian, and ralph luetticke (2018): “Solving Heterogeneous Agent Models In Discrete Time With Many Idiosyncratic States By Perturbation Methods,” Centre for Economic Policy Research, Discussion Paper 13071. 200 | 201 | blanchard, olivier (2016): “Do DSGE Models Have a Future?,” Discussion paper, Petersen Institute for International Economics, Available atGenerator: BufferStockTheory-make/notebooks_byname
" 10 | ] 11 | }, 12 | { 13 | "cell_type": "markdown", 14 | "metadata": {}, 15 | "source": [ 16 | "The [TractableBufferStock](http://www.econ2.jhu.edu/people/ccarroll/public/LectureNotes/Consumption/TractableBufferStock/) model is a (relatively) simple framework that captures all of the qualitative, and many of the quantitative features of optimal consumption in the presence of labor income uncertainty. " 17 | ] 18 | }, 19 | { 20 | "cell_type": "code", 21 | "execution_count": 8, 22 | "metadata": { 23 | "code_folding": [] 24 | }, 25 | "outputs": [], 26 | "source": [ 27 | "# This cell has a bit of (uninteresting) initial setup.\n", 28 | "\n", 29 | "import matplotlib.pyplot as plt\n", 30 | "\n", 31 | "import numpy as np\n", 32 | "import HARK \n", 33 | "from time import clock\n", 34 | "from copy import deepcopy\n", 35 | "mystr = lambda number : \"{:.3f}\".format(number)\n", 36 | "\n", 37 | "from ipywidgets import interact, interactive, fixed, interact_manual\n", 38 | "import ipywidgets as widgets\n", 39 | "from HARK.utilities import plotFuncs" 40 | ] 41 | }, 42 | { 43 | "cell_type": "code", 44 | "execution_count": 9, 45 | "metadata": { 46 | "code_folding": [] 47 | }, 48 | "outputs": [], 49 | "source": [ 50 | "# Import the model from the toolkit\n", 51 | "from HARK.ConsumptionSaving.TractableBufferStockModel import TractableConsumerType" 52 | ] 53 | }, 54 | { 55 | "cell_type": "markdown", 56 | "metadata": {}, 57 | "source": [ 58 | "The key assumption behind the model's tractability is that there is only a single, stark form of uncertainty: So long as an employed consumer remains employed, that consumer's labor income $P$ will rise at a constant rate $\\Gamma$:\n", 59 | "\\begin{align}\n", 60 | "P_{t+1} &= \\Gamma P_{t}\n", 61 | "\\end{align}\n", 62 | "\n", 63 | "But, between any period and the next, there is constant hazard $p$ that the consumer will transition to the \"unemployed\" state. Unemployment is irreversible, like retirement or disability. When unemployed, the consumer receives a fixed amount of income (for simplicity, zero). (See the [linked handout](http://www.econ2.jhu.edu/people/ccarroll/public/LectureNotes/Consumption/TractableBufferStock/) for details of the model).\n", 64 | "\n", 65 | "Defining $G$ as the growth rate of aggregate wages/productivity, we assume that idiosyncratic wages grow by $\\Gamma = G/(1-\\mho)$ where $(1-\\mho)^{-1}$ is the growth rate of idiosyncratic productivity ('on-the-job learning', say). (This assumption about the relation between idiosyncratic income growth and idiosyncratic risk means that an increase in $\\mho$ is a mean-preserving spread in human wealth; again see [the lecture notes](http://www.econ2.jhu.edu/people/ccarroll/public/LectureNotes/Consumption/TractableBufferStock/)).\n", 66 | "\n", 67 | "Under CRRA utility $u(C) = \\frac{C^{1-\\rho}}{1-\\rho}$, the problem can be normalized by $P$. Using lower case for normalized varibles (e.g., $c = C/P$), the normalized problem can be expressed by the Bellman equation:\n", 68 | "\n", 69 | "\\begin{eqnarray*}\n", 70 | "v_t({m}_t) &=& \\max_{{c}_t} ~ U({c}_t) + \\beta \\Gamma^{1-\\rho} \\overbrace{\\mathbb{E}[v_{t+1}^{\\bullet}]}^{=p v_{t+1}^{u}+(1-p)v_{t+1}^{e}} \\\\\n", 71 | "& s.t. & \\\\\n", 72 | "{m}_{t+1} &=& (m_{t}-c_{t})\\mathcal{R} + \\mathbb{1}_{t+1},\n", 73 | "\\end{eqnarray*}\n", 74 | "where $\\mathcal{R} = R/\\Gamma$, and $\\mathbb{1}_{t+1} = 1$ if the consumer is employed (and zero if unemployed).\n", 75 | "\n", 76 | "Under plausible parameter values the model has a target level of $\\check{m} = M/P$ (market resources to permanent income) with an analytical solution that exhibits plausible relationships among all of the parameters. \n", 77 | "\n", 78 | "Defining $\\gamma = \\log \\Gamma$ and $r = \\log R$, the handout shows that an approximation of the target is given by the formula:\n", 79 | "\n", 80 | "\\begin{align}\n", 81 | "\\check{m} & = 1 + \\left(\\frac{1}{(\\gamma-r)+(1+(\\gamma/\\mho)(1-(\\gamma/\\mho)(\\rho-1)/2))}\\right)\n", 82 | "\\end{align}\n" 83 | ] 84 | }, 85 | { 86 | "cell_type": "code", 87 | "execution_count": 10, 88 | "metadata": { 89 | "code_folding": [] 90 | }, 91 | "outputs": [], 92 | "source": [ 93 | "# Define a parameter dictionary and representation of the agents for the tractable buffer stock model\n", 94 | "TBS_dictionary = {'UnempPrb' : .00625, # Prob of becoming unemployed; working life of 1/UnempProb = 160 qtrs\n", 95 | " 'DiscFac' : 0.975, # Intertemporal discount factor\n", 96 | " 'Rfree' : 1.01, # Risk-free interest factor on assets\n", 97 | " 'PermGroFac' : 1.0025, # Permanent income growth factor (uncompensated)\n", 98 | " 'CRRA' : 2.5} # Coefficient of relative risk aversion\n", 99 | "MyTBStype = TractableConsumerType(**TBS_dictionary)" 100 | ] 101 | }, 102 | { 103 | "cell_type": "markdown", 104 | "metadata": {}, 105 | "source": [ 106 | "## Target Wealth\n", 107 | "\n", 108 | "Whether the model exhibits a \"target\" or \"stable\" level of the wealth-to-permanent-income ratio for employed consumers depends on whether the 'Growth Impatience Condition' (the GIC) holds:\n", 109 | "\n", 110 | "\\begin{align}\\label{eq:GIC}\n", 111 | " \\left(\\frac{(R \\beta (1-\\mho))^{1/\\rho}}{\\Gamma}\\right) & < 1\n", 112 | "\\\\ \\left(\\frac{(R \\beta (1-\\mho))^{1/\\rho}}{G (1-\\mho)}\\right) &< 1\n", 113 | "\\\\ \\left(\\frac{(R \\beta)^{1/\\rho}}{G} (1-\\mho)^{-\\rho}\\right) &< 1\n", 114 | "\\end{align}\n", 115 | "and recall (from [PerfForesightCRRA](http://econ.jhu.edu/people/ccarroll/public/lecturenotes/consumption/PerfForesightCRRA/)) that the perfect foresight 'Growth Impatience Factor' is \n", 116 | "\\begin{align}\\label{eq:PFGIC}\n", 117 | "\\left(\\frac{(R \\beta)^{1/\\rho}}{G}\\right) &< 1\n", 118 | "\\end{align}\n", 119 | "so since $\\mho > 0$, uncertainty makes it harder to be 'impatient.' To understand this, think of someone who, in the perfect foresight model, was 'poised': Exactly on the knife edge between patience and impatience. Now add a precautionary saving motive; that person will now (to some degree) be pushed off the knife edge in the direction of 'patience.' So, in the presence of uncertainty, the conditions on parameters other than $\\mho$ must be stronger in order to guarantee 'impatience' in the sense of wanting to spend enough for your wealth to decline _despite_ the extra precautionary motive." 120 | ] 121 | }, 122 | { 123 | "cell_type": "code", 124 | "execution_count": 11, 125 | "metadata": { 126 | "code_folding": [] 127 | }, 128 | "outputs": [ 129 | { 130 | "data": { 131 | "application/vnd.jupyter.widget-view+json": { 132 | "model_id": "1dbf73b6e8744246834d9bbcc0396d13", 133 | "version_major": 2, 134 | "version_minor": 0 135 | }, 136 | "text/plain": [ 137 | "interactive(children=(FloatSlider(value=0.975, continuous_update=False, description='$\\\\beta$', max=0.99, min=…" 138 | ] 139 | }, 140 | "metadata": {}, 141 | "output_type": "display_data" 142 | } 143 | ], 144 | "source": [ 145 | "# Define a function that plots the employed consumption function and sustainable consumption function \n", 146 | "# for given parameter values\n", 147 | "\n", 148 | "def makeTBSplot(DiscFac,CRRA,Rfree,PermGroFac,UnempPrb,mMax,mMin,cMin,cMax,plot_emp,plot_ret,plot_mSS,show_targ):\n", 149 | " MyTBStype.DiscFac = DiscFac\n", 150 | " MyTBStype.CRRA = CRRA\n", 151 | " MyTBStype.Rfree = Rfree\n", 152 | " MyTBStype.PermGroFac = PermGroFac\n", 153 | " MyTBStype.UnempPrb = UnempPrb\n", 154 | " \n", 155 | " try:\n", 156 | " MyTBStype.solve()\n", 157 | " except:\n", 158 | " print('Unable to solve; parameter values may be too close to their limiting values') \n", 159 | " \n", 160 | " plt.xlabel('Market resources ${m}_t$')\n", 161 | " plt.ylabel('Consumption ${c}_t$')\n", 162 | " plt.ylim([cMin,cMax])\n", 163 | " plt.xlim([mMin,mMax])\n", 164 | " \n", 165 | " m = np.linspace(mMin,mMax,num=100,endpoint=True)\n", 166 | " if plot_emp:\n", 167 | " c = MyTBStype.solution[0].cFunc(m)\n", 168 | " c[m==0.] = 0.\n", 169 | " plt.plot(m,c,'-b')\n", 170 | " \n", 171 | " if plot_mSS:\n", 172 | " plt.plot([mMin,mMax],[(MyTBStype.PermGroFacCmp/MyTBStype.Rfree + mMin*(1.0-MyTBStype.PermGroFacCmp/MyTBStype.Rfree)),(MyTBStype.PermGroFacCmp/MyTBStype.Rfree + mMax*(1.0-MyTBStype.PermGroFacCmp/MyTBStype.Rfree))],'--k')\n", 173 | " \n", 174 | " if plot_ret:\n", 175 | " c = MyTBStype.solution[0].cFunc_U(m)\n", 176 | " plt.plot(m,c,'-g')\n", 177 | " \n", 178 | " if show_targ:\n", 179 | " mTarg = MyTBStype.mTarg\n", 180 | " cTarg = MyTBStype.cTarg\n", 181 | " targ_label = r'$\\left(\\frac{1}{(\\gamma-r)+(1+(\\gamma/\\mho)(1-(\\gamma/\\mho)(\\rho-1)/2))}\\right) $' #+ mystr(mTarg) + '\\n$\\check{c}^* = $ ' + mystr(cTarg)\n", 182 | " plt.annotate(targ_label,xy=(0.0,0.0),xytext=(0.2,0.1),textcoords='axes fraction',fontsize=18)\n", 183 | " plt.plot(mTarg,cTarg,'ro')\n", 184 | " plt.annotate('↙️ m target',(mTarg,cTarg),xytext=(0.25,0.2),ha='left',textcoords='offset points')\n", 185 | " \n", 186 | " plt.show()\n", 187 | " return None\n", 188 | "\n", 189 | "# Define widgets to control various aspects of the plot\n", 190 | "\n", 191 | "# Define a slider for the discount factor\n", 192 | "DiscFac_widget = widgets.FloatSlider(\n", 193 | " min=0.9,\n", 194 | " max=0.99,\n", 195 | " step=0.0002,\n", 196 | " value=TBS_dictionary['DiscFac'], # Default value\n", 197 | " continuous_update=False,\n", 198 | " readout_format='.4f',\n", 199 | " description='$\\\\beta$')\n", 200 | "\n", 201 | "# Define a slider for relative risk aversion\n", 202 | "CRRA_widget = widgets.FloatSlider(\n", 203 | " min=1.0,\n", 204 | " max=5.0,\n", 205 | " step=0.01,\n", 206 | " value=TBS_dictionary['CRRA'], # Default value\n", 207 | " continuous_update=False,\n", 208 | " readout_format='.2f',\n", 209 | " description='$\\\\rho$')\n", 210 | "\n", 211 | "# Define a slider for the interest factor\n", 212 | "Rfree_widget = widgets.FloatSlider(\n", 213 | " min=1.01,\n", 214 | " max=1.04,\n", 215 | " step=0.0001,\n", 216 | " value=TBS_dictionary['Rfree'], # Default value\n", 217 | " continuous_update=False,\n", 218 | " readout_format='.4f',\n", 219 | " description='$R$')\n", 220 | "\n", 221 | "\n", 222 | "# Define a slider for permanent income growth\n", 223 | "PermGroFac_widget = widgets.FloatSlider(\n", 224 | " min=1.00,\n", 225 | " max=1.015,\n", 226 | " step=0.0002,\n", 227 | " value=TBS_dictionary['PermGroFac'], # Default value\n", 228 | " continuous_update=False,\n", 229 | " readout_format='.4f',\n", 230 | " description='$G$')\n", 231 | "\n", 232 | "# Define a slider for unemployment (or retirement) probability\n", 233 | "UnempPrb_widget = widgets.FloatSlider(\n", 234 | " min=0.000001,\n", 235 | " max=TBS_dictionary['UnempPrb']*2, # Go up to twice the default value\n", 236 | " step=0.00001,\n", 237 | " value=TBS_dictionary['UnempPrb'],\n", 238 | " continuous_update=False,\n", 239 | " readout_format='.5f',\n", 240 | " description='$\\\\mho$')\n", 241 | "\n", 242 | "# Define a text box for the lower bound of {m}_t\n", 243 | "mMin_widget = widgets.FloatText(\n", 244 | " value=0.0,\n", 245 | " step=0.1,\n", 246 | " description='$m$ min',\n", 247 | " disabled=False)\n", 248 | "\n", 249 | "# Define a text box for the upper bound of {m}_t\n", 250 | "mMax_widget = widgets.FloatText(\n", 251 | " value=50.0,\n", 252 | " step=0.1,\n", 253 | " description='$m$ max',\n", 254 | " disabled=False)\n", 255 | "\n", 256 | "# Define a text box for the lower bound of {c}_t\n", 257 | "cMin_widget = widgets.FloatText(\n", 258 | " value=0.0,\n", 259 | " step=0.1,\n", 260 | " description='$c$ min',\n", 261 | " disabled=False)\n", 262 | "\n", 263 | "# Define a text box for the upper bound of {c}_t\n", 264 | "cMax_widget = widgets.FloatText(\n", 265 | " value=1.5,\n", 266 | " step=0.1,\n", 267 | " description='$c$ max',\n", 268 | " disabled=False)\n", 269 | "\n", 270 | "# Define a check box for whether to plot the employed consumption function\n", 271 | "plot_emp_widget = widgets.Checkbox(\n", 272 | " value=True,\n", 273 | " description='Plot employed $c$ function',\n", 274 | " disabled=False)\n", 275 | "\n", 276 | "# Define a check box for whether to plot the retired consumption function\n", 277 | "plot_ret_widget = widgets.Checkbox(\n", 278 | " value=False,\n", 279 | " description='Plot retired $c$ function',\n", 280 | " disabled=False)\n", 281 | "\n", 282 | "# Define a check box for whether to plot the sustainable consumption line\n", 283 | "plot_mSS_widget = widgets.Checkbox(\n", 284 | " value=True,\n", 285 | " description='Plot sustainable $c$ line',\n", 286 | " disabled=False)\n", 287 | "\n", 288 | "# Define a check box for whether to show the target annotation\n", 289 | "show_targ_widget = widgets.Checkbox(\n", 290 | " value=True,\n", 291 | " description = 'Show target $(m,c)$',\n", 292 | " disabled = False)\n", 293 | "\n", 294 | "# Make an interactive plot of the tractable buffer stock solution\n", 295 | "\n", 296 | "# To make some of the widgets not appear, replace X_widget with fixed(desired_fixed_value) in the arguments below.\n", 297 | "interact(makeTBSplot,\n", 298 | " DiscFac = DiscFac_widget,\n", 299 | " CRRA = CRRA_widget,\n", 300 | " Rfree = Rfree_widget,\n", 301 | " PermGroFac = PermGroFac_widget,\n", 302 | " UnempPrb = UnempPrb_widget,\n", 303 | " mMin = mMin_widget,\n", 304 | " mMax = mMax_widget,\n", 305 | " cMin = cMin_widget,\n", 306 | " cMax = cMax_widget,\n", 307 | " show_targ = show_targ_widget,\n", 308 | " plot_emp = plot_emp_widget,\n", 309 | " plot_ret = plot_ret_widget,\n", 310 | " plot_mSS = plot_mSS_widget,\n", 311 | " );\n", 312 | "\n" 313 | ] 314 | }, 315 | { 316 | "cell_type": "markdown", 317 | "metadata": {}, 318 | "source": [ 319 | "# PROBLEM\n", 320 | "\n", 321 | "Your task is to make a simplified slider that involves only $\\beta$. \n", 322 | "\n", 323 | "First, create a variable `betaMax` equal to the value of $\\beta$ at which the Growth Impatience Factor is exactly equal to 1 (that is, the consumer is exactly on the border between patience and impatience). (Hint: The formula for this is [here](http://www.econ2.jhu.edu/people/ccarroll/public/LectureNotes/Consumption/TractableBufferStock/#GIFMax)).\n", 324 | "\n", 325 | "Next, create a slider/'widget' like the one above, but where all variables except $\\beta$ are set to their default values, and the slider takes $\\beta$ from 0.05 below its default value up to `betaMax - 0.01`. (The numerical solution algorithm becomes unstable when the GIC is too close to being violated, so you don't want to go all the way up to `betaMax.`)\n", 326 | "\n", 327 | "Explain the logic of the result that you see.\n", 328 | "\n", 329 | "(Hint: You do not need to copy and paste (then edit) the entire contents of the cell that creates the widgets above; you only need to modify the `DiscFac_widget`)" 330 | ] 331 | }, 332 | { 333 | "cell_type": "code", 334 | "execution_count": 12, 335 | "metadata": {}, 336 | "outputs": [ 337 | { 338 | "data": { 339 | "application/vnd.jupyter.widget-view+json": { 340 | "model_id": "ac4fbd54b8ca4c1f84418de3e501e411", 341 | "version_major": 2, 342 | "version_minor": 0 343 | }, 344 | "text/plain": [ 345 | "interactive(children=(FloatSlider(value=0.975, continuous_update=False, description='$\\\\beta$', max=1.00840279…" 346 | ] 347 | }, 348 | "metadata": {}, 349 | "output_type": "display_data" 350 | } 351 | ], 352 | "source": [ 353 | "# Define a slider for the discount factor\n", 354 | "\n", 355 | "my_rho = TBS_dictionary['CRRA'];\n", 356 | "my_R = TBS_dictionary['Rfree'];\n", 357 | "my_upsidedownOmega = TBS_dictionary['UnempPrb']; # didnt have time to figure out the right value\n", 358 | "my_Gamma = TBS_dictionary['PermGroFac']/(1-my_upsidedownOmega);\n", 359 | "\n", 360 | "betaMax = (my_Gamma**my_rho)/(my_R*(1-my_upsidedownOmega));\n", 361 | "\n", 362 | "DiscFac_widget = widgets.FloatSlider(\n", 363 | " min=TBS_dictionary['DiscFac']-0.05,\n", 364 | " max=betaMax-0.01,\n", 365 | " step=0.0002,\n", 366 | " value=TBS_dictionary['DiscFac'], # Default value\n", 367 | " continuous_update=False,\n", 368 | " readout_format='.4f',\n", 369 | " description='$\\\\beta$')\n", 370 | "\n", 371 | "interact(makeTBSplot,\n", 372 | " DiscFac = DiscFac_widget,\n", 373 | " CRRA = fixed(TBS_dictionary['CRRA']),\n", 374 | " Rfree = fixed(TBS_dictionary['Rfree']),\n", 375 | " PermGroFac = fixed(TBS_dictionary['PermGroFac']),\n", 376 | " UnempPrb = fixed(TBS_dictionary['UnempPrb']),\n", 377 | " mMin = mMin_widget,\n", 378 | " mMax = mMax_widget,\n", 379 | " cMin = cMin_widget,\n", 380 | " cMax = cMax_widget,\n", 381 | " show_targ = show_targ_widget,\n", 382 | " plot_emp = plot_emp_widget,\n", 383 | " plot_ret = plot_ret_widget,\n", 384 | " plot_mSS = plot_mSS_widget,\n", 385 | " );" 386 | ] 387 | }, 388 | { 389 | "cell_type": "markdown", 390 | "metadata": {}, 391 | "source": [ 392 | "# Target level of market resources increases with increased patience as does the consumption because patience is rewarded by the returns on savings." 393 | ] 394 | }, 395 | { 396 | "cell_type": "markdown", 397 | "metadata": {}, 398 | "source": [ 399 | "# SOLUTION" 400 | ] 401 | }, 402 | { 403 | "cell_type": "code", 404 | "execution_count": 15, 405 | "metadata": {}, 406 | "outputs": [ 407 | { 408 | "data": { 409 | "application/vnd.jupyter.widget-view+json": { 410 | "model_id": "a65cf490bbe04d8f93f51357e37215e7", 411 | "version_major": 2, 412 | "version_minor": 0 413 | }, 414 | "text/plain": [ 415 | "interactive(children=(FloatSlider(value=0.975, continuous_update=False, description='$\\\\beta$', max=1.00840279…" 416 | ] 417 | }, 418 | "metadata": {}, 419 | "output_type": "display_data" 420 | } 421 | ], 422 | "source": [ 423 | "PermGroFac = TBS_dictionary['PermGroFac']\n", 424 | "Rfree = TBS_dictionary['Rfree']\n", 425 | "CRRA = TBS_dictionary['CRRA']\n", 426 | "UnempPrb = TBS_dictionary['UnempPrb']\n", 427 | "Gamma = PermGroFac/(1-UnempPrb)\n", 428 | "BetaMax = (Gamma**CRRA)/(Rfree*(1-UnempPrb))\n", 429 | "\n", 430 | "\n", 431 | "# Define a slider for the discount factor\n", 432 | "\n", 433 | "DiscFac_widget = widgets.FloatSlider(\n", 434 | " min=0.05,\n", 435 | " max=betaMax-0.01,\n", 436 | " step=0.0001,\n", 437 | " value=TBS_dictionary['DiscFac'], # Default value\n", 438 | " continuous_update=False,\n", 439 | " readout_format='.4f',\n", 440 | " description='$\\\\beta$')\n", 441 | "\n", 442 | "interact(makeTBSplot,\n", 443 | " DiscFac = DiscFac_widget,\n", 444 | " CRRA = fixed(TBS_dictionary['CRRA']),\n", 445 | " Rfree = fixed(TBS_dictionary['Rfree']),\n", 446 | " PermGroFac = fixed(TBS_dictionary['PermGroFac']),\n", 447 | " UnempPrb = fixed(TBS_dictionary['UnempPrb']),\n", 448 | " mMin = mMin_widget,\n", 449 | " mMax = mMax_widget,\n", 450 | " cMin = cMin_widget,\n", 451 | " cMax = cMax_widget,\n", 452 | " show_targ = show_targ_widget,\n", 453 | " plot_emp = plot_emp_widget,\n", 454 | " plot_ret = plot_ret_widget,\n", 455 | " plot_mSS = plot_mSS_widget,\n", 456 | " );" 457 | ] 458 | }, 459 | { 460 | "cell_type": "code", 461 | "execution_count": null, 462 | "metadata": {}, 463 | "outputs": [], 464 | "source": [] 465 | } 466 | ], 467 | "metadata": { 468 | "jupytext": { 469 | "cell_metadata_filter": "collapsed,code_folding", 470 | "encoding": "# -*- coding: utf-8 -*-", 471 | "formats": "ipynb,py:percent" 472 | }, 473 | "kernel_info": { 474 | "name": "python3" 475 | }, 476 | "kernelspec": { 477 | "display_name": "Python 3", 478 | "language": "python", 479 | "name": "python3" 480 | }, 481 | "language_info": { 482 | "codemirror_mode": { 483 | "name": "ipython", 484 | "version": 3 485 | }, 486 | "file_extension": ".py", 487 | "mimetype": "text/x-python", 488 | "name": "python", 489 | "nbconvert_exporter": "python", 490 | "pygments_lexer": "ipython3", 491 | "version": "3.7.4" 492 | }, 493 | "latex_envs": { 494 | "LaTeX_envs_menu_present": true, 495 | "autoclose": false, 496 | "autocomplete": true, 497 | "bibliofile": "biblio.bib", 498 | "cite_by": "apalike", 499 | "current_citInitial": 1, 500 | "eqLabelWithNumbers": true, 501 | "eqNumInitial": 1, 502 | "hotkeys": { 503 | "equation": "Ctrl-E", 504 | "itemize": "Ctrl-I" 505 | }, 506 | "labels_anchors": false, 507 | "latex_user_defs": false, 508 | "report_style_numbering": false, 509 | "user_envs_cfg": false 510 | }, 511 | "nteract": { 512 | "version": "0.14.4" 513 | }, 514 | "toc": { 515 | "base_numbering": 1, 516 | "nav_menu": {}, 517 | "number_sections": true, 518 | "sideBar": true, 519 | "skip_h1_title": false, 520 | "title_cell": "Table of Contents", 521 | "title_sidebar": "Contents", 522 | "toc_cell": false, 523 | "toc_position": {}, 524 | "toc_section_display": true, 525 | "toc_window_display": false 526 | } 527 | }, 528 | "nbformat": 4, 529 | "nbformat_minor": 4 530 | } 531 | -------------------------------------------------------------------------------- /notebooks/PerfForesightCRRA-Impatience-Problems.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# Perfect Foresight Model Impatience Conditions" 8 | ] 9 | }, 10 | { 11 | "cell_type": "code", 12 | "execution_count": 1, 13 | "metadata": { 14 | "code_folding": [ 15 | 0 16 | ] 17 | }, 18 | "outputs": [], 19 | "source": [ 20 | "# Initial notebook set up\n", 21 | "\n", 22 | "%matplotlib inline\n", 23 | "import matplotlib.pyplot as plt\n", 24 | "\n", 25 | "# The first step is to be able to bring things in from different directories\n", 26 | "import sys \n", 27 | "import os\n", 28 | "\n", 29 | "sys.path.insert(0, os.path.abspath('../lib'))\n", 30 | "\n", 31 | "import numpy as np\n", 32 | "import HARK \n", 33 | "from time import clock\n", 34 | "from copy import deepcopy\n", 35 | "mystr = lambda number : \"{:.4f}\".format(number)\n", 36 | "from HARK.utilities import plotFuncs\n", 37 | "\n", 38 | "# These last two will make our charts look nice\n", 39 | "plt.style.use('seaborn-darkgrid')\n", 40 | "palette = plt.get_cmap('Dark2')" 41 | ] 42 | }, 43 | { 44 | "cell_type": "markdown", 45 | "metadata": {}, 46 | "source": [ 47 | "After using the Jupyter notebook [Gentle-Intro-To-HARK-PerfForesightCRRA](https://github.com/econ-ark/DemARK/blob/Course-Choice/notebooks/Gentle-Intro-To-HARK-PerfForesightCRRA.ipynb) to learn the basics of HARK, answer the following questions:" 48 | ] 49 | }, 50 | { 51 | "cell_type": "markdown", 52 | "metadata": {}, 53 | "source": [ 54 | "\n", 55 | "\n", 56 | "[PerfectForesightCRRA](http://www.econ2.jhu.edu/people/ccarroll/public/lecturenotes/Consumption/PerfForesightCRRA) defines several 'impatience' conditions that are useful in understanding the model. We will use here the HARK toolkit's solution to the permanent-income-normalized version of the model, which constructs a consumption function for the ratio of consumption to permanent income.\n", 57 | "\n", 58 | "The handout claims that in order for the perfect foresight consumption model to be useful, it is necessary to impose\n", 59 | "the 'return impatience condition' (RIC):\n", 60 | "\n", 61 | "\\begin{eqnarray}\n", 62 | " \\frac{(R \\beta)^{1/\\rho}}{R} & < & 1\n", 63 | "\\end{eqnarray}\n", 64 | "\n", 65 | "and defines some other similar inequalities that help characterize what happens in the model (or whether it has a solution at all).\n", 66 | "\n", 67 | "This question asks you to explore numerically what happens to the consumption function as these conditions get close to failing.\n", 68 | "\n", 69 | "Specifically, given the default set of parameter values used in the notebook below, you should:\n", 70 | "\n", 71 | "1. Plot the consumption function for a perfect foresight consumer with those defaultparameter values, along with the \"sustainable\" level of consumption that would preserve wealth\n", 72 | "1. Calculate the numerical values of the three impatience conditions\n", 73 | "0. Calculate the values of $\\beta$ and $G$ such that the impatience factors on the LHS of the two equations would be exactly equal to 1\n", 74 | "\n", 75 | "Next, along with the sustainable consumption function, you should plot a sequence of consumption functions of a HARK `PerfForesightConsumerType` consumer, for a set of parameter values that go from the default value toward some interesting point:\n", 76 | "\n", 77 | "1. For some sequence of values of $\\beta$ that go from the default value to some value very close to the point where the RIC fails\n", 78 | " * Actually, we do this one for you to show how to do it generically\n", 79 | "0. For some sequence of values of $G$ that go from the default value to some value just below the maximum possible value of $G$. (Why is it the maximum possible value?)\n", 80 | "0. For some sequence of values of $\\rho$ that go from the default value to some value that is very large\n", 81 | "\n", 82 | "and in each case you should explain, using analytical mathematical reasoning, the numerical result you get. (You can just type your answers in the notebook)." 83 | ] 84 | }, 85 | { 86 | "cell_type": "markdown", 87 | "metadata": {}, 88 | "source": [ 89 | "\n", 90 | "\n", 91 | "\n", 92 | "\n" 93 | ] 94 | }, 95 | { 96 | "cell_type": "code", 97 | "execution_count": 3, 98 | "metadata": {}, 99 | "outputs": [], 100 | "source": [ 101 | "# Import the machinery for solving the perfect foresight model and the default parameters\n", 102 | "\n", 103 | "from HARK.ConsumptionSaving.ConsIndShockModel import PerfForesightConsumerType # Import the consumer type\n", 104 | "import HARK.ConsumptionSaving.ConsumerParameters as Params # Import default parameters\n", 105 | "\n", 106 | "# Now extract the default values of the parameters of interest\n", 107 | "\n", 108 | "CRRA = Params.CRRA \n", 109 | "Rfree = Params.Rfree \n", 110 | "DiscFac = Params.DiscFac\n", 111 | "PermGroFac = Params.PermGroFac\n", 112 | "rfree = Rfree-1" 113 | ] 114 | }, 115 | { 116 | "cell_type": "code", 117 | "execution_count": 4, 118 | "metadata": {}, 119 | "outputs": [], 120 | "source": [ 121 | "# Now create a perfect foresight consumer example, \n", 122 | "PFagent = PerfForesightConsumerType(**Params.init_perfect_foresight)\n", 123 | "PFagent.cycles = 0 # We need the consumer to be infinitely lived, or some integer to lifecycle\n", 124 | "PFagent.LivPrb = [1.0] # Suppress the possibility of dying\n", 125 | "\n", 126 | "# Solve the agent's problem\n", 127 | "PFagent.solve()" 128 | ] 129 | }, 130 | { 131 | "cell_type": "code", 132 | "execution_count": 25, 133 | "metadata": { 134 | "scrolled": true 135 | }, 136 | "outputs": [ 137 | { 138 | "data": { 139 | "image/png": "iVBORw0KGgoAAAANSUhEUgAAAiIAAAFuCAYAAAC8xnOgAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjEsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy8QZhcZAAAgAElEQVR4nO3deXyU5b338c9MEgIhgUASFhFZBC5gBrHua7Va912pC1LrilpprT5utdrqadWnra22etoerNbW1h6f2tqi9Wl7nm6natV6VDKTwBUQcEG2CQQIgWwzzx/3TDIJSZgkM7ln7vm+Xy9fJnNPZn5XJsl8ue/rd12+WCyGiIiIiBv8bhcgIiIi+UtBRERERFyjICIiIiKuURARERER1yiIiIiIiGsURERERMQ1hW4X0JstW3ZmpK+4tLSYxsbmTDx01kge41sb3+TM33yan57xS86YdpbLlaVXvr2WXqUxeoPG6A2ZHGNVVZmvp9vz7oxIYWGB2yVkXPIYw5EQAMHKeW6VkzH59lp6lcboDRqjN7gxxrwLIvkmHAkxuric/Usnu12KiIjIXhREPK6mvppgxTx8vh7PiImIiLhKQcTD2qPt1NbXePKyjIiIeIOCiIet2f4eu9t2E1AQERGRLKUg4mHhSDUAwcqDXK5ERESkZwoiHhaOhCjyFzFrjHG7FBERkR4piHhYOFKNGTuHYQXD3C5FRESkRwoiHhaOhD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XBU/ONnk25/EXgxU8/rhpr6MKAVVUVERPpLK2+lQThSDUCgQkFERESkPxRE0iAcCTFh5ESqSqrcLkVERCSnKIikQTgSIqizISIiIv2mIDJIze3N1G1bqYmqIiIiA6AgMkh1W1fSFm3TRFUREZEBUBAZpMTS7goiIiIi/acgMkjhSDUlhSOZOnq626WIiIjkHAWRQQrXhwhUBvH79K0UERHpL717DkIsFnM6ZnRZRkREZEAURAbhg53vs7NlhzpmREREBkhBZBA6JqpqDREREZEBURAZhHCkGr/Pz+yKuW6XIiIikpMURAahJhJiZvksRhSOcLsUERGRnKQgMgjhSIiAJqqKiIgMmILIAG3bs5WPGj/URFUREZFBUBAZoJr6MKAVVUVERAZDQWSAwpFqAALqmBERERkwBZEBCkdCTBg5kaqSKrdLERERyVkKIgMU2lKt9UNEREQGSUFkAPa07WFVg1XHjIiIyCApiAxA3baVtEXbmKeOGRERkUFREBmAjqXddUZERERkUBREBiAcqaakcCRTR2FavDQAABpHSURBVE93uxQREZGcpiAyAM6KqkH8Pn37REREBkPvpP0UjUUJR0KaHyIiIpIGCiL99MGO92ls3aml3UVERNJAQaSfNFFVREQkfRRE+ilcX02BrwAzdo7bpYiIiOQ8BZF+qomEmDlmFiMKR7hdioiISM5TEOmncCSkje5ERETSREGkH7buqWd940eaqCoiIpImCiL9UBMJA5qoKiIiki4KIv2Q6JjRZnciIiLpoSDSD6HIciaO3I/KEZVulyIiIuIJCiL9UBMJ6bKMiIhIGimIpGhP2x7qtlkFERERkTRSEEmR3bqC9li7OmZERETSSEEkRZqoKiIikn4KIikK11dTWlTG1FHT3C5FRETEMxREUhSOhAhUBvH79C0TERFJF72rpiAai1ITCWuiqoiISJopiKTg/R3raGzdSbBCE1VFRETSSUEkBYmJqjojIiIikl4KIimoiVRT4CvAjJ3jdikiIiKeoiCSgnAkxKwxhuGFw90uRURExFMURFLgdMzosoyIiEi6KYjsQ/3uej7etV4rqoqIiGSAgsg+1NRroqqIiEimKIjsQ8fS7hUKIiIiIummILIP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IiOQNBZG4mogmqoqIiAw1BRFgd9tuVjXUEVAQERERGVIKIsDK+lqisSjBCnXMiIiIDCUFEZz1Q0AdMyLiTWvWvMftt9/MF75wPddeewVPPvkfxGIxt8vaS3NzMy+++FsAXn75RV555e+DerwTTzyKJUsWd/z38MP/Ox1l8u67b7N69SoA7r779kE9Vm1tmEWLLuZHP3o8HaV18cAD9/H66691ue3cc0/r8vmdd97CHXfc0uW2BQvO4aabrmPJksV8/vPXctVVC1m5shaAJUsW8/776wBoampiyZLFPPPM04Oqs3BQX+0R4Ug1ZcNGccCoKW6XIiKSVjt37uS+++7mgQe+zeTJB9De3s69997F7373a84/f4Hb5XWxdWs9L774W84553zOPPOcQT/eqFGjefzxpWmorKvf/34ZJ598KjNmzOTBB789qMd6883XOf/8C1mw4NI0VZe6TZs2snv3blpbW1m//iMmTdq/49h3v/s4xcXFALzxxj956qmlfOtbj3Yc37Wrkdtuu5lTTjmdCy/8zKDqUBDBad0NVs7D79MJIhHxllde+TuHHHI4kycfAEBBQQH33HM/RUVFADz22CNUV78LwCmnnM7FF1/GAw/cR1FRERs3bqC+PsLdd9+HMbN54IH7WL/+I1paWrjsskWcfPKpLFhwDr/4xfNACT/84WNMmTKVCRMm8vOfP01RURGbN2/ivPMu4u2332L16jo+85nLuOCCBSxa9BkOOuhg1q5dw6hRo7jvvgf52c+eYt26tfzkJ08QjUapqKjg/PMX9KvGfdmw4WO+9rW7Wbr0aQAWL76S++9/kJdffpENGz5m27ZtbNq0gS984VaOPPJoXn31H/zkJ08AEAwGOP30c3njjX9SV7eSqVOns3jx51i27I/U1a3kkUe+TUFBAcOGDeOOO+4hFoty331fYdy48axf/xFz5wa47bYvd9RSWxvmpZd+R2FhEVVV4/nxj3/I5MlTKCoq4rbbvszXv34vu3btor29neuuu5FDDz2cK664hPnzD2HNmtUccMAUxowZy/Ll71BUVMTDD3+fwsLU39Zfeul3HHfcCRQXF/PCC8+zZMmXerzfxo0bKCsr6/h8586dfOMbX+PCCz/DGWec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