├── source ├── rst │ ├── _static │ ├── zreferences.rst │ ├── index_lq_control.rst │ ├── search.rst │ ├── index_asset_pricing.rst │ ├── index_data_and_empirics.rst │ ├── about_lectures.rst │ ├── index_multi_agent_models.rst │ ├── index_search.rst │ ├── index_information.rst │ ├── index_tools_and_techniques.rst │ ├── 404.rst │ ├── index_savings_growth.rst │ ├── status.rst │ ├── index_intro_dynam.rst │ ├── index_toc.rst │ ├── troubleshooting.rst │ ├── index.rst │ ├── .ipynb_checkpoints │ │ ├── Untitled-checkpoint.ipynb │ │ └── changethis-checkpoint.ipynb │ ├── egm_policy_iter.rst │ ├── schelling.rst │ ├── time_series_with_matrices.rst │ ├── optgrowth_fast.rst │ ├── sir_model.rst │ ├── likelihood_bayes.rst │ ├── inventory_dynamics.rst │ └── mccall_fitted_vfi.rst └── _static │ ├── qe-logo-large.png │ ├── lecture_specific │ ├── ifp │ │ ├── pi2.pdf │ │ ├── ifp_histogram.png │ │ ├── ifp_policies.png │ │ └── ifp_agg_savings.png │ ├── mle │ │ └── fp.dta │ ├── ols │ │ ├── maketable1.dta │ │ ├── maketable2.dta │ │ └── maketable4.dta │ ├── optgrowth │ │ ├── 3ndp.pdf │ │ ├── solution_og_ex2.png │ │ ├── cd_analytical.py │ │ ├── solve_model.py │ │ └── bellman_operator.py │ ├── kalman │ │ ├── kalman_ex3.png │ │ ├── kl_ex1_fig.png │ │ └── kl_ex2_fig.png │ ├── linear_models │ │ ├── tsh.png │ │ ├── tsh0.png │ │ ├── tsh_hg.png │ │ ├── ensemble_mean.png │ │ ├── iteration_notes.pdf │ │ ├── solution_lss_ex1.png │ │ ├── solution_lss_ex2.png │ │ ├── covariance_stationary.png │ │ └── paths_and_stationarity.png │ ├── short_path │ │ ├── graph.png │ │ ├── graph2.png │ │ ├── graph3.png │ │ └── graph4.png │ ├── aiyagari │ │ └── aiyagari_obit.pdf │ ├── markov_perf │ │ ├── judd_fig1.png │ │ ├── judd_fig2.png │ │ ├── mpe_vs_monopolist.png │ │ └── duopoly_mpe.py │ ├── pandas_panel │ │ └── venn_diag.png │ ├── troubleshooting │ │ └── launch.png │ ├── finite_markov │ │ ├── web_graph.png │ │ ├── mc_ex1_plot.png │ │ ├── hamilton_graph.png │ │ ├── mc_aperiodicity1.png │ │ ├── mc_aperiodicity2.png │ │ ├── mc_irreducibility1.png │ │ ├── mc_irreducibility2.png │ │ ├── mc_aperiodicity1.gv │ │ ├── mc_aperiodicity2.gv │ │ ├── mc_irreducibility2.gv │ │ ├── mc_irreducibility1.gv │ │ └── web_graph_data.txt │ ├── schelling │ │ ├── schelling_fig1.png │ │ ├── schelling_fig2.png │ │ ├── schelling_fig3.png │ │ └── schelling_fig4.png │ ├── heavy_tails │ │ ├── rank_size_fig1.png │ │ └── light_heavy_fig1.png │ ├── linear_algebra │ │ └── course_notes.pdf │ ├── lqcontrol │ │ ├── solution_lqc_ex1.png │ │ ├── solution_lqc_ex2.png │ │ ├── solution_lqc_ex3_g1.png │ │ ├── solution_lqc_ex3_g10.png │ │ └── solution_lqc_ex3_g50.png │ ├── wald_friedman │ │ ├── wald_dec_rule.png │ │ ├── wald_dec_rule.tex │ │ ├── wf_first_pass.py │ │ └── wald_class.py │ ├── wealth_dynamics │ │ └── htop_again.png │ ├── arellano │ │ ├── arellano_bond_prices.png │ │ ├── arellano_time_series.png │ │ ├── arellano_value_funcs.png │ │ ├── arellano_bond_prices_2.png │ │ └── arellano_default_probs.png │ ├── career │ │ └── career_solutions_ex1_py.png │ ├── lake_model │ │ └── lake_distribution_wages.png │ ├── uncertainty_traps │ │ ├── uncertainty_traps_45.png │ │ ├── uncertainty_traps_mu.png │ │ └── uncertainty_traps_sim.png │ ├── mccall_model_with_separation │ │ ├── mccall_resw_c.png │ │ ├── mccall_resw_alpha.png │ │ └── mccall_resw_beta.png │ ├── cake_eating_numerical │ │ └── analytical.py │ ├── mccall │ │ ├── mccall_vf_plot1.py │ │ ├── mccall_resw_c.py │ │ ├── mccall_resw_beta.py │ │ ├── mccall_resw_alpha.py │ │ └── mccall_resw_gamma.py │ ├── coleman_policy_iter │ │ └── solve_time_iter.py │ ├── perm_income │ │ └── perm_inc_ir.py │ ├── optgrowth_fast │ │ ├── ogm.py │ │ └── ogm_crra.py │ └── odu │ │ └── odu.py │ └── includes │ ├── lecture_howto_py.raw │ └── header.raw ├── requirements.txt ├── theme └── minimal │ ├── static │ ├── sloan_logo.png │ ├── img │ │ ├── py-logo.png │ │ ├── qe-logo.png │ │ ├── search-icon.png │ │ ├── sloan_logo.png │ │ ├── code-block-fade.png │ │ └── powered-by-NumFOCUS-orange.svg │ ├── css │ │ └── qe.python.css │ └── js │ │ └── base.js │ └── templates │ ├── error_report_template.html │ └── html.tpl ├── README.md ├── .gitignore ├── environment.yml ├── scripts ├── texlive.profile ├── linkchecker-test.sh ├── install_latex.sh ├── execution-test.sh └── build-website.sh ├── .github └── workflows │ ├── ci.yml │ ├── coverage.yml │ ├── pdf.yml │ ├── preview.yml │ └── cache.yml ├── LICENSE └── Makefile /source/rst/_static: -------------------------------------------------------------------------------- 1 | ../_static -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | sphinxcontrib-bibtex 2 | sphinxcontrib-jupyter 3 | quantecon -------------------------------------------------------------------------------- /source/_static/qe-logo-large.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantEcon/lecture-python/master/source/_static/qe-logo-large.png -------------------------------------------------------------------------------- /theme/minimal/static/sloan_logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantEcon/lecture-python/master/theme/minimal/static/sloan_logo.png -------------------------------------------------------------------------------- /theme/minimal/static/img/py-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantEcon/lecture-python/master/theme/minimal/static/img/py-logo.png -------------------------------------------------------------------------------- /theme/minimal/static/img/qe-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantEcon/lecture-python/master/theme/minimal/static/img/qe-logo.png -------------------------------------------------------------------------------- /theme/minimal/static/img/search-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantEcon/lecture-python/master/theme/minimal/static/img/search-icon.png -------------------------------------------------------------------------------- /theme/minimal/static/img/sloan_logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantEcon/lecture-python/master/theme/minimal/static/img/sloan_logo.png -------------------------------------------------------------------------------- /source/_static/lecture_specific/ifp/pi2.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantEcon/lecture-python/master/source/_static/lecture_specific/ifp/pi2.pdf -------------------------------------------------------------------------------- /source/_static/lecture_specific/mle/fp.dta: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantEcon/lecture-python/master/source/_static/lecture_specific/mle/fp.dta -------------------------------------------------------------------------------- /theme/minimal/static/img/code-block-fade.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantEcon/lecture-python/master/theme/minimal/static/img/code-block-fade.png -------------------------------------------------------------------------------- /source/_static/lecture_specific/ols/maketable1.dta: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantEcon/lecture-python/master/source/_static/lecture_specific/ols/maketable1.dta -------------------------------------------------------------------------------- /source/_static/lecture_specific/ols/maketable2.dta: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantEcon/lecture-python/master/source/_static/lecture_specific/ols/maketable2.dta -------------------------------------------------------------------------------- /source/_static/lecture_specific/ols/maketable4.dta: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantEcon/lecture-python/master/source/_static/lecture_specific/ols/maketable4.dta -------------------------------------------------------------------------------- /source/_static/lecture_specific/optgrowth/3ndp.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantEcon/lecture-python/master/source/_static/lecture_specific/optgrowth/3ndp.pdf -------------------------------------------------------------------------------- /source/rst/zreferences.rst: -------------------------------------------------------------------------------- 1 | .. _references: 2 | 3 | ********** 4 | References 5 | ********** 6 | 7 | .. bibliography:: /_static/quant-econ.bib 8 | :cited: 9 | -------------------------------------------------------------------------------- /source/_static/lecture_specific/ifp/ifp_histogram.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantEcon/lecture-python/master/source/_static/lecture_specific/ifp/ifp_histogram.png -------------------------------------------------------------------------------- /source/_static/lecture_specific/ifp/ifp_policies.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantEcon/lecture-python/master/source/_static/lecture_specific/ifp/ifp_policies.png -------------------------------------------------------------------------------- /source/_static/lecture_specific/kalman/kalman_ex3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantEcon/lecture-python/master/source/_static/lecture_specific/kalman/kalman_ex3.png -------------------------------------------------------------------------------- /source/_static/lecture_specific/kalman/kl_ex1_fig.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantEcon/lecture-python/master/source/_static/lecture_specific/kalman/kl_ex1_fig.png -------------------------------------------------------------------------------- /source/_static/lecture_specific/kalman/kl_ex2_fig.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantEcon/lecture-python/master/source/_static/lecture_specific/kalman/kl_ex2_fig.png -------------------------------------------------------------------------------- /source/_static/lecture_specific/linear_models/tsh.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantEcon/lecture-python/master/source/_static/lecture_specific/linear_models/tsh.png -------------------------------------------------------------------------------- /source/_static/lecture_specific/short_path/graph.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantEcon/lecture-python/master/source/_static/lecture_specific/short_path/graph.png -------------------------------------------------------------------------------- /source/_static/lecture_specific/short_path/graph2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantEcon/lecture-python/master/source/_static/lecture_specific/short_path/graph2.png -------------------------------------------------------------------------------- /source/_static/lecture_specific/short_path/graph3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantEcon/lecture-python/master/source/_static/lecture_specific/short_path/graph3.png -------------------------------------------------------------------------------- /source/_static/lecture_specific/short_path/graph4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantEcon/lecture-python/master/source/_static/lecture_specific/short_path/graph4.png -------------------------------------------------------------------------------- /source/_static/lecture_specific/ifp/ifp_agg_savings.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantEcon/lecture-python/master/source/_static/lecture_specific/ifp/ifp_agg_savings.png -------------------------------------------------------------------------------- /source/_static/lecture_specific/linear_models/tsh0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantEcon/lecture-python/master/source/_static/lecture_specific/linear_models/tsh0.png -------------------------------------------------------------------------------- /source/_static/lecture_specific/aiyagari/aiyagari_obit.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantEcon/lecture-python/master/source/_static/lecture_specific/aiyagari/aiyagari_obit.pdf -------------------------------------------------------------------------------- /source/_static/lecture_specific/linear_models/tsh_hg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantEcon/lecture-python/master/source/_static/lecture_specific/linear_models/tsh_hg.png -------------------------------------------------------------------------------- /source/_static/lecture_specific/markov_perf/judd_fig1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantEcon/lecture-python/master/source/_static/lecture_specific/markov_perf/judd_fig1.png -------------------------------------------------------------------------------- /source/_static/lecture_specific/markov_perf/judd_fig2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantEcon/lecture-python/master/source/_static/lecture_specific/markov_perf/judd_fig2.png -------------------------------------------------------------------------------- /source/_static/lecture_specific/pandas_panel/venn_diag.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantEcon/lecture-python/master/source/_static/lecture_specific/pandas_panel/venn_diag.png -------------------------------------------------------------------------------- /source/_static/lecture_specific/troubleshooting/launch.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantEcon/lecture-python/master/source/_static/lecture_specific/troubleshooting/launch.png -------------------------------------------------------------------------------- /source/_static/lecture_specific/finite_markov/web_graph.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantEcon/lecture-python/master/source/_static/lecture_specific/finite_markov/web_graph.png -------------------------------------------------------------------------------- /source/_static/lecture_specific/schelling/schelling_fig1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantEcon/lecture-python/master/source/_static/lecture_specific/schelling/schelling_fig1.png -------------------------------------------------------------------------------- /source/_static/lecture_specific/schelling/schelling_fig2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantEcon/lecture-python/master/source/_static/lecture_specific/schelling/schelling_fig2.png -------------------------------------------------------------------------------- /source/_static/lecture_specific/schelling/schelling_fig3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantEcon/lecture-python/master/source/_static/lecture_specific/schelling/schelling_fig3.png -------------------------------------------------------------------------------- /source/_static/lecture_specific/schelling/schelling_fig4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantEcon/lecture-python/master/source/_static/lecture_specific/schelling/schelling_fig4.png -------------------------------------------------------------------------------- /source/_static/lecture_specific/finite_markov/mc_ex1_plot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantEcon/lecture-python/master/source/_static/lecture_specific/finite_markov/mc_ex1_plot.png -------------------------------------------------------------------------------- /source/_static/lecture_specific/heavy_tails/rank_size_fig1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantEcon/lecture-python/master/source/_static/lecture_specific/heavy_tails/rank_size_fig1.png -------------------------------------------------------------------------------- /source/_static/lecture_specific/linear_algebra/course_notes.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantEcon/lecture-python/master/source/_static/lecture_specific/linear_algebra/course_notes.pdf -------------------------------------------------------------------------------- /source/_static/lecture_specific/linear_models/ensemble_mean.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantEcon/lecture-python/master/source/_static/lecture_specific/linear_models/ensemble_mean.png -------------------------------------------------------------------------------- /source/_static/lecture_specific/lqcontrol/solution_lqc_ex1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantEcon/lecture-python/master/source/_static/lecture_specific/lqcontrol/solution_lqc_ex1.png -------------------------------------------------------------------------------- /source/_static/lecture_specific/lqcontrol/solution_lqc_ex2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantEcon/lecture-python/master/source/_static/lecture_specific/lqcontrol/solution_lqc_ex2.png -------------------------------------------------------------------------------- /source/_static/lecture_specific/optgrowth/solution_og_ex2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantEcon/lecture-python/master/source/_static/lecture_specific/optgrowth/solution_og_ex2.png -------------------------------------------------------------------------------- /source/_static/lecture_specific/wald_friedman/wald_dec_rule.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantEcon/lecture-python/master/source/_static/lecture_specific/wald_friedman/wald_dec_rule.png -------------------------------------------------------------------------------- /source/_static/lecture_specific/wealth_dynamics/htop_again.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantEcon/lecture-python/master/source/_static/lecture_specific/wealth_dynamics/htop_again.png -------------------------------------------------------------------------------- /source/_static/lecture_specific/arellano/arellano_bond_prices.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantEcon/lecture-python/master/source/_static/lecture_specific/arellano/arellano_bond_prices.png -------------------------------------------------------------------------------- /source/_static/lecture_specific/arellano/arellano_time_series.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantEcon/lecture-python/master/source/_static/lecture_specific/arellano/arellano_time_series.png -------------------------------------------------------------------------------- /source/_static/lecture_specific/arellano/arellano_value_funcs.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantEcon/lecture-python/master/source/_static/lecture_specific/arellano/arellano_value_funcs.png -------------------------------------------------------------------------------- /source/_static/lecture_specific/finite_markov/hamilton_graph.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantEcon/lecture-python/master/source/_static/lecture_specific/finite_markov/hamilton_graph.png -------------------------------------------------------------------------------- /source/_static/lecture_specific/heavy_tails/light_heavy_fig1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantEcon/lecture-python/master/source/_static/lecture_specific/heavy_tails/light_heavy_fig1.png -------------------------------------------------------------------------------- /source/_static/lecture_specific/linear_models/iteration_notes.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantEcon/lecture-python/master/source/_static/lecture_specific/linear_models/iteration_notes.pdf -------------------------------------------------------------------------------- /source/_static/lecture_specific/lqcontrol/solution_lqc_ex3_g1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantEcon/lecture-python/master/source/_static/lecture_specific/lqcontrol/solution_lqc_ex3_g1.png -------------------------------------------------------------------------------- /source/_static/lecture_specific/markov_perf/mpe_vs_monopolist.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantEcon/lecture-python/master/source/_static/lecture_specific/markov_perf/mpe_vs_monopolist.png -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # lecture-python 2 | 3 | Source files for https://python.quantecon.org 4 | 5 | For a guide on contributing to this repository click [here](https://quantecon.org/contribute-lectures/) 6 | -------------------------------------------------------------------------------- /source/_static/lecture_specific/arellano/arellano_bond_prices_2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantEcon/lecture-python/master/source/_static/lecture_specific/arellano/arellano_bond_prices_2.png -------------------------------------------------------------------------------- /source/_static/lecture_specific/arellano/arellano_default_probs.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantEcon/lecture-python/master/source/_static/lecture_specific/arellano/arellano_default_probs.png -------------------------------------------------------------------------------- /source/_static/lecture_specific/career/career_solutions_ex1_py.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantEcon/lecture-python/master/source/_static/lecture_specific/career/career_solutions_ex1_py.png -------------------------------------------------------------------------------- /source/_static/lecture_specific/finite_markov/mc_aperiodicity1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantEcon/lecture-python/master/source/_static/lecture_specific/finite_markov/mc_aperiodicity1.png -------------------------------------------------------------------------------- /source/_static/lecture_specific/finite_markov/mc_aperiodicity2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantEcon/lecture-python/master/source/_static/lecture_specific/finite_markov/mc_aperiodicity2.png -------------------------------------------------------------------------------- /source/_static/lecture_specific/finite_markov/mc_irreducibility1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantEcon/lecture-python/master/source/_static/lecture_specific/finite_markov/mc_irreducibility1.png -------------------------------------------------------------------------------- /source/_static/lecture_specific/finite_markov/mc_irreducibility2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantEcon/lecture-python/master/source/_static/lecture_specific/finite_markov/mc_irreducibility2.png -------------------------------------------------------------------------------- /source/_static/lecture_specific/linear_models/solution_lss_ex1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantEcon/lecture-python/master/source/_static/lecture_specific/linear_models/solution_lss_ex1.png -------------------------------------------------------------------------------- /source/_static/lecture_specific/linear_models/solution_lss_ex2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantEcon/lecture-python/master/source/_static/lecture_specific/linear_models/solution_lss_ex2.png -------------------------------------------------------------------------------- /source/_static/lecture_specific/lqcontrol/solution_lqc_ex3_g10.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantEcon/lecture-python/master/source/_static/lecture_specific/lqcontrol/solution_lqc_ex3_g10.png -------------------------------------------------------------------------------- /source/_static/lecture_specific/lqcontrol/solution_lqc_ex3_g50.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantEcon/lecture-python/master/source/_static/lecture_specific/lqcontrol/solution_lqc_ex3_g50.png -------------------------------------------------------------------------------- /source/_static/lecture_specific/lake_model/lake_distribution_wages.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantEcon/lecture-python/master/source/_static/lecture_specific/lake_model/lake_distribution_wages.png -------------------------------------------------------------------------------- /source/_static/lecture_specific/linear_models/covariance_stationary.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantEcon/lecture-python/master/source/_static/lecture_specific/linear_models/covariance_stationary.png -------------------------------------------------------------------------------- /source/_static/lecture_specific/linear_models/paths_and_stationarity.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantEcon/lecture-python/master/source/_static/lecture_specific/linear_models/paths_and_stationarity.png -------------------------------------------------------------------------------- /source/_static/lecture_specific/finite_markov/mc_aperiodicity1.gv: -------------------------------------------------------------------------------- 1 | digraph G{ 2 | rankdir=LR; 3 | "a" -> "b" [label = "1.0"]; 4 | "b" -> "c" [label = "1.0"]; 5 | "c" -> "a" [label = "1.0"]; 6 | } -------------------------------------------------------------------------------- /source/_static/lecture_specific/uncertainty_traps/uncertainty_traps_45.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantEcon/lecture-python/master/source/_static/lecture_specific/uncertainty_traps/uncertainty_traps_45.png -------------------------------------------------------------------------------- /source/_static/lecture_specific/uncertainty_traps/uncertainty_traps_mu.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantEcon/lecture-python/master/source/_static/lecture_specific/uncertainty_traps/uncertainty_traps_mu.png -------------------------------------------------------------------------------- /source/_static/lecture_specific/uncertainty_traps/uncertainty_traps_sim.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantEcon/lecture-python/master/source/_static/lecture_specific/uncertainty_traps/uncertainty_traps_sim.png -------------------------------------------------------------------------------- /source/_static/lecture_specific/mccall_model_with_separation/mccall_resw_c.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantEcon/lecture-python/master/source/_static/lecture_specific/mccall_model_with_separation/mccall_resw_c.png -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | _build/ 2 | dask-worker-space/ 3 | [._]*.s[a-v][a-z] 4 | [._]*.sw[a-p] 5 | [._]s[a-v][a-z] 6 | [._]sw[a-p] 7 | .DS_Store 8 | .DS_Store? 9 | **/.DS_Store 10 | venv/ 11 | theme/lecture-python.theme 12 | -------------------------------------------------------------------------------- /source/_static/lecture_specific/mccall_model_with_separation/mccall_resw_alpha.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantEcon/lecture-python/master/source/_static/lecture_specific/mccall_model_with_separation/mccall_resw_alpha.png -------------------------------------------------------------------------------- /source/_static/lecture_specific/mccall_model_with_separation/mccall_resw_beta.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantEcon/lecture-python/master/source/_static/lecture_specific/mccall_model_with_separation/mccall_resw_beta.png -------------------------------------------------------------------------------- /source/_static/lecture_specific/cake_eating_numerical/analytical.py: -------------------------------------------------------------------------------- 1 | def c_star(x, β, γ): 2 | 3 | return (1 - β ** (1/γ)) * x 4 | 5 | 6 | def v_star(x, β, γ): 7 | 8 | return (1 - β**(1 / γ))**(-γ) * (x**(1-γ) / (1-γ)) 9 | 10 | -------------------------------------------------------------------------------- /environment.yml: -------------------------------------------------------------------------------- 1 | 2 | name: lecture-python 3 | channels: 4 | - default 5 | dependencies: 6 | - python=3.8 7 | - anaconda=2020.07 8 | - pip 9 | - pip: 10 | - quantecon 11 | - interpolation 12 | - sphinxcontrib-jupyter 13 | - sphinxcontrib-bibtex==1.0 14 | - joblib 15 | -------------------------------------------------------------------------------- /source/_static/lecture_specific/finite_markov/mc_aperiodicity2.gv: -------------------------------------------------------------------------------- 1 | digraph G{ 2 | rankdir=LR; 3 | "a" -> "b" [label = "1.0"]; 4 | "b" -> "c" [label = "0.5"]; 5 | "b" -> "a" [label = "0.5"]; 6 | "c" -> "b" [label = "0.5"]; 7 | "c" -> "d" [label = "0.5"]; 8 | "d" -> "c" [label = "1.0"]; 9 | } -------------------------------------------------------------------------------- /source/_static/includes/lecture_howto_py.raw: -------------------------------------------------------------------------------- 1 | .. raw:: html 2 | 3 |
The badges below show which lectures are currently passing their execution test (i.e., executing without errors).
11 |The lecture code checker was last run: N/A
12 |The code checker is run on a t2.small Amazon EC2 instance. This is an instance with a single CPU and 2 GiB of Memory.
You should achieve faster run times on many common laptops and desktops.
-------------------------------------------------------------------------------- /source/rst/index_intro_dynam.rst: -------------------------------------------------------------------------------- 1 | .. include:: /_static/includes/header.raw 2 | 3 | *************************************** 4 | Introduction to Dynamics 5 | *************************************** 6 | 7 | This section of the course contains foundational models for dynamic economic 8 | modeling. Most are single agent problems that take the activities of other 9 | agents as given. Later we will look at full equilibrium problems. 10 | 11 | 12 | .. only:: html 13 | 14 | Lectures 15 | ******** 16 | 17 | 18 | 19 | .. toctree:: 20 | :maxdepth: 2 21 | 22 | scalar_dynam 23 | ar1_processes 24 | finite_markov 25 | inventory_dynamics 26 | linear_models 27 | samuelson 28 | kesten_processes 29 | wealth_dynamics 30 | kalman 31 | short_path 32 | cass_koopmans_1 33 | cass_koopmans_2 34 | -------------------------------------------------------------------------------- /scripts/execution-test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | CLEAN_BUILD=false 4 | MODIFIED_FILES="$1" 5 | 6 | RST_FILES="" 7 | for F in $MODIFIED_FILES 8 | do 9 | if [[ $F == environment.yml ]] 10 | then 11 | CLEAN_BUILD=true 12 | break 13 | fi 14 | #Extract List of RST Files 15 | if [[ $F == *.rst ]] 16 | then 17 | RST_FILES="$RST_FILES $F" 18 | fi 19 | done 20 | 21 | echo "List of Changed RST Files: $RST_FILES" 22 | echo "Clean Build Requested: $CLEAN_BUILD" 23 | 24 | if [ "$CLEAN_BUILD" = true ] 25 | then 26 | echo "Running Clean Build" 27 | make coverage 28 | elif [ -z "$RST_FILES" ] 29 | then 30 | echo "No RST Files have changed -- nothing to do in this PR" 31 | else 32 | RST_FILES="$RST_FILES source/rst/index_toc.rst" 33 | echo "Running Selecting Build with: $RST_FILES" 34 | make coverage FILES="$RST_FILES" 35 | fi -------------------------------------------------------------------------------- /source/_static/lecture_specific/coleman_policy_iter/solve_time_iter.py: -------------------------------------------------------------------------------- 1 | def solve_model_time_iter(model, # Class with model information 2 | σ, # Initial condition 3 | tol=1e-4, 4 | max_iter=1000, 5 | verbose=True, 6 | print_skip=25): 7 | 8 | # Set up loop 9 | i = 0 10 | error = tol + 1 11 | 12 | while i < max_iter and error > tol: 13 | σ_new = K(σ, model) 14 | error = np.max(np.abs(σ - σ_new)) 15 | i += 1 16 | if verbose and i % print_skip == 0: 17 | print(f"Error at iteration {i} is {error}.") 18 | σ = σ_new 19 | 20 | if i == max_iter: 21 | print("Failed to converge!") 22 | 23 | if verbose and i < max_iter: 24 | print(f"\nConverged in {i} iterations.") 25 | 26 | return σ_new 27 | -------------------------------------------------------------------------------- /source/_static/lecture_specific/optgrowth/solve_model.py: -------------------------------------------------------------------------------- 1 | def solve_model(og, 2 | tol=1e-4, 3 | max_iter=1000, 4 | verbose=True, 5 | print_skip=25): 6 | """ 7 | Solve model by iterating with the Bellman operator. 8 | 9 | """ 10 | 11 | # Set up loop 12 | v = og.u(og.grid) # Initial condition 13 | i = 0 14 | error = tol + 1 15 | 16 | while i < max_iter and error > tol: 17 | v_greedy, v_new = T(v, og) 18 | error = np.max(np.abs(v - v_new)) 19 | i += 1 20 | if verbose and i % print_skip == 0: 21 | print(f"Error at iteration {i} is {error}.") 22 | v = v_new 23 | 24 | if i == max_iter: 25 | print("Failed to converge!") 26 | 27 | if verbose and i < max_iter: 28 | print(f"\nConverged in {i} iterations.") 29 | 30 | return v_greedy, v_new 31 | -------------------------------------------------------------------------------- /scripts/build-website.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | MODIFIED_FILES="$1" 4 | PRIVATE_THEME=$2 5 | 6 | # Find List of RST Files 7 | RST_FILES="" 8 | for F in $MODIFIED_FILES 9 | do 10 | if [[ $F == *.rst ]] 11 | then 12 | RST_FILES="$RST_FILES $F" 13 | fi 14 | done 15 | echo "List of Changed RST Files: $RST_FILES" 16 | echo "Building with Private theme: $PRIVATE_THEME" 17 | if [ -z "$RST_FILES" ]; then 18 | echo "BUILD_NETLIFY=false" >> $GITHUB_ENV 19 | echo "No RST Files have changed -- nothing to do in this PR" 20 | else 21 | echo "BUILD_NETLIFY=true" >> $GITHUB_ENV 22 | RST_FILES="$RST_FILES source/rst/index_toc.rst" 23 | if [ "$PRIVATE_THEME" = true ]; then 24 | make website THEMEPATH=theme/lecture-python.theme FILES="$RST_FILES" 25 | else 26 | make website FILES="$RST_FILES" 27 | fi 28 | ls _build/website/jupyter_html/* #Ensure build files are created 29 | fi -------------------------------------------------------------------------------- /theme/minimal/static/img/powered-by-NumFOCUS-orange.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /source/_static/lecture_specific/markov_perf/duopoly_mpe.py: -------------------------------------------------------------------------------- 1 | import numpy as np 2 | import quantecon as qe 3 | 4 | # Parameters 5 | a0 = 10.0 6 | a1 = 2.0 7 | β = 0.96 8 | γ = 12.0 9 | 10 | # In LQ form 11 | A = np.eye(3) 12 | B1 = np.array([[0.], [1.], [0.]]) 13 | B2 = np.array([[0.], [0.], [1.]]) 14 | 15 | 16 | R1 = [[ 0., -a0 / 2, 0.], 17 | [-a0 / 2., a1, a1 / 2.], 18 | [ 0, a1 / 2., 0.]] 19 | 20 | R2 = [[ 0., 0., -a0 / 2], 21 | [ 0., 0., a1 / 2.], 22 | [-a0 / 2, a1 / 2., a1]] 23 | 24 | Q1 = Q2 = γ 25 | S1 = S2 = W1 = W2 = M1 = M2 = 0.0 26 | 27 | # Solve using QE's nnash function 28 | F1, F2, P1, P2 = qe.nnash(A, B1, B2, R1, R2, Q1, 29 | Q2, S1, S2, W1, W2, M1, 30 | M2, beta=β) 31 | 32 | # Display policies 33 | print("Computed policies for firm 1 and firm 2:\n") 34 | print(f"F1 = {F1}") 35 | print(f"F2 = {F2}") 36 | print("\n") 37 | -------------------------------------------------------------------------------- /.github/workflows/ci.yml: -------------------------------------------------------------------------------- 1 | name: Execution and Link Checks 2 | on: [pull_request] 3 | jobs: 4 | tests: 5 | runs-on: ubuntu-latest 6 | steps: 7 | - name: Checkout 8 | uses: actions/checkout@v2 9 | - name: Setup Anaconda 10 | uses: conda-incubator/setup-miniconda@v2 11 | with: 12 | auto-update-conda: true 13 | auto-activate-base: true 14 | miniconda-version: 'latest' 15 | python-version: 3.8 16 | environment-file: environment.yml 17 | activate-environment: lecture-python 18 | - name: Display Conda Environment Versions 19 | shell: bash -l {0} 20 | run: conda list 21 | - name: Display Pip Versions 22 | shell: bash -l {0} 23 | run: pip list 24 | - name: Get Changed Files 25 | id: files 26 | uses: jitterbit/get-changed-files@v1 27 | - name: Run Execution Tests 28 | shell: bash -l {0} 29 | run: bash scripts/execution-test.sh "${{ steps.files.outputs.added_modified }}" 30 | - name: Run Linkchecker 31 | shell: bash -l {0} 32 | run: bash scripts/linkchecker-test.sh "${{ steps.files.outputs.added_modified }}" -------------------------------------------------------------------------------- /source/_static/lecture_specific/perm_income/perm_inc_ir.py: -------------------------------------------------------------------------------- 1 | r = 0.05 2 | β = 1 / (1 + r) 3 | T = 20 # Time horizon 4 | S = 5 # Impulse date 5 | σ1 = σ2 = 0.15 6 | 7 | 8 | def time_path(permanent=False): 9 | "Time path of consumption and debt given shock sequence" 10 | w1 = np.zeros(T+1) 11 | w2 = np.zeros(T+1) 12 | b = np.zeros(T+1) 13 | c = np.zeros(T+1) 14 | if permanent: 15 | w1[S+1] = 1.0 16 | else: 17 | w2[S+1] = 1.0 18 | for t in range(1, T): 19 | b[t+1] = b[t] - σ2 * w2[t] 20 | c[t+1] = c[t] + σ1 * w1[t+1] + (1 - β) * σ2 * w2[t+1] 21 | return b, c 22 | 23 | 24 | fig, axes = plt.subplots(2, 1, figsize=(10, 8)) 25 | p_args = {'lw': 2, 'alpha': 0.7} 26 | titles = ['transitory', 'permanent'] 27 | 28 | L = 0.175 29 | 30 | for ax, truefalse, title in zip(axes, (True, False), titles): 31 | b, c = time_path(permanent=truefalse) 32 | ax.set_title(f'Impulse reponse: {title} income shock') 33 | ax.plot(list(range(T+1)), c, 'g-', label="consumption", **p_args) 34 | ax.plot(list(range(T+1)), b, 'b-', label="debt", **p_args) 35 | ax.plot((S, S), (-L, L), 'k-', lw=0.5) 36 | ax.grid(alpha=0.5) 37 | ax.set(xlabel=r'Time', ylim=(-L, L)) 38 | 39 | axes[0].legend(loc='lower right') 40 | 41 | plt.tight_layout() 42 | plt.show() -------------------------------------------------------------------------------- /.github/workflows/coverage.yml: -------------------------------------------------------------------------------- 1 | name: Execution and Link Testing (Nightly) 2 | on: 3 | schedule: 4 | - cron: '0 17 * * *' 5 | jobs: 6 | coverage: 7 | name: Run Coverage 8 | runs-on: ubuntu-latest 9 | steps: 10 | - name: Checkout 11 | uses: actions/checkout@v2 12 | - name: Setup Anaconda 13 | uses: conda-incubator/setup-miniconda@v2 14 | with: 15 | auto-update-conda: true 16 | auto-activate-base: true 17 | miniconda-version: 'latest' 18 | python-version: 3.8 19 | environment-file: environment.yml 20 | activate-environment: lecture-python 21 | - name: Run Execution Tests 22 | shell: bash -l {0} 23 | run: make coverage 24 | linkchecker: 25 | name: Run linkchecker 26 | runs-on: ubuntu-latest 27 | steps: 28 | - name: Checkout 29 | uses: actions/checkout@v2 30 | - name: Setup Anaconda 31 | uses: conda-incubator/setup-miniconda@v2 32 | with: 33 | auto-update-conda: true 34 | auto-activate-base: true 35 | miniconda-version: 'latest' 36 | python-version: 3.8 37 | environment-file: environment.yml 38 | activate-environment: lecture-python 39 | - name: Run Linkchecker 40 | shell: bash -l {0} 41 | run: make linkcheck -------------------------------------------------------------------------------- /source/rst/index_toc.rst: -------------------------------------------------------------------------------- 1 | .. _toc: 2 | 3 | .. raw:: html 4 | 5 | 6 | 7 | .. only:: html 8 | 9 | Table of Contents 10 | ***************** 11 | 12 | 13 | .. toctree:: 14 | :maxdepth: 2 15 | :titlesonly: 16 | 17 | about_lectures 18 | index_tools_and_techniques 19 | index_intro_dynam 20 | index_search 21 | index_savings_growth 22 | index_information 23 | index_lq_control 24 | index_multi_agent_models 25 | index_asset_pricing 26 | index_data_and_empirics 27 | zreferences 28 | 29 | 30 | .. toctree:: 31 | :hidden: 32 | 33 | 404 34 | search 35 | status 36 | troubleshooting 37 | 38 | | 39 | 40 | .. image:: http://assets.quantecon.org/img/banner.png 41 | :scale: 30% 42 | :align: center 43 | 44 | .. only:: latex 45 | 46 | Acknowledgements: These lectures have benefitted greatly from comments and 47 | suggestion from our colleagues, students and friends. Special thanks go to 48 | Anmol Bhandari, Long Bui, Jeong-Hun Choi, Chase Coleman, David Evans, Shunsuke Hori, 49 | Chenghan Hou, Doc-Jin Jang, Spencer Lyon, Qingyin Ma, Akira Matsushita, 50 | Matthew McKay, Tomohito Okabe, Alex Olssen, Nathan Palmer and Yixiao Zhou. 51 | -------------------------------------------------------------------------------- /source/_static/lecture_specific/optgrowth_fast/ogm.py: -------------------------------------------------------------------------------- 1 | opt_growth_data = [ 2 | ('α', float64), # Production parameter 3 | ('β', float64), # Discount factor 4 | ('μ', float64), # Shock location parameter 5 | ('s', float64), # Shock scale parameter 6 | ('grid', float64[:]), # Grid (array) 7 | ('shocks', float64[:]) # Shock draws (array) 8 | ] 9 | 10 | @jitclass(opt_growth_data) 11 | class OptimalGrowthModel: 12 | 13 | def __init__(self, 14 | α=0.4, 15 | β=0.96, 16 | μ=0, 17 | s=0.1, 18 | grid_max=4, 19 | grid_size=120, 20 | shock_size=250, 21 | seed=1234): 22 | 23 | self.α, self.β, self.μ, self.s = α, β, μ, s 24 | 25 | # Set up grid 26 | self.grid = np.linspace(1e-5, grid_max, grid_size) 27 | 28 | # Store shocks (with a seed, so results are reproducible) 29 | np.random.seed(seed) 30 | self.shocks = np.exp(μ + s * np.random.randn(shock_size)) 31 | 32 | 33 | def f(self, k): 34 | "The production function" 35 | return k**self.α 36 | 37 | 38 | def u(self, c): 39 | "The utility function" 40 | return np.log(c) 41 | 42 | def f_prime(self, k): 43 | "Derivative of f" 44 | return self.α * (k**(self.α - 1)) 45 | 46 | 47 | def u_prime(self, c): 48 | "Derivative of u" 49 | return 1/c 50 | 51 | def u_prime_inv(self, c): 52 | "Inverse of u'" 53 | return 1/c -------------------------------------------------------------------------------- /theme/minimal/static/css/qe.python.css: -------------------------------------------------------------------------------- 1 | /* Homepage */ 2 | .home-intro { 3 | display: flex; 4 | align-content: center; 5 | } 6 | .home-blurb { 7 | font-size: 1.1rem; 8 | line-height: 1.5; 9 | } 10 | .home-intro .sponsor { 11 | list-style: none; 12 | padding:0; 13 | flex-shrink: 0; 14 | margin:0 60px 0 4rem; 15 | text-align: center; 16 | } 17 | .home-intro .sponsor li { 18 | display: block; 19 | margin:1rem 0; 20 | padding:0; 21 | } 22 | .web-version { 23 | display:inline-block; 24 | padding: 2rem 0rem; 25 | } 26 | .web-version a { 27 | display: block; 28 | padding:1rem 40px 1rem 80px; 29 | position: relative; 30 | } 31 | .web-version a .thumb { 32 | position: absolute; 33 | left:0px; 34 | top:1rem; 35 | } 36 | .web-version a .thumb img { 37 | width:50px; 38 | } 39 | .web-version a h2 { 40 | line-height: 1; 41 | margin:0; 42 | font-size: 1.4rem; 43 | } 44 | .web-version a p { 45 | margin:10px 0 0 0; 46 | } 47 | .home-alternatives { 48 | padding: 1rem 0rem; 49 | } 50 | .home-alternatives ul { 51 | list-style: none; 52 | padding:0; 53 | margin:0 0; 54 | } 55 | .home-alternatives li { 56 | padding:0; 57 | margin:1rem 1rem; 58 | } 59 | .home-alternatives li a { 60 | display: block; 61 | } 62 | .home-alternatives li a h3 { 63 | line-height: 1; 64 | margin:0; 65 | font-size: 1.2rem; 66 | } 67 | .home-alternatives li a p { 68 | margin:10px 0 0 0; 69 | } 70 | @media only screen and (max-width: 768px) { 71 | .home-intro { 72 | display: block; 73 | } 74 | .home-intro .sponsor { 75 | margin:0 auto; 76 | } 77 | } 78 | 79 | /* Other */ 80 | #qe-notebook-header { 81 | display: none; 82 | } -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | BSD 3-Clause License 2 | 3 | Copyright (c) 2020, QuantEcon 4 | All rights reserved. 5 | 6 | Redistribution and use in source and binary forms, with or without 7 | modification, are permitted provided that the following conditions are met: 8 | 9 | * Redistributions of source code must retain the above copyright notice, this 10 | list of conditions and the following disclaimer. 11 | 12 | * Redistributions in binary form must reproduce the above copyright notice, 13 | this list of conditions and the following disclaimer in the documentation 14 | and/or other materials provided with the distribution. 15 | 16 | * Neither the name of the copyright holder nor the names of its 17 | contributors may be used to endorse or promote products derived from 18 | this software without specific prior written permission. 19 | 20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 21 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 22 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 23 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 24 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 25 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 26 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 27 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 28 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | -------------------------------------------------------------------------------- /source/_static/lecture_specific/optgrowth_fast/ogm_crra.py: -------------------------------------------------------------------------------- 1 | opt_growth_data = [ 2 | ('α', float64), # Production parameter 3 | ('β', float64), # Discount factor 4 | ('μ', float64), # Shock location parameter 5 | ('γ', float64), # Preference parameter 6 | ('s', float64), # Shock scale parameter 7 | ('grid', float64[:]), # Grid (array) 8 | ('shocks', float64[:]) # Shock draws (array) 9 | ] 10 | 11 | @jitclass(opt_growth_data) 12 | class OptimalGrowthModel_CRRA: 13 | 14 | def __init__(self, 15 | α=0.4, 16 | β=0.96, 17 | μ=0, 18 | s=0.1, 19 | γ=1.5, 20 | grid_max=4, 21 | grid_size=120, 22 | shock_size=250, 23 | seed=1234): 24 | 25 | self.α, self.β, self.γ, self.μ, self.s = α, β, γ, μ, s 26 | 27 | # Set up grid 28 | self.grid = np.linspace(1e-5, grid_max, grid_size) 29 | 30 | # Store shocks (with a seed, so results are reproducible) 31 | np.random.seed(seed) 32 | self.shocks = np.exp(μ + s * np.random.randn(shock_size)) 33 | 34 | 35 | def f(self, k): 36 | "The production function." 37 | return k**self.α 38 | 39 | def u(self, c): 40 | "The utility function." 41 | return c**(1 - self.γ) / (1 - self.γ) 42 | 43 | def f_prime(self, k): 44 | "Derivative of f." 45 | return self.α * (k**(self.α - 1)) 46 | 47 | def u_prime(self, c): 48 | "Derivative of u." 49 | return c**(-self.γ) 50 | 51 | def u_prime_inv(c): 52 | return c**(-1 / self.γ) -------------------------------------------------------------------------------- /source/_static/lecture_specific/wald_friedman/wald_dec_rule.tex: -------------------------------------------------------------------------------- 1 | \documentclass[convert={density=300,size=1080x800,outext=.png}]{standalone} 2 | \usepackage{tikz} 3 | \usetikzlibrary{decorations.pathreplacing} 4 | \begin{document} 5 | 6 | %.. tikz:: 7 | \begin{tikzpicture} 8 | [scale=5, every node/.style={color=black}, decoration={brace,amplitude=7pt}] \coordinate (a0) at (0, 0.0); 9 | \coordinate (a1) at (1, 0.0); 10 | \coordinate (a2) at (2, 0.0); 11 | \coordinate (a3) at (3, 0.0); 12 | \coordinate (s0) at (0, 0.1); 13 | \coordinate (s1) at (1, 0.1); 14 | \coordinate (s2) at (2, 0.1); 15 | \coordinate (s3) at (3, 0.1); 16 | % axis 17 | \draw[thick] (0, 0) -- (3, 0) node[below] {}; 18 | %curly bracket 19 | \draw [decorate, very thick] (s0) -- (s1) 20 | node [midway, anchor=south, outer sep=10pt]{accept $f_1$}; 21 | \draw [decorate, very thick] (s1) -- (s2) 22 | node [midway, anchor=south, outer sep=10pt]{draw again}; 23 | \draw [decorate, very thick] (s2) -- (s3) 24 | node [midway, anchor=south, outer sep=10pt]{accept $f_0$}; 25 | \node[circle, draw, thin, blue, fill=white!10, scale=0.45] at (a0){}; 26 | \node[below, outer sep=5pt] at (a0){$0$}; 27 | \node[circle, draw, thin, blue, fill=white!10, scale=0.45] at (a1){}; 28 | \node[below, outer sep=5pt] at (a1){$\beta$}; 29 | \node[circle, draw, thin, blue, fill=white!10, scale=0.45] at (a2){}; 30 | \node[below, outer sep=5pt] at (a2){$\alpha$}; 31 | \node[circle, draw, thin, blue, fill=white!10, scale=0.45] at (a3){}; 32 | \node[below, outer sep=5pt] at (a3){$1$}; 33 | \node[below, outer sep=25pt] at (1.5, 0){values of $\pi$}; 34 | \end{tikzpicture} 35 | 36 | \end{document} -------------------------------------------------------------------------------- /source/_static/lecture_specific/optgrowth/bellman_operator.py: -------------------------------------------------------------------------------- 1 | import numpy as np 2 | from interpolation import interp 3 | from numba import njit, prange 4 | from quantecon.optimize.scalar_maximization import brent_max 5 | 6 | 7 | def operator_factory(og, parallel_flag=True): 8 | """ 9 | A function factory for building the Bellman operator, as well as 10 | a function that computes greedy policies. 11 | 12 | Here og is an instance of OptimalGrowthModel. 13 | """ 14 | 15 | f, u, β = og.f, og.u, og.β 16 | grid, shocks = og.grid, og.shocks 17 | 18 | @njit 19 | def objective(c, v, y): 20 | """ 21 | The right-hand side of the Bellman equation 22 | """ 23 | # First turn v into a function via interpolation 24 | v_func = lambda x: interp(grid, v, x) 25 | return u(c) + β * np.mean(v_func(f(y - c) * shocks)) 26 | 27 | @njit(parallel=parallel_flag) 28 | def T(v): 29 | """ 30 | The Bellman operator 31 | """ 32 | v_new = np.empty_like(v) 33 | for i in prange(len(grid)): 34 | y = grid[i] 35 | # Solve for optimal v at y 36 | v_max = brent_max(objective, 1e-10, y, args=(v, y))[1] 37 | v_new[i] = v_max 38 | return v_new 39 | 40 | @njit 41 | def get_greedy(v): 42 | """ 43 | Computes the v-greedy policy of a given function v 44 | """ 45 | σ = np.empty_like(v) 46 | for i in range(len(grid)): 47 | y = grid[i] 48 | # Solve for optimal c at y 49 | c_max = brent_max(objective, 1e-10, y, args=(v, y))[0] 50 | σ[i] = c_max 51 | return σ 52 | 53 | return T, get_greedy 54 | -------------------------------------------------------------------------------- /.github/workflows/pdf.yml: -------------------------------------------------------------------------------- 1 | name: Build PDF 2 | on: 3 | push: 4 | branch: 5 | - master 6 | jobs: 7 | pdf: 8 | name: Build PDF 9 | runs-on: ubuntu-latest 10 | steps: 11 | - name: Checkout 12 | uses: actions/checkout@v2 13 | - name: Install Fonts 14 | run: | 15 | sudo apt-get install -y fonts-liberation 16 | sudo apt-get install -y fonts-cmu 17 | - name: TexLive Cache 18 | id: cache 19 | uses: actions/cache@v1 20 | with: 21 | path: /tmp/texlive 22 | key: cache-texlive 23 | - name: Install & Update TexLive 24 | shell: bash -l {0} 25 | run: | 26 | bash scripts/install_latex.sh 27 | echo 'export PATH=/tmp/texlive/bin/x86_64-linux:$PATH' >> ~/.bash_profile 28 | source ~/.bash_profile 29 | xelatex --version 30 | - name: Setup Anaconda 31 | uses: conda-incubator/setup-miniconda@v2 32 | with: 33 | auto-update-conda: true 34 | auto-activate-base: true 35 | miniconda-version: 'latest' 36 | python-version: 3.8 37 | environment-file: environment.yml 38 | activate-environment: lecture-python 39 | - name: Checkout QuantEcon theme 40 | uses: actions/checkout@v2 41 | with: 42 | repository: QuantEcon/lecture-python.theme 43 | token: ${{ secrets.ACTIONS_PAT }} 44 | path: theme/lecture-python.theme 45 | - name: Build PDF 46 | shell: bash -l {0} 47 | run: | 48 | more ~/.bash_profile 49 | echo 'export PATH=/tmp/texlive/bin/x86_64-linux:$PATH' >> ~/.bash_profile 50 | source ~/.bash_profile 51 | more ~/.bash_profile 52 | ls theme/lecture-python.theme 53 | make pdf 54 | - uses: actions/upload-artifact@v2 55 | with: 56 | name: pdf 57 | path: _build/jupyterpdf/texbook/quantitative_economics_with_python.pdf -------------------------------------------------------------------------------- /source/rst/troubleshooting.rst: -------------------------------------------------------------------------------- 1 | .. _troubleshooting: 2 | 3 | .. include:: /_static/includes/header.raw 4 | 5 | .. highlight:: python3 6 | 7 | *************** 8 | Troubleshooting 9 | *************** 10 | 11 | .. contents:: :depth: 2 12 | 13 | This page is for readers experiencing errors when running the code from the lectures. 14 | 15 | Fixing Your Local Environment 16 | ============================== 17 | 18 | The basic assumption of the lectures is that code in a lecture should execute whenever 19 | 20 | #. it is executed in a Jupyter notebook and 21 | 22 | #. the notebook is running on a machine with the latest version of Anaconda Python. 23 | 24 | You have installed Anaconda, haven't you, following the instructions in `this lectureThis website presents a set of lectures on quantitative economic modeling, designed and written by Thomas J. Sargent and John Stachurski.
21 |Last compiled:
22 | View source |
23 | View commits | See all contributors
A print-ready version for viewing offline
46 | 47 |Get the full set of Jupyter notebooks
53 | 54 |