├── source ├── rst │ ├── _static │ ├── zreferences.rst │ ├── search.rst │ ├── index_classic_linear_models.rst │ ├── index_tools_and_techniques.rst │ ├── index_asset_pricing.rst │ ├── index_lq_control.rst │ ├── about_lectures.rst │ ├── index_multi_agent_models.rst │ ├── index_hs_recursive_models.rst │ ├── index_time_series_models.rst │ ├── index_dynamic_programming_squared.rst │ ├── 404.rst │ ├── status.rst │ ├── index_toc.rst │ ├── troubleshooting.rst │ ├── index.rst │ ├── .ipynb_checkpoints │ │ ├── Untitled-checkpoint.ipynb │ │ └── changethis-checkpoint.ipynb │ ├── lucas_asset_pricing_dles.rst │ ├── irfs_in_hall_model.rst │ ├── permanent_income_dles.rst │ ├── tax_smoothing_3.rst │ ├── rosen_schooling_model.rst │ ├── hs_invertibility_example.rst │ └── muth_kalman.rst └── _static │ ├── qe-logo-large.png │ ├── lecture_specific │ ├── amss3 │ │ ├── amss3_g1.png │ │ ├── amss3_g2.png │ │ └── amss3_g3.png │ ├── robustness │ │ ├── kg.png │ │ ├── kg0.png │ │ └── kg_small_theta.png │ ├── coase │ │ ├── allocation.png │ │ ├── subcontracting.png │ │ ├── allocation.tex │ │ └── subcontracting.tex │ ├── lqramsey │ │ └── firenze.pdf │ ├── estspec │ │ ├── periodogram1.png │ │ ├── window_smoothing.png │ │ └── ar_smoothed_periodogram.png │ ├── arma │ │ └── time_series_book.pdf │ ├── markov_perf │ │ ├── judd_fig1.png │ │ ├── judd_fig2.png │ │ ├── mpe_vs_monopolist.png │ │ └── duopoly_mpe.py │ ├── matsuyama │ │ ├── matsuyama_14.png │ │ └── matsuyama_18.png │ ├── troubleshooting │ │ └── launch.png │ ├── orth_proj │ │ ├── orth_proj_def1.png │ │ ├── orth_proj_def2.png │ │ ├── orth_proj_def3.png │ │ ├── orth_proj_thm1.png │ │ ├── orth_proj_thm2.png │ │ ├── orth_proj_thm3.png │ │ ├── orth_proj_def1.tex │ │ ├── orth_proj_def2.tex │ │ ├── orth_proj_def3.tex │ │ ├── orth_proj_thm1.tex │ │ ├── orth_proj_thm2.tex │ │ └── orth_proj_thm3.tex │ ├── arellano │ │ ├── arellano_bond_prices.png │ │ ├── arellano_time_series.png │ │ ├── arellano_value_funcs.png │ │ ├── arellano_bond_prices_2.png │ │ └── arellano_default_probs.png │ ├── lucas_model │ │ ├── solution_mass_ex2.png │ │ └── lucastree.py │ ├── stationary_densities │ │ ├── ECTA6180.pdf │ │ ├── solution_statd_ex1.png │ │ └── solution_statd_ex2.png │ ├── discrete_dp │ │ ├── finite_dp_simple_og.png │ │ └── finite_dp_simple_og2.png │ ├── opt_tax_recur │ │ ├── log_utility.py │ │ ├── crra_utility.py │ │ ├── sequential_allocation.py │ │ └── recursive_allocation.py │ ├── amss2 │ │ ├── log_utility.py │ │ ├── crra_utility.py │ │ ├── utilities.py │ │ ├── sequential_allocation.py │ │ └── recursive_allocation.py │ ├── amss │ │ └── recursive_allocation.py │ └── lu_tricks │ │ └── control_and_filter.py │ ├── includes │ ├── lecture_howto_py.raw │ └── header.raw │ └── downloads │ └── amss_environment.yml ├── requirements.txt ├── theme └── minimal │ ├── static │ ├── img │ │ ├── py-logo.png │ │ ├── qe-logo.png │ │ ├── search-icon.png │ │ ├── sloan_logo.png │ │ ├── code-block-fade.png │ │ └── powered-by-NumFOCUS-orange.svg │ ├── sloan_logo.png │ ├── css │ │ └── qe.python.css │ └── js │ │ └── base.js │ └── templates │ ├── error_report_template.html │ └── html.tpl ├── README.md ├── .gitignore ├── environment.yml ├── scripts ├── linkchecker-test.sh ├── execution-test.sh └── build-website.sh ├── .github └── workflows │ ├── ci.yml │ ├── coverage.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-advanced/master/source/_static/qe-logo-large.png -------------------------------------------------------------------------------- /theme/minimal/static/img/py-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantEcon/lecture-python-advanced/master/theme/minimal/static/img/py-logo.png -------------------------------------------------------------------------------- /theme/minimal/static/img/qe-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantEcon/lecture-python-advanced/master/theme/minimal/static/img/qe-logo.png -------------------------------------------------------------------------------- /theme/minimal/static/sloan_logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantEcon/lecture-python-advanced/master/theme/minimal/static/sloan_logo.png -------------------------------------------------------------------------------- /theme/minimal/static/img/search-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantEcon/lecture-python-advanced/master/theme/minimal/static/img/search-icon.png -------------------------------------------------------------------------------- /theme/minimal/static/img/sloan_logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantEcon/lecture-python-advanced/master/theme/minimal/static/img/sloan_logo.png -------------------------------------------------------------------------------- /source/rst/zreferences.rst: -------------------------------------------------------------------------------- 1 | .. _references: 2 | 3 | ********** 4 | References 5 | ********** 6 | 7 | .. bibliography:: /_static/quant-econ.bib 8 | :cited: 9 | -------------------------------------------------------------------------------- /theme/minimal/static/img/code-block-fade.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantEcon/lecture-python-advanced/master/theme/minimal/static/img/code-block-fade.png -------------------------------------------------------------------------------- /source/_static/lecture_specific/amss3/amss3_g1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantEcon/lecture-python-advanced/master/source/_static/lecture_specific/amss3/amss3_g1.png -------------------------------------------------------------------------------- /source/_static/lecture_specific/amss3/amss3_g2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantEcon/lecture-python-advanced/master/source/_static/lecture_specific/amss3/amss3_g2.png -------------------------------------------------------------------------------- /source/_static/lecture_specific/amss3/amss3_g3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantEcon/lecture-python-advanced/master/source/_static/lecture_specific/amss3/amss3_g3.png -------------------------------------------------------------------------------- /source/_static/lecture_specific/robustness/kg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantEcon/lecture-python-advanced/master/source/_static/lecture_specific/robustness/kg.png -------------------------------------------------------------------------------- /source/_static/lecture_specific/robustness/kg0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantEcon/lecture-python-advanced/master/source/_static/lecture_specific/robustness/kg0.png -------------------------------------------------------------------------------- /source/_static/lecture_specific/coase/allocation.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantEcon/lecture-python-advanced/master/source/_static/lecture_specific/coase/allocation.png -------------------------------------------------------------------------------- /source/_static/lecture_specific/lqramsey/firenze.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantEcon/lecture-python-advanced/master/source/_static/lecture_specific/lqramsey/firenze.pdf -------------------------------------------------------------------------------- /source/_static/lecture_specific/coase/subcontracting.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantEcon/lecture-python-advanced/master/source/_static/lecture_specific/coase/subcontracting.png -------------------------------------------------------------------------------- /source/_static/lecture_specific/estspec/periodogram1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantEcon/lecture-python-advanced/master/source/_static/lecture_specific/estspec/periodogram1.png -------------------------------------------------------------------------------- /source/_static/lecture_specific/arma/time_series_book.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantEcon/lecture-python-advanced/master/source/_static/lecture_specific/arma/time_series_book.pdf -------------------------------------------------------------------------------- /source/_static/lecture_specific/markov_perf/judd_fig1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantEcon/lecture-python-advanced/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-advanced/master/source/_static/lecture_specific/markov_perf/judd_fig2.png -------------------------------------------------------------------------------- /source/_static/lecture_specific/matsuyama/matsuyama_14.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantEcon/lecture-python-advanced/master/source/_static/lecture_specific/matsuyama/matsuyama_14.png -------------------------------------------------------------------------------- /source/_static/lecture_specific/matsuyama/matsuyama_18.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantEcon/lecture-python-advanced/master/source/_static/lecture_specific/matsuyama/matsuyama_18.png -------------------------------------------------------------------------------- /source/_static/lecture_specific/troubleshooting/launch.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantEcon/lecture-python-advanced/master/source/_static/lecture_specific/troubleshooting/launch.png -------------------------------------------------------------------------------- /source/_static/lecture_specific/estspec/window_smoothing.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantEcon/lecture-python-advanced/master/source/_static/lecture_specific/estspec/window_smoothing.png -------------------------------------------------------------------------------- /source/_static/lecture_specific/orth_proj/orth_proj_def1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantEcon/lecture-python-advanced/master/source/_static/lecture_specific/orth_proj/orth_proj_def1.png -------------------------------------------------------------------------------- /source/_static/lecture_specific/orth_proj/orth_proj_def2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantEcon/lecture-python-advanced/master/source/_static/lecture_specific/orth_proj/orth_proj_def2.png -------------------------------------------------------------------------------- /source/_static/lecture_specific/orth_proj/orth_proj_def3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantEcon/lecture-python-advanced/master/source/_static/lecture_specific/orth_proj/orth_proj_def3.png -------------------------------------------------------------------------------- /source/_static/lecture_specific/orth_proj/orth_proj_thm1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantEcon/lecture-python-advanced/master/source/_static/lecture_specific/orth_proj/orth_proj_thm1.png -------------------------------------------------------------------------------- /source/_static/lecture_specific/orth_proj/orth_proj_thm2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantEcon/lecture-python-advanced/master/source/_static/lecture_specific/orth_proj/orth_proj_thm2.png -------------------------------------------------------------------------------- /source/_static/lecture_specific/orth_proj/orth_proj_thm3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantEcon/lecture-python-advanced/master/source/_static/lecture_specific/orth_proj/orth_proj_thm3.png -------------------------------------------------------------------------------- /source/_static/lecture_specific/robustness/kg_small_theta.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantEcon/lecture-python-advanced/master/source/_static/lecture_specific/robustness/kg_small_theta.png -------------------------------------------------------------------------------- /source/_static/lecture_specific/arellano/arellano_bond_prices.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantEcon/lecture-python-advanced/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-advanced/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-advanced/master/source/_static/lecture_specific/arellano/arellano_value_funcs.png -------------------------------------------------------------------------------- /source/_static/lecture_specific/lucas_model/solution_mass_ex2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantEcon/lecture-python-advanced/master/source/_static/lecture_specific/lucas_model/solution_mass_ex2.png -------------------------------------------------------------------------------- /source/_static/lecture_specific/markov_perf/mpe_vs_monopolist.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantEcon/lecture-python-advanced/master/source/_static/lecture_specific/markov_perf/mpe_vs_monopolist.png -------------------------------------------------------------------------------- /source/_static/lecture_specific/stationary_densities/ECTA6180.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantEcon/lecture-python-advanced/master/source/_static/lecture_specific/stationary_densities/ECTA6180.pdf -------------------------------------------------------------------------------- /source/_static/lecture_specific/arellano/arellano_bond_prices_2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantEcon/lecture-python-advanced/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-advanced/master/source/_static/lecture_specific/arellano/arellano_default_probs.png -------------------------------------------------------------------------------- /source/_static/lecture_specific/discrete_dp/finite_dp_simple_og.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantEcon/lecture-python-advanced/master/source/_static/lecture_specific/discrete_dp/finite_dp_simple_og.png -------------------------------------------------------------------------------- /source/_static/lecture_specific/discrete_dp/finite_dp_simple_og2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantEcon/lecture-python-advanced/master/source/_static/lecture_specific/discrete_dp/finite_dp_simple_og2.png -------------------------------------------------------------------------------- /source/_static/lecture_specific/estspec/ar_smoothed_periodogram.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantEcon/lecture-python-advanced/master/source/_static/lecture_specific/estspec/ar_smoothed_periodogram.png -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # lecture-python-advanced 2 | Source files for https://python-advanced.quantecon.org 3 | 4 | For a guide on contributing to this repository click [here](https://quantecon.org/contribute-lectures/) 5 | -------------------------------------------------------------------------------- /source/_static/lecture_specific/stationary_densities/solution_statd_ex1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantEcon/lecture-python-advanced/master/source/_static/lecture_specific/stationary_densities/solution_statd_ex1.png -------------------------------------------------------------------------------- /source/_static/lecture_specific/stationary_densities/solution_statd_ex2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuantEcon/lecture-python-advanced/master/source/_static/lecture_specific/stationary_densities/solution_statd_ex2.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-advanced.theme 12 | .prettierignore -------------------------------------------------------------------------------- /environment.yml: -------------------------------------------------------------------------------- 1 | name: lecture-python-advanced 2 | channels: 3 | - default 4 | dependencies: 5 | - pip 6 | - python=3.8 7 | - anaconda=2020.07 8 | - pip: 9 | - jupinx 10 | - sphinxcontrib-jupyter 11 | - sphinxcontrib-bibtex==1.0 12 | - quantecon 13 | - joblib 14 | -------------------------------------------------------------------------------- /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/_static/lecture_specific/opt_tax_recur/log_utility.py: -------------------------------------------------------------------------------- 1 | log_util_data = [ 2 | ('β', float64), 3 | ('ψ', float64) 4 | ] 5 | 6 | @jitclass(log_util_data) 7 | class LogUtility: 8 | 9 | def __init__(self, 10 | β=0.9, 11 | ψ=0.69): 12 | 13 | self.β, self.ψ = β, ψ 14 | 15 | # Utility function 16 | def U(self, c, l): 17 | return np.log(c) + self.ψ * np.log(l) 18 | 19 | # Derivatives of utility function 20 | def Uc(self, c, l): 21 | return 1 / c 22 | 23 | def Ucc(self, c, l): 24 | return -c**(-2) 25 | 26 | def Ul(self, c, l): 27 | return self.ψ / l 28 | 29 | def Ull(self, c, l): 30 | return -self.ψ / l**2 31 | 32 | def Ucl(self, c, l): 33 | return 0 34 | 35 | def Ulc(self, c, l): 36 | return 0 37 | -------------------------------------------------------------------------------- /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/amss2/log_utility.py: -------------------------------------------------------------------------------- 1 | import numpy as np 2 | 3 | class LogUtility: 4 | 5 | def __init__(self, 6 | β=0.9, 7 | ψ=0.69, 8 | π=0.5*np.ones((2, 2)), 9 | G=np.array([0.1, 0.2]), 10 | Θ=np.ones(2), 11 | transfers=False): 12 | 13 | self.β, self.ψ, self.π = β, ψ, π 14 | self.G, self.Θ, self.transfers = G, Θ, transfers 15 | 16 | # Utility function 17 | def U(self, c, n): 18 | return np.log(c) + self.ψ * np.log(1 - n) 19 | 20 | # Derivatives of utility function 21 | def Uc(self, c, n): 22 | return 1 / c 23 | 24 | def Ucc(self, c, n): 25 | return -c**(-2) 26 | 27 | def Un(self, c, n): 28 | return -self.ψ / (1 - n) 29 | 30 | def Unn(self, c, n): 31 | return -self.ψ / (1 - n)**2 -------------------------------------------------------------------------------- /scripts/build-website.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | MODIFIED_FILES="$1" 4 | PRIVATE_THEME=$2 5 | 6 | RST_FILES="" 7 | for F in $MODIFIED_FILES 8 | do 9 | if [[ $F == *.rst ]] 10 | then 11 | RST_FILES="$RST_FILES $F" 12 | fi 13 | done 14 | echo "List of Changed RST Files: $RST_FILES" 15 | echo "Building with Private theme: $PRIVATE_THEME" 16 | if [ -z "$RST_FILES" ]; then 17 | echo "BUILD_NETLIFY=false" >> $GITHUB_ENV 18 | echo "No RST Files have changed -- nothing to do in this PR" 19 | else 20 | echo "BUILD_NETLIFY=true" >> $GITHUB_ENV 21 | RST_FILES="$RST_FILES source/rst/index_toc.rst" 22 | if [ "$PRIVATE_THEME" = true ]; then 23 | make website THEMEPATH=theme/lecture-python-advanced.theme FILES="$RST_FILES" 24 | else 25 | make website FILES="$RST_FILES" 26 | fi 27 | ls _build/website/jupyter_html/* #Ensure build files are created 28 | fi -------------------------------------------------------------------------------- /source/_static/lecture_specific/orth_proj/orth_proj_def1.tex: -------------------------------------------------------------------------------- 1 | \documentclass[convert={density=300,size=1080x800,outext=.png}]{standalone} 2 | \usepackage{tikz} 3 | 4 | \usetikzlibrary{arrows.meta, arrows} 5 | 6 | \begin{document} 7 | 8 | %.. tikz:: 9 | \begin{tikzpicture} 10 | [scale=5, axis/.style={<->, >=stealth'}, important line/.style={thick}, dotted line/.style={dotted, thick,red}, every node/.style={color=black}]\coordinate(O) at (0,0); 11 | \coordinate (X) at (-0.2,0.3); 12 | \coordinate (Z) at (0.6,0.3); 13 | \draw[axis] (-0.4,0) -- (0.9,0) node(xline)[right] {}; 14 | \draw[axis] (0,-0.3) -- (0,0.7) node(yline)[above] {}; 15 | \draw[important line,blue, ->] (O) -- (X) node[left] {$x$}; 16 | \draw[important line,blue, ->] (O) -- (Z) node[right] {$z$}; 17 | \draw[dotted line] (-0.03,0.045) -- (0.03,0.075); 18 | \draw[dotted line] (0.06,0.03) -- (0.03,0.075); 19 | 20 | \end{tikzpicture} 21 | 22 | \end{document} -------------------------------------------------------------------------------- /source/_static/lecture_specific/orth_proj/orth_proj_def2.tex: -------------------------------------------------------------------------------- 1 | \documentclass[convert={density=300,size=1080x800,outext=.png}]{standalone} 2 | \usepackage{tikz} 3 | \usetikzlibrary{arrows.meta, arrows} 4 | \begin{document} 5 | 6 | %.. tikz:: 7 | \begin{tikzpicture} 8 | [scale=5, axis/.style={<->, >=stealth'}, important line/.style={thick}, dotted line/.style={dotted, thick,red}, every node/.style={color=black} ] \coordinate(O) at (0,0); 9 | \coordinate (X) at (-0.2,0.3); 10 | \coordinate (Z1) at (-0.3,-0.15); 11 | \coordinate (Z2) at (0.8,0.4); 12 | \draw[axis] (-0.4,0) -- (0.9,0) node(xline)[right] {}; 13 | \draw[axis] (0,-0.3) -- (0,0.7) node(yline)[above] {}; 14 | \draw[important line,blue, ->] (O) -- (X) node[left] {$x$}; 15 | \draw[important line] (Z1) -- (Z2) node[right] {$S$}; 16 | \draw[dotted line] (-0.03,0.045) -- (0.03,0.075); 17 | \draw[dotted line] (0.06,0.03) -- (0.03,0.075); 18 | \end{tikzpicture} 19 | 20 | \end{document} 21 | 22 | 23 | -------------------------------------------------------------------------------- /theme/minimal/static/img/powered-by-NumFOCUS-orange.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.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-advanced 18 | - name: Get Changed Files 19 | id: files 20 | uses: jitterbit/get-changed-files@v1 21 | - name: Run Execution Tests 22 | shell: bash -l {0} 23 | run: bash scripts/execution-test.sh "${{ steps.files.outputs.added_modified }}" 24 | - name: Run Linkchecker 25 | shell: bash -l {0} 26 | run: bash scripts/linkchecker-test.sh "${{ steps.files.outputs.added_modified }}" -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /source/_static/lecture_specific/orth_proj/orth_proj_def3.tex: -------------------------------------------------------------------------------- 1 | \documentclass[convert={density=300,size=1080x800,outext=.png}]{standalone} 2 | \usepackage{tikz} 3 | \usetikzlibrary{arrows.meta, arrows} 4 | \begin{document} 5 | 6 | %.. tikz:: 7 | \begin{tikzpicture} 8 | [scale=5, axis/.style={<->, >=stealth'}, important line/.style={thick}, dotted line/.style={dotted, thick,red}, dashed line/.style={dashed, thin}, every node/.style={color=black}] \coordinate(O) at (0,0); 9 | \coordinate (S1) at (-0.4,-0.2); 10 | \coordinate (S2) at (0.8,0.4); 11 | \coordinate (S3) at (-0.25,0.5); 12 | \coordinate (S4) at (0.12,-0.24); 13 | \draw[axis] (-0.5,0) -- (0.9,0) node(xline)[right] {}; 14 | \draw[axis] (0,-0.3) -- (0,0.7) node(yline)[above] {}; 15 | \draw[important line, thick] (S1) -- (S2) node[right] {$S$}; 16 | \draw[important line, thick] (S4) -- (S3) node[left] {$S^{\perp}$}; 17 | \draw[dotted line] (-0.03,0.06) -- (0.03,0.09); 18 | \draw[dotted line] (0.06,0.03) -- (0.03,0.09); 19 | \end{tikzpicture} 20 | 21 | \end{document} -------------------------------------------------------------------------------- /source/_static/lecture_specific/amss2/crra_utility.py: -------------------------------------------------------------------------------- 1 | import numpy as np 2 | 3 | 4 | class CRRAutility: 5 | 6 | def __init__(self, 7 | β=0.9, 8 | σ=2, 9 | γ=2, 10 | π=0.5*np.ones((2, 2)), 11 | G=np.array([0.1, 0.2]), 12 | Θ=np.ones(2), 13 | transfers=False): 14 | 15 | self.β, self.σ, self.γ = β, σ, γ 16 | self.π, self.G, self.Θ, self.transfers = π, G, Θ, transfers 17 | 18 | # Utility function 19 | def U(self, c, n): 20 | σ = self.σ 21 | if σ == 1.: 22 | U = np.log(c) 23 | else: 24 | U = (c**(1 - σ) - 1) / (1 - σ) 25 | return U - n**(1 + self.γ) / (1 + self.γ) 26 | 27 | # Derivatives of utility function 28 | def Uc(self, c, n): 29 | return c**(-self.σ) 30 | 31 | def Ucc(self, c, n): 32 | return -self.σ * c**(-self.σ - 1) 33 | 34 | def Un(self, c, n): 35 | return -n**self.γ 36 | 37 | def Unn(self, c, n): 38 | return -self.γ * n**(self.γ - 1) -------------------------------------------------------------------------------- /source/_static/lecture_specific/opt_tax_recur/crra_utility.py: -------------------------------------------------------------------------------- 1 | crra_util_data = [ 2 | ('β', float64), 3 | ('σ', float64), 4 | ('γ', float64) 5 | ] 6 | 7 | @jitclass(crra_util_data) 8 | class CRRAutility: 9 | 10 | def __init__(self, 11 | β=0.9, 12 | σ=2, 13 | γ=2): 14 | 15 | self.β, self.σ, self.γ = β, σ, γ 16 | 17 | # Utility function 18 | def U(self, c, l): 19 | # Note: `l` should not be interpreted as labor, it is an auxiliary 20 | # variable used to conveniently match the code and the equations 21 | # in the lecture 22 | σ = self.σ 23 | if σ == 1.: 24 | U = np.log(c) 25 | else: 26 | U = (c**(1 - σ) - 1) / (1 - σ) 27 | return U - (1-l) ** (1 + self.γ) / (1 + self.γ) 28 | 29 | # Derivatives of utility function 30 | def Uc(self, c, l): 31 | return c ** (-self.σ) 32 | 33 | def Ucc(self, c, l): 34 | return -self.σ * c ** (-self.σ - 1) 35 | 36 | def Ul(self, c, l): 37 | return (1-l) ** self.γ 38 | 39 | def Ull(self, c, l): 40 | return -self.γ * (1-l) ** (self.γ - 1) 41 | 42 | def Ucl(self, c, l): 43 | return 0 44 | 45 | def Ulc(self, c, l): 46 | return 0 47 | -------------------------------------------------------------------------------- /.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-advanced 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: goanpeca/setup-miniconda@v1 32 | with: 33 | auto-update-conda: true 34 | auto-activate-base: true 35 | miniconda-version: 'latest' 36 | python-version: 3.7 37 | environment-file: environment.yml 38 | activate-environment: qe-lectures 39 | - name: Run Linkchecker 40 | shell: bash -l {0} 41 | run: make linkcheck 42 | -------------------------------------------------------------------------------- /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_lq_control 20 | index_multi_agent_models 21 | index_hs_recursive_models 22 | index_classic_linear_models 23 | index_time_series_models 24 | index_asset_pricing 25 | index_dynamic_programming_squared 26 | zreferences 27 | 28 | 29 | .. toctree:: 30 | :hidden: 31 | 32 | 404 33 | search 34 | status 35 | troubleshooting 36 | 37 | | 38 | 39 | .. image:: http://assets.quantecon.org/img/banner.png 40 | :scale: 30% 41 | :align: center 42 | 43 | .. only:: latex 44 | 45 | Acknowledgements: These lectures have benefitted greatly from comments and 46 | suggestion from our colleagues, students and friends. Special thanks go to 47 | Anmol Bhandari, Long Bui, Jeong-Hun Choi, Chase Coleman, David Evans, Shunsuke Hori, 48 | Chenghan Hou, Doc-Jin Jang, Spencer Lyon, Qingyin Ma, Akira Matsushita, 49 | Matthew McKay, Tomohito Okabe, Alex Olssen, Nathan Palmer and Yixiao Zhou. 50 | -------------------------------------------------------------------------------- /source/_static/lecture_specific/orth_proj/orth_proj_thm1.tex: -------------------------------------------------------------------------------- 1 | \documentclass[convert={density=300,size=1080x800,outext=.png}]{standalone} 2 | \usepackage{tikz} 3 | \usetikzlibrary{arrows.meta, arrows} 4 | \begin{document} 5 | 6 | %.. tikz:: 7 | \begin{tikzpicture} 8 | [scale=5, axis/.style={<->, >=stealth'}, important line/.style={thick}, dotted line/.style={dotted, thick,red}, dashed line/.style={dashed, thin}, every node/.style={color=black}] \coordinate(O) at (0,0); 9 | \coordinate (y-yhat) at (-0.2,0.4); 10 | \coordinate (yhat) at (0.6,0.3); 11 | \coordinate (y) at (0.4,0.7); 12 | \coordinate (Z1) at (-0.4,-0.2); 13 | \coordinate (Z2) at (0.8,0.4); 14 | \draw[axis] (-0.5,0) -- (0.9,0) node(xline)[right] {}; 15 | \draw[axis] (0,-0.3) -- (0,0.7) node(yline)[above] {}; 16 | \draw[important line,blue,thick, ->] (O) -- (yhat) node[below] {$\hat y$}; 17 | \draw[important line,blue, ->] (O) -- (y-yhat) node[left] {$y - \hat y$}; 18 | \draw[important line, thick] (Z1) -- (O) node[right] {}; 19 | \draw[important line, thick] (yhat) -- (Z2) node[right] {$S$}; 20 | \draw[important line, blue,->] (O) -- (y) node[right] {$y$}; 21 | \draw[dotted line] (-0.03,0.06) -- (0.03,0.09); 22 | \draw[dotted line] (0.06,0.03) -- (0.03,0.09); 23 | \draw[dotted line] (0.54,0.27) -- (0.51,0.33); 24 | \draw[dotted line] (0.57,0.36) -- (0.51,0.33); 25 | \draw[dashed line, black] (y) -- (yhat); 26 | \draw[-latex, very thin] (0.5,0.4) to [out=210,in=50] (-0.1,0.2); 27 | 28 | \end{tikzpicture} 29 | 30 | \end{document} -------------------------------------------------------------------------------- /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/orth_proj/orth_proj_thm2.tex: -------------------------------------------------------------------------------- 1 | \documentclass[convert={density=300,size=1080x800,outext=.png}]{standalone} 2 | \usepackage{tikz} 3 | \usetikzlibrary{arrows.meta, arrows} 4 | \begin{document} 5 | 6 | %.. tikz:: 7 | \begin{tikzpicture} 8 | [scale=5, axis/.style={<->, >=stealth'}, important line/.style={thick}, dotted line/.style={dotted, thick,red}, dashed line/.style={dashed, thin}, every node/.style={color=black}] \coordinate(O) at (0,0); 9 | \coordinate (y') at (-0.4,0.1); 10 | \coordinate (Py) at (0.6,0.3); 11 | \coordinate (y) at (0.4,0.7); 12 | \coordinate (Z1) at (-0.4,-0.2); 13 | \coordinate (Z2) at (0.8,0.4); 14 | \coordinate (Py') at (-0.28,-0.14); 15 | \draw[axis] (-0.5,0) -- (0.9,0) node(xline)[right] {}; 16 | \draw[axis] (0,-0.3) -- (0,0.7) node(yline)[above] {}; 17 | \draw[important line,blue,thick, ->] (O) -- (Py) node[anchor = north west, text width=2em] {$P y$}; 18 | \draw[important line,blue, ->] (O) -- (y') node[left] {$y'$}; 19 | \draw[important line, thick] (Z1) -- (O) node[right] {}; 20 | \draw[important line, thick] (Py) -- (Z2) node[right] {$S$}; 21 | \draw[important line, blue,->] (O) -- (y) node[right] {$y$}; 22 | \draw[dotted line] (0.54,0.27) -- (0.51,0.33); 23 | \draw[dotted line] (0.57,0.36) -- (0.51,0.33); 24 | \draw[dotted line] (-0.22,-0.11) -- (-0.25,-0.05); 25 | \draw[dotted line] (-0.31,-0.08) -- (-0.25,-0.05); 26 | \draw[dashed line, black] (y) -- (Py); 27 | \draw[dashed line, black] (y') -- (Py') node[anchor = north west, text width=5em] {$P y'$}; 28 | \end{tikzpicture} 29 | 30 | \end{document} -------------------------------------------------------------------------------- /source/_static/lecture_specific/orth_proj/orth_proj_thm3.tex: -------------------------------------------------------------------------------- 1 | \documentclass[convert={density=300,size=1080x800,outext=.png}]{standalone} 2 | \usepackage{tikz} 3 | \usetikzlibrary{arrows.meta, arrows} 4 | \begin{document} 5 | 6 | %.. tikz:: 7 | \begin{tikzpicture} 8 | [scale=5, axis/.style={<->, >=stealth'}, important line/.style={thick}, dotted line/.style={dotted, thick,red}, dashed line/.style={dashed, thin}, every node/.style={color=black}] \coordinate(O) at (0,0); 9 | \coordinate (uhat) at (-0.2,0.4); 10 | \coordinate (yhat) at (0.6,0.3); 11 | \coordinate (y) at (0.4,0.7); 12 | \coordinate (S1) at (-0.4,-0.2); 13 | \coordinate (S2) at (0.8,0.4); 14 | \coordinate (S3) at (-0.3,0.6); 15 | \coordinate (S4) at (0.12,-0.24); 16 | \draw[axis] (-0.5,0) -- (0.9,0) node(xline)[right] {}; 17 | \draw[axis] (0,-0.3) -- (0,0.7) node(yline)[above] {}; 18 | \draw[important line,blue,thick, ->] (O) -- (yhat) node[anchor = north west, text width=4em] {$P y$}; 19 | \draw[important line,blue, ->] (O) -- (uhat) node[anchor = north east, text width=4em] {$M y$}; 20 | \draw[important line,thick] (uhat) -- (S3) node [anchor = south east, text width=0.5em] {$S^{\perp}$}; 21 | \draw[important line,thick] (O) -- (S4); 22 | \draw[important line, thick] (S1) -- (O) node[right] {}; 23 | \draw[important line, thick] (yhat) -- (S2) node[right] {$S$}; 24 | \draw[important line, blue,->] (O) -- (y) node[right] {$y$}; 25 | \draw[dotted line] (-0.03,0.06) -- (0.03,0.09); 26 | \draw[dotted line] (0.06,0.03) -- (0.03,0.09); 27 | \draw[dotted line] (0.54,0.27) -- (0.51,0.33); 28 | \draw[dotted line] (0.57,0.36) -- (0.51,0.33); 29 | \draw[dotted line] (-0.17,0.34) -- (-0.11,0.37); 30 | \draw[dotted line] (-0.14,0.43) -- (-0.11,0.37); 31 | \draw[dashed line, black] (y) -- (yhat); 32 | \draw[dashed line, black] (y) -- (uhat); 33 | \end{tikzpicture} 34 | 35 | \end{document} -------------------------------------------------------------------------------- /source/_static/lecture_specific/amss2/utilities.py: -------------------------------------------------------------------------------- 1 | import numpy as np 2 | from scipy.interpolate import UnivariateSpline 3 | 4 | 5 | class interpolate_wrapper: 6 | 7 | def __init__(self, F): 8 | self.F = F 9 | 10 | def __getitem__(self, index): 11 | return interpolate_wrapper(np.asarray(self.F[index])) 12 | 13 | def reshape(self, *args): 14 | self.F = self.F.reshape(*args) 15 | return self 16 | 17 | def transpose(self): 18 | self.F = self.F.transpose() 19 | 20 | def __len__(self): 21 | return len(self.F) 22 | 23 | def __call__(self, xvec): 24 | x = np.atleast_1d(xvec) 25 | shape = self.F.shape 26 | if len(x) == 1: 27 | fhat = np.hstack([f(x) for f in self.F.flatten()]) 28 | return fhat.reshape(shape) 29 | else: 30 | fhat = np.vstack([f(x) for f in self.F.flatten()]) 31 | return fhat.reshape(np.hstack((shape, len(x)))) 32 | 33 | 34 | class interpolator_factory: 35 | 36 | def __init__(self, k, s): 37 | self.k, self.s = k, s 38 | 39 | def __call__(self, xgrid, Fs): 40 | shape, m = Fs.shape[:-1], Fs.shape[-1] 41 | Fs = Fs.reshape((-1, m)) 42 | F = [] 43 | xgrid = np.sort(xgrid) # Sort xgrid 44 | for Fhat in Fs: 45 | F.append(UnivariateSpline(xgrid, Fhat, k=self.k, s=self.s)) 46 | return interpolate_wrapper(np.array(F).reshape(shape)) 47 | 48 | 49 | def fun_vstack(fun_list): 50 | 51 | Fs = [IW.F for IW in fun_list] 52 | return interpolate_wrapper(np.vstack(Fs)) 53 | 54 | 55 | def fun_hstack(fun_list): 56 | 57 | Fs = [IW.F for IW in fun_list] 58 | return interpolate_wrapper(np.hstack(Fs)) 59 | 60 | 61 | def simulate_markov(π, s_0, T): 62 | 63 | sHist = np.empty(T, dtype=int) 64 | sHist[0] = s_0 65 | S = len(π) 66 | for t in range(1, T): 67 | sHist[t] = np.random.choice(np.arange(S), p=π[sHist[t - 1]]) 68 | 69 | return sHist 70 | -------------------------------------------------------------------------------- /.github/workflows/preview.yml: -------------------------------------------------------------------------------- 1 | name: 'Netlify Preview Deploy' 2 | on: 3 | pull_request: 4 | types: ['opened', 'edited', 'synchronize'] 5 | jobs: 6 | deploy-preview: 7 | name: 'Deploy' 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-advanced 21 | - name: Get Changed Files 22 | id: files 23 | uses: jitterbit/get-changed-files@v1 24 | - name: Checkout QuantEcon theme 25 | if: github.event.pull_request.head.repo.full_name == github.repository 26 | uses: actions/checkout@v2 27 | with: 28 | repository: QuantEcon/lecture-python-advanced.theme 29 | token: ${{ secrets.ACTIONS_PAT }} 30 | path: theme/lecture-python-advanced.theme 31 | # - name: Get current date 32 | # id: date 33 | # run: echo "::set-output name=date::$(date +'%Y-%m-%d')" 34 | # - name: Check Sphinx Cache 35 | # id: cache 36 | # uses: actions/cache@v1 37 | # with: 38 | # path: _build 39 | # key: cache-sphinx 40 | # # key: cache-sphinx-${{ steps.date.outputs.date }} 41 | - name: Build website files 42 | shell: bash -l {0} 43 | run: | 44 | bash scripts/build-website.sh "${{ steps.files.outputs.added_modified }}" "${{ github.event.pull_request.head.repo.full_name == github.repository }}" 45 | - name: Preview Deploy to Netlify 46 | uses: nwtgck/actions-netlify@v1.1 47 | if: env.BUILD_NETLIFY == 'true' && github.event.pull_request.head.repo.full_name == github.repository 48 | with: 49 | publish-dir: './_build/website/jupyter_html' 50 | production-branch: master 51 | github-token: ${{ secrets.GITHUB_TOKEN }} 52 | deploy-message: "Preview Deploy from GitHub Actions" 53 | env: 54 | NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }} 55 | NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }} -------------------------------------------------------------------------------- /source/_static/lecture_specific/coase/allocation.tex: -------------------------------------------------------------------------------- 1 | \documentclass[convert={density=300,size=1080x800,outext=.png}]{standalone} 2 | 3 | \usepackage{tikz} 4 | \usetikzlibrary{decorations.pathreplacing} 5 | \usetikzlibrary{arrows,positioning} 6 | \tikzset{ 7 | %Define standard arrow tip 8 | >=stealth', 9 | %Define style for boxes 10 | punkt/.style={ 11 | rectangle, 12 | rounded corners, 13 | draw=black, very thick, 14 | text width=6.5em, 15 | minimum height=2em, 16 | text centered}, 17 | % Define arrow style 18 | pil/.style={ 19 | ->, 20 | thick} 21 | } 22 | 23 | 24 | \begin{document} 25 | 26 | \begin{tikzpicture}[scale=1] 27 | 28 | \def\linelen{12} 29 | \def\tone{0.66 * \linelen}; 30 | \def\ttwo{0.33 * \linelen}; 31 | 32 | \draw[thick] (0,0) -- (\linelen,0); 33 | 34 | \fill (0,0) circle (2pt) node [below] {$t_3 = 0$}; 35 | \fill (\linelen,0) circle (2pt) node [below] {$t_0 = 1$}; 36 | \fill (\tone,0) circle (2pt) node [below] {$t_1$}; 37 | \fill (\ttwo,0) circle (2pt) node [below] {$t_2$}; 38 | 39 | \draw [decorate,decoration={brace,amplitude=10pt},xshift=0pt,yshift=3pt] 40 | (0,0) -- (\ttwo,0) node [black,midway,yshift=0.8cm] {\footnotesize 41 | $\ell_3$}; 42 | 43 | \draw [decorate,decoration={brace,amplitude=10pt},xshift=0pt,yshift=3pt] 44 | (\ttwo,0) -- (\tone,0) node [black,midway,yshift=0.8cm] {\footnotesize 45 | $\ell_2$}; 46 | 47 | \draw [decorate,decoration={brace,amplitude=10pt},xshift=0pt,yshift=3pt] 48 | (\tone,0) -- (\linelen,0) node [black,midway,yshift=0.8cm] {\footnotesize 49 | $\ell_1$}; 50 | 51 | \node at (10, 0) [below] {\footnotesize firm 1}; 52 | \node at (6, 0) [below] {\footnotesize firm 2}; 53 | \node at (2, 0) [below] {\footnotesize firm 3}; 54 | 55 | % Notation on in-house production and firm boundaries 56 | \def\a{2}; 57 | \draw[->] (5.9, \a) -- (5.9, 1.15) ; 58 | \draw[->] (6, \a) node [above] {\footnotesize $\ell_i = $ range of tasks 59 | carried out by firm $i$} -- (9.5, 1.1) ; 60 | \draw[->] (5.8, \a) -- (2.5, 1.1) ; 61 | 62 | \def\b{-2}; 63 | \draw[->] (6, \b) -- (\tone, -0.8) ; 64 | \draw[->] (5.9, \b) node [below] {\footnotesize $t_i = $ upstream boundary 65 | of firm $i$} -- (\ttwo, -0.8) ; 66 | \draw[->] (5.8, \b) -- (0, -0.8) ; 67 | 68 | \end{tikzpicture} 69 | 70 | 71 | \end{document} 72 | -------------------------------------------------------------------------------- /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 advanced 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 |