Skip to content

Commit 7420047

Browse files
authored
Merge branch 'main' into update_markov_chain_I
2 parents ab23359 + 905b7f9 commit 7420047

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+2581
-5392
lines changed

.github/workflows/collab.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ jobs:
3030
- name: Install Build Software
3131
shell: bash -l {0}
3232
run: |
33-
pip install jupyter-book==0.15.1 docutils==0.17.1 quantecon-book-theme==0.7.1 sphinx-tojupyter==0.3.0 sphinxext-rediraffe==0.2.7 sphinx-exercise==0.4.1 sphinxcontrib-youtube==1.1.0 sphinx-togglebutton==0.3.1 arviz==0.13.0 sphinx_proof==0.1.3
33+
pip install jupyter-book==0.15.1 docutils==0.17.1 quantecon-book-theme==0.7.2 sphinx-tojupyter==0.3.0 sphinxext-rediraffe==0.2.7 sphinx-exercise==0.4.1 sphinxcontrib-youtube==1.1.0 sphinx-togglebutton==0.3.1 arviz==0.13.0 sphinx_proof==0.2.0 sphinx_reredirects==0.1.3
3434
# Build of HTML (Execution Testing)
3535
- name: Build HTML
3636
shell: bash -l {0}

.github/workflows/publish.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ jobs:
8383
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
8484
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
8585
- name: Deploy website to gh-pages
86-
uses: peaceiris/actions-gh-pages@v3
86+
uses: peaceiris/actions-gh-pages@v4
8787
with:
8888
github_token: ${{ secrets.GITHUB_TOKEN }}
8989
publish_dir: _build/html/

environment.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,20 @@ channels:
44
- conda-forge
55
dependencies:
66
- python=3.11
7-
- anaconda=2024.02
7+
- anaconda=2024.06
88
- pip
99
- pip:
1010
- jupyter-book==0.15.1
1111
- docutils==0.17.1
12-
- quantecon-book-theme==0.7.1
12+
- quantecon-book-theme==0.7.2
1313
- sphinx-tojupyter==0.3.0
1414
- sphinxext-rediraffe==0.2.7
1515
- sphinx-exercise==0.4.1
16-
- sphinx-proof==0.1.3
16+
- sphinx-proof==0.2.0
1717
- ghp-import==1.1.0
1818
- sphinxcontrib-youtube==1.1.0
1919
- sphinx-togglebutton==0.3.1
20+
- sphinx_reredirects==0.1.3
2021
# Sandpit Requirements
2122
# - PuLP
2223
# - cvxpy

lectures/_config.yml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ latex:
3535
targetname: quantecon-python-intro.tex
3636

3737
sphinx:
38-
extra_extensions: [sphinx_multitoc_numbering, sphinxext.rediraffe, sphinx_exercise, sphinx_togglebutton, sphinx.ext.intersphinx, sphinx_proof, sphinx_tojupyter]
38+
extra_extensions: [sphinx_multitoc_numbering, sphinxext.rediraffe, sphinx_exercise, sphinx_togglebutton, sphinx.ext.intersphinx, sphinx_proof, sphinx_tojupyter, sphinx_reredirects]
3939
config:
4040
bibtex_reference_style: author_year
4141
# false-positive links
@@ -45,6 +45,7 @@ sphinx:
4545
width: 80%
4646
nb_code_prompt_show: "Show {type}"
4747
suppress_warnings: [mystnb.unknown_mime_type, myst.domains]
48+
proof_minimal_theme: true
4849
# -------------
4950
html_js_files:
5051
- https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.4/require.min.js
@@ -70,11 +71,12 @@ sphinx:
7071
analytics:
7172
google_analytics_id: G-QDS1YRJNGM
7273
launch_buttons:
73-
notebook_interface : classic # The interface interactive links will activate ["classic", "jupyterlab"]
74-
binderhub_url : https://mybinder.org # The URL of the BinderHub (e.g., https://mybinder.org)
7574
colab_url : https://colab.research.google.com
7675
thebe : false # Add a thebe button to pages (requires the repository to run on Binder)
7776
intersphinx_mapping:
77+
intermediate:
78+
- https://python.quantecon.org/
79+
- null
7880
pyprog:
7981
- https://python-programming.quantecon.org/
8082
- null
@@ -107,6 +109,9 @@ sphinx:
107109
mathjax_path: https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js
108110
rediraffe_redirects:
109111
index_toc.md: intro.md
112+
# Remote Redirects
113+
redirects:
114+
ak2: https://python.quantecon.org/ak2.html
110115
tojupyter_static_file_path: ["_static"]
111116
tojupyter_target_html: true
112117
tojupyter_urlpath: "https://intro.quantecon.org/"
Lines changed: 133 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,133 @@
1+
{
2+
"cells": [
3+
{
4+
"cell_type": "code",
5+
"execution_count": 1,
6+
"id": "258b4bc9-2964-470a-8010-05c2162f5e05",
7+
"metadata": {},
8+
"outputs": [
9+
{
10+
"name": "stdout",
11+
"output_type": "stream",
12+
"text": [
13+
"Requirement already satisfied: wbgapi in /Users/longye/anaconda3/lib/python3.10/site-packages (1.0.12)\n",
14+
"Requirement already satisfied: plotly in /Users/longye/anaconda3/lib/python3.10/site-packages (5.22.0)\n",
15+
"Requirement already satisfied: requests in /Users/longye/anaconda3/lib/python3.10/site-packages (from wbgapi) (2.31.0)\n",
16+
"Requirement already satisfied: tabulate in /Users/longye/anaconda3/lib/python3.10/site-packages (from wbgapi) (0.9.0)\n",
17+
"Requirement already satisfied: PyYAML in /Users/longye/anaconda3/lib/python3.10/site-packages (from wbgapi) (6.0)\n",
18+
"Requirement already satisfied: tenacity>=6.2.0 in /Users/longye/anaconda3/lib/python3.10/site-packages (from plotly) (8.4.1)\n",
19+
"Requirement already satisfied: packaging in /Users/longye/anaconda3/lib/python3.10/site-packages (from plotly) (23.1)\n",
20+
"Requirement already satisfied: urllib3<3,>=1.21.1 in /Users/longye/anaconda3/lib/python3.10/site-packages (from requests->wbgapi) (1.26.16)\n",
21+
"Requirement already satisfied: charset-normalizer<4,>=2 in /Users/longye/anaconda3/lib/python3.10/site-packages (from requests->wbgapi) (2.0.4)\n",
22+
"Requirement already satisfied: idna<4,>=2.5 in /Users/longye/anaconda3/lib/python3.10/site-packages (from requests->wbgapi) (3.4)\n",
23+
"Requirement already satisfied: certifi>=2017.4.17 in /Users/longye/anaconda3/lib/python3.10/site-packages (from requests->wbgapi) (2024.6.2)\n"
24+
]
25+
}
26+
],
27+
"source": [
28+
"!pip install wbgapi plotly\n",
29+
"\n",
30+
"import pandas as pd\n",
31+
"import numpy as np\n",
32+
"import matplotlib.pyplot as plt\n",
33+
"import random as rd\n",
34+
"import wbgapi as wb\n",
35+
"import plotly.express as px\n",
36+
"\n",
37+
"url = 'https://media.githubusercontent.com/media/QuantEcon/high_dim_data/main/SCF_plus/SCF_plus_mini.csv'\n",
38+
"df = pd.read_csv(url)\n",
39+
"df_income_wealth = df.dropna()"
40+
]
41+
},
42+
{
43+
"cell_type": "code",
44+
"execution_count": 4,
45+
"id": "9630a07a-fce5-474e-92af-104e67e82be5",
46+
"metadata": {},
47+
"outputs": [
48+
{
49+
"name": "stdout",
50+
"output_type": "stream",
51+
"text": [
52+
"Requirement already satisfied: quantecon in /Users/longye/anaconda3/lib/python3.10/site-packages (0.7.1)\n",
53+
"Requirement already satisfied: requests in /Users/longye/anaconda3/lib/python3.10/site-packages (from quantecon) (2.31.0)\n",
54+
"Requirement already satisfied: numpy>=1.17.0 in /Users/longye/anaconda3/lib/python3.10/site-packages (from quantecon) (1.26.3)\n",
55+
"Requirement already satisfied: numba>=0.49.0 in /Users/longye/anaconda3/lib/python3.10/site-packages (from quantecon) (0.59.1)\n",
56+
"Requirement already satisfied: sympy in /Users/longye/anaconda3/lib/python3.10/site-packages (from quantecon) (1.12)\n",
57+
"Requirement already satisfied: scipy>=1.5.0 in /Users/longye/anaconda3/lib/python3.10/site-packages (from quantecon) (1.12.0)\n",
58+
"Requirement already satisfied: llvmlite<0.43,>=0.42.0dev0 in /Users/longye/anaconda3/lib/python3.10/site-packages (from numba>=0.49.0->quantecon) (0.42.0)\n",
59+
"Requirement already satisfied: certifi>=2017.4.17 in /Users/longye/anaconda3/lib/python3.10/site-packages (from requests->quantecon) (2024.6.2)\n",
60+
"Requirement already satisfied: idna<4,>=2.5 in /Users/longye/anaconda3/lib/python3.10/site-packages (from requests->quantecon) (3.4)\n",
61+
"Requirement already satisfied: charset-normalizer<4,>=2 in /Users/longye/anaconda3/lib/python3.10/site-packages (from requests->quantecon) (2.0.4)\n",
62+
"Requirement already satisfied: urllib3<3,>=1.21.1 in /Users/longye/anaconda3/lib/python3.10/site-packages (from requests->quantecon) (1.26.16)\n",
63+
"Requirement already satisfied: mpmath>=0.19 in /Users/longye/anaconda3/lib/python3.10/site-packages (from sympy->quantecon) (1.3.0)\n"
64+
]
65+
}
66+
],
67+
"source": [
68+
"!pip install quantecon\n",
69+
"import quantecon as qe\n",
70+
"\n",
71+
"varlist = ['n_wealth', # net wealth \n",
72+
" 't_income', # total income\n",
73+
" 'l_income'] # labor income\n",
74+
"\n",
75+
"df = df_income_wealth\n",
76+
"years = df.year.unique()\n",
77+
"\n",
78+
"# create lists to store Gini for each inequality measure\n",
79+
"results = {}\n",
80+
"\n",
81+
"for var in varlist:\n",
82+
" # create lists to store Gini\n",
83+
" gini_yr = []\n",
84+
" for year in years:\n",
85+
" # repeat the observations according to their weights\n",
86+
" counts = list(round(df[df['year'] == year]['weights'] ))\n",
87+
" y = df[df['year'] == year][var].repeat(counts)\n",
88+
" y = np.asarray(y)\n",
89+
" \n",
90+
" rd.shuffle(y) # shuffle the sequence\n",
91+
" \n",
92+
" # calculate and store Gini\n",
93+
" gini = qe.gini_coefficient(y)\n",
94+
" gini_yr.append(gini)\n",
95+
" \n",
96+
" results[var] = gini_yr\n",
97+
"\n",
98+
"# Convert to DataFrame\n",
99+
"results = pd.DataFrame(results, index=years)\n",
100+
"results.to_csv(\"usa-gini-nwealth-tincome-lincome.csv\", index_label='year')"
101+
]
102+
},
103+
{
104+
"cell_type": "code",
105+
"execution_count": null,
106+
"id": "d59e876b-2f77-4fa7-b79a-8e455ad82d43",
107+
"metadata": {},
108+
"outputs": [],
109+
"source": []
110+
}
111+
],
112+
"metadata": {
113+
"kernelspec": {
114+
"display_name": "Python 3 (ipykernel)",
115+
"language": "python",
116+
"name": "python3"
117+
},
118+
"language_info": {
119+
"codemirror_mode": {
120+
"name": "ipython",
121+
"version": 3
122+
},
123+
"file_extension": ".py",
124+
"mimetype": "text/x-python",
125+
"name": "python",
126+
"nbconvert_exporter": "python",
127+
"pygments_lexer": "ipython3",
128+
"version": "3.10.12"
129+
}
130+
},
131+
"nbformat": 4,
132+
"nbformat_minor": 5
133+
}
Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
year,n_wealth,t_income,l_income
2-
1950,0.8257332034366338,0.44248654139458626,0.5342948198773412
3-
1953,0.8059487586599329,0.4264544060935945,0.5158978980963702
4-
1956,0.8121790488050616,0.44426942873399283,0.5349293526208142
5-
1959,0.795206874163792,0.43749348077061573,0.5213985948309416
6-
1962,0.8086945076579359,0.4435843103853645,0.5345127915054341
7-
1965,0.7904149225687935,0.43763715466663444,0.7487860020887753
8-
1968,0.7982885066993497,0.4208620794438902,0.5242396427381545
9-
1971,0.7911574835420259,0.4233344246090255,0.5576454812313466
10-
1977,0.7571418922185215,0.46187678800902543,0.5704448110072049
11-
1983,0.7494335400643013,0.439345618464469,0.5662220844385915
12-
1989,0.7715705301674302,0.5115249581654197,0.601399568747142
13-
1992,0.7508126614055308,0.4740650672076798,0.5983592657979563
14-
1995,0.7569492388110265,0.48965523558400603,0.5969779516716903
15-
1998,0.7603291991801185,0.49117441585168614,0.5774462841723305
16-
2001,0.7816118750507056,0.5239092994681135,0.6042739644967272
17-
2004,0.7700355469522361,0.4884350383903255,0.5981432201792727
18-
2007,0.7821413776486978,0.5197156312086187,0.626345219575322
19-
2010,0.8250825295193438,0.5195972120145615,0.6453653328291903
20-
2013,0.8227698931835303,0.531400174984336,0.6498682917772644
21-
2016,0.8342975903562234,0.5541400068900825,0.6706846793375284
2+
1950,0.8257332034366366,0.44248654139458743,0.534294819877344
3+
1953,0.805948758659935,0.4264544060935942,0.5158978980963682
4+
1956,0.8121790488050612,0.44426942873399367,0.5349293526208106
5+
1959,0.7952068741637912,0.43749348077061534,0.5213985948309414
6+
1962,0.8086945076579386,0.44358431038536356,0.5345127915054446
7+
1965,0.7904149225687949,0.4376371546666344,0.7487860020887701
8+
1968,0.7982885066993503,0.4208620794438885,0.5242396427381534
9+
1971,0.7911574835420282,0.4233344246090255,0.5576454812313462
10+
1977,0.7571418922185215,0.46187678800902554,0.57044481100722
11+
1983,0.749433540064301,0.4393456184644682,0.5662220844385925
12+
1989,0.7715705301674285,0.5115249581654115,0.6013995687471289
13+
1992,0.7508126614055305,0.4740650672076754,0.5983592657979544
14+
1995,0.7569492388110274,0.4896552355840001,0.5969779516717039
15+
1998,0.7603291991801172,0.49117441585168525,0.5774462841723346
16+
2001,0.781611875050703,0.523909299468113,0.6042739644967232
17+
2004,0.7700355469522372,0.48843503839032354,0.5981432201792916
18+
2007,0.782141377648698,0.5197156312086207,0.6263452195753227
19+
2010,0.825082529519342,0.5195972120145641,0.6453653328291843
20+
2013,0.8227698931835299,0.5314001749843426,0.6498682917772886
21+
2016,0.8342975903562537,0.55414000689009,0.6706846793375292
Loading

lectures/_static/quant-econ.bib

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,47 @@
22
QuantEcon Bibliography File used in conjuction with sphinxcontrib-bibtex package
33
Note: Extended Information (like abstracts, doi, url's etc.) can be found in quant-econ-extendedinfo.bib file in _static/
44
###
5+
6+
7+
@book{russell2004history,
8+
title={History of western philosophy},
9+
author={Russell, Bertrand},
10+
year={2004},
11+
publisher={Routledge}
12+
}
13+
14+
@article{north1989,
15+
title={Constitutions and commitment: the evolution of institutions governing public choice in seventeenth-century England},
16+
author={North, Douglass C and Weingast, Barry R},
17+
journal={The journal of economic history},
18+
volume={49},
19+
number={4},
20+
pages={803--832},
21+
year={1989},
22+
publisher={Cambridge University Press}
23+
}
24+
25+
@incollection{keynes1940pay,
26+
title={How to Pay for the War},
27+
author={Keynes, John Maynard},
28+
booktitle={Essays in persuasion},
29+
pages={367--439},
30+
year={1940},
31+
publisher={Springer}
32+
}
33+
34+
@article{bryant1984price,
35+
title={A price discrimination analysis of monetary policy},
36+
author={Bryant, John and Wallace, Neil},
37+
journal={The Review of Economic Studies},
38+
volume={51},
39+
number={2},
40+
pages={279--288},
41+
year={1984},
42+
publisher={Wiley-Blackwell}
43+
}
44+
45+
546
@article{levitt2019did,
647
title={Why did ancient states collapse?: the dysfunctional state},
748
author={Levitt, Malcolm},

lectures/_toc.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ parts:
1111
- file: long_run_growth
1212
- file: business_cycle
1313
- file: inflation_history
14+
- file: french_rev
1415
- file: inequality
1516
- caption: Foundations
1617
numbered: true
@@ -55,8 +56,6 @@ parts:
5556
- file: unpleasant
5657
- file: money_inflation_nonlinear
5758
- file: laffer_adaptive
58-
# - file: french_rev
59-
- file: ak2
6059
- caption: Stochastic Dynamics
6160
numbered: true
6261
chapters:

0 commit comments

Comments
 (0)