Skip to content

Commit b3851cd

Browse files
authored
Fix shocks in simulated data (#414)
1 parent 9a009af commit b3851cd

19 files changed

Lines changed: 153 additions & 79 deletions

.conda/meta.yaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,8 @@ requirements:
1818
- python >=3.6
1919
run:
2020
- python >=3.6
21-
- chaospy
2221
- click
23-
- estimagic >=0.0.30
22+
- estimagic >=0.1.2
2423
- hypothesis
2524
- joblib
2625
- fastparquet

.pre-commit-config.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,16 @@ repos:
1010
- id: debug-statements
1111
- id: end-of-file-fixer
1212
- repo: https://github.com/asottile/pyupgrade
13-
rev: v2.19.0
13+
rev: v2.24.0
1414
hooks:
1515
- id: pyupgrade
1616
args: [--py36-plus]
1717
- repo: https://github.com/asottile/reorder_python_imports
18-
rev: v2.5.0
18+
rev: v2.6.0
1919
hooks:
2020
- id: reorder-python-imports
2121
- repo: https://github.com/psf/black
22-
rev: 21.5b2
22+
rev: 21.7b0
2323
hooks:
2424
- id: black
2525
- repo: https://github.com/asottile/blacken-docs
@@ -47,7 +47,7 @@ repos:
4747
Pygments,
4848
]
4949
- repo: https://github.com/PyCQA/doc8
50-
rev: 0.9.0a1
50+
rev: 0.9.0
5151
hooks:
5252
- id: doc8
5353
# - repo: https://github.com/codespell-project/codespell

docs/about_us.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ an issue on Github, writing an `email`_ to or join our `zulipchat group
6868

6969
|OSE| |space| |TRA| |space| |UniBonn| |space| |DIW|
7070

71-
.. |OSE| image:: https://raw.githubusercontent.com/OpenSourceEconomics/ose-corporate-design/master/logos/OSE_logo_RGB.svg
71+
.. |OSE| image:: https://raw.githubusercontent.com/OpenSourceEconomics/ose-logos/main/OSE_logo_RGB.svg
7272
:width: 20%
7373
:target: https://open-econ.org
7474

docs/conf.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
author = "The respy Development Team"
1919

2020
# The full version, including alpha/beta/rc tags.
21-
release = "2.1.0"
21+
release = "2.1.1"
2222
version = ".".join(release.split(".")[:2])
2323

2424
# -- General configuration ------------------------------------------------
@@ -68,6 +68,8 @@
6868
"python": ("https://docs.python.org/3.8", None),
6969
}
7070

71+
bibtex_bibfiles = ["explanations/refs.bib"]
72+
7173
# Add any paths that contain templates here, relative to this directory.
7274
templates_path = ["_templates"]
7375
html_static_path = ["_static"]
@@ -138,6 +140,6 @@
138140

139141

140142
html_sidebars = {
141-
"index": ["sidebar-search-bs.html", "custom-intro.html"],
142-
"about_us": ["sidebar-search-bs.html", "custom-about-us.html"],
143+
"index": ["search-field", "custom-intro"],
144+
"about_us": ["search-field", "custom-about-us"],
143145
}

docs/how_to_guides/how_to_numerical_integration.ipynb

Lines changed: 53 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -2,124 +2,135 @@
22
"cells": [
33
{
44
"cell_type": "markdown",
5-
"metadata": {},
65
"source": [
76
"# Numerical Integration\n",
87
"\n",
98
"One important component of the solution to the DCDP problem in **respy** models is numerical integration. A bottleneck in solving and estimating the model is the solution of the expected value function, the so-called $EMax(\\cdot)$. Solving the $EMax(\\cdot)$ requires us to solve a multi-dimensional integral at every point in the state space. The integrated value function does not have an analytical solution and thus requires the application of numerical methods.\n",
109
"\n",
1110
"As the models become more complex, the computational burden increases as adding new features to the model increases the required number of function evaluations, which are the costly operation in numerical integration. Numerical integration usually uses monte carlo simulation. Results from applied mathematics, however, suggest methods that are more efficient and thus enable a performance increase. For the same number of function evaluations (and hence computational cost) quasi-Monte Carlo methods achieve a significantly higher accuracy. **respy** thus enables users to select between various methods for the numerical approximation of the $EMax(\\cdot)$. The numerical integration is controlled in the `options` of a specified model.\n"
12-
]
11+
],
12+
"metadata": {}
1313
},
1414
{
1515
"cell_type": "code",
1616
"execution_count": 2,
17-
"metadata": {},
18-
"outputs": [],
1917
"source": [
20-
"import respy as rp\n",
18+
"import respy as rp\r\n",
2119
"_, options = rp.get_example_model(\"kw_94_one\", with_data=False)"
22-
]
20+
],
21+
"outputs": [],
22+
"metadata": {}
2323
},
2424
{
2525
"cell_type": "markdown",
26-
"metadata": {},
2726
"source": [
2827
"## Numerical integration method\n",
2928
"\n",
3029
"The option `monte_carlo_sequence` controls how points are drawn.\n",
3130
"\n",
3231
"- `random`: Points are drawn randomly (crude Monte Carlo).\n",
3332
"- `sobol` or `halton`: Points are drawn from low-discrepancy sequences (superiority in coverage). This means a given approximation error can be achieved with less points."
34-
]
33+
],
34+
"metadata": {}
35+
},
36+
{
37+
"cell_type": "markdown",
38+
"source": [
39+
"<div class=\"alert alert-block alert-warning\">\r\n",
40+
"**Note**: **respy** relies on [chaospy](https://chaospy.readthedocs.io/en/master) for the `sobol` and `halton` sequence. You need to install it in addition to **respy**.\r\n",
41+
"</div>"
42+
],
43+
"metadata": {}
3544
},
3645
{
3746
"cell_type": "code",
3847
"execution_count": 3,
39-
"metadata": {},
48+
"source": [
49+
"options[\"monte_carlo_sequence\"]"
50+
],
4051
"outputs": [
4152
{
53+
"output_type": "execute_result",
4254
"data": {
4355
"text/plain": [
4456
"'random'"
4557
]
4658
},
47-
"execution_count": 3,
4859
"metadata": {},
49-
"output_type": "execute_result"
60+
"execution_count": 3
5061
}
5162
],
52-
"source": [
53-
"options[\"monte_carlo_sequence\"]"
54-
]
63+
"metadata": {}
5564
},
5665
{
5766
"cell_type": "markdown",
58-
"metadata": {},
5967
"source": [
60-
"## Solution draws\n",
61-
"\n",
68+
"## Solution draws\r\n",
69+
"\r\n",
6270
"The number of solution draws controls how many points are used to evaluate an integral. You can specify them using the option `solution_draws`."
63-
]
71+
],
72+
"metadata": {}
6473
},
6574
{
6675
"cell_type": "code",
6776
"execution_count": 4,
68-
"metadata": {},
77+
"source": [
78+
"options[\"solution_draws\"]"
79+
],
6980
"outputs": [
7081
{
82+
"output_type": "execute_result",
7183
"data": {
7284
"text/plain": [
7385
"500"
7486
]
7587
},
76-
"execution_count": 4,
7788
"metadata": {},
78-
"output_type": "execute_result"
89+
"execution_count": 4
7990
}
8091
],
81-
"source": [
82-
"options[\"solution_draws\"]"
83-
]
92+
"metadata": {}
8493
},
8594
{
8695
"cell_type": "markdown",
87-
"metadata": {},
8896
"source": [
8997
"Increasing the number of solution draws increases the accuracy of the solution at the cost of the computational burden."
90-
]
98+
],
99+
"metadata": {}
91100
},
92101
{
93102
"cell_type": "raw",
94-
"metadata": {},
95103
"source": [
96-
"<div class=\"d-flex flex-row gs-torefguide\">\n",
97-
" <span class=\"badge badge-info\">Project</span>\n",
98-
"\n",
99-
" Find an exploration of numerical integration methods in \n",
100-
" EKW models in <a\n",
101-
" href=\"../projects/numerical_integration.html\">Improving the Numerical Integration</a>.\n",
104+
"<div class=\"d-flex flex-row gs-torefguide\">\r\n",
105+
" <span class=\"badge badge-info\">Project</span>\r\n",
106+
"\r\n",
107+
" Find an exploration of numerical integration methods in \r\n",
108+
" EKW models in <a\r\n",
109+
" href=\"../projects/numerical_integration.html\">Improving the Numerical Integration</a>.\r\n",
102110
"</div>"
103-
]
111+
],
112+
"metadata": {}
104113
}
105114
],
106115
"metadata": {
107116
"kernelspec": {
108-
"display_name": "Python 3",
109-
"language": "python",
110-
"name": "python3"
117+
"name": "python3",
118+
"display_name": "Python 3.9.5 64-bit ('respy': conda)"
111119
},
112120
"language_info": {
121+
"name": "python",
122+
"version": "3.9.6",
123+
"mimetype": "text/x-python",
113124
"codemirror_mode": {
114125
"name": "ipython",
115126
"version": 3
116127
},
117-
"file_extension": ".py",
118-
"mimetype": "text/x-python",
119-
"name": "python",
120-
"nbconvert_exporter": "python",
121128
"pygments_lexer": "ipython3",
122-
"version": "3.7.9"
129+
"nbconvert_exporter": "python",
130+
"file_extension": ".py"
131+
},
132+
"interpreter": {
133+
"hash": "b549dadab0c2edb1c58f223f7584f57e60f2cc8e65ef8392efb9b23cb30dad20"
123134
}
124135
},
125136
"nbformat": 4,

docs/release_notes.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ releases are available on `Anaconda.org
2121
(:ghuser:`MaxBlesch`, :ghuser:`amageh`).
2222
- :gh:`406` More information in example models guide (:ghuser:`carolinalvarez`,
2323
:ghuser:`amageh`).
24+
- :gh:`414` Fix bug in simulate that added untransformed shocks to df. Removes
25+
chaospy from conda dependencies(:ghuser:`amageh`).
2426

2527

2628
2.0.0 - 2019-2020

docs/rtd_environment.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ dependencies:
99
- sphinx
1010
- sphinx-autobuild
1111
- sphinx-autoapi
12-
- sphinxcontrib-bibtex<2.0.0
13-
- pydata-sphinx-theme<0.6.0
12+
- sphinxcontrib-bibtex>=2.0.0
13+
- pydata-sphinx-theme>=0.6.0
1414
- parso>=0.8.1
1515
- pip:
1616
- sphinx-tabs

docs/tutorials/index.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ you will find several cross-references to the theoretical concepts behind the mo
112112
<div class="card-header">Exogenous Processes</div>
113113
<div class="card-body flex-fill">
114114
<p class="card-text">
115-
We introduce exogenous processes such as childrearing
115+
We introduce exogenous processes such as child rearing
116116
or health conditions to our model.
117117
</p>
118118
</div>

docs/tutorials/installation.rst

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,17 @@ path, installing **respy** is as simple as typing
4747
in a command shell. The whole package repository can be found under
4848
https://anaconda.org/OpenSourceEconomics/respy.
4949

50+
51+
If you want to use different numerical integration methods implemented in **respy** you
52+
also need to additionally install the package
53+
`chaospy <https://chaospy.readthedocs.io>`_ as it is not added automatically as a
54+
package dependency.
55+
56+
.. code-block:: bash
57+
58+
$ pip install chaospy
59+
60+
5061
As **respy** relies heavily on ``pandas``, you might also want to install their
5162
`recommended dependencies <https://pandas.pydata.org/pandas-docs/stable/getting_started/
5263
install.html#recommended-dependencies>`_ to speed up internal calculations done with

environment.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,12 @@ dependencies:
77
- pip
88
- anaconda-client
99
- bottleneck
10-
- chaospy
1110
- click
1211
- codecov
1312
- conda-build
1413
- conda-verify
1514
- doc8
16-
- estimagic>=0.0.30
15+
- estimagic>=0.1.2
1716
- fastparquet
1817
- hypothesis
1918
- joblib
@@ -26,7 +25,7 @@ dependencies:
2625
- numexpr
2726
- numpydoc
2827
- pandas>=0.24
29-
- numpy>=1.2
28+
- numpy>=1.21.0
3029
- pdbpp
3130
- pre-commit
3231
- pyarrow
@@ -41,12 +40,13 @@ dependencies:
4140
- snakeviz
4241
- sphinx
4342
- sphinx-autobuild
44-
- sphinxcontrib-bibtex<2.0.0
43+
- sphinxcontrib-bibtex>=2.0.0
4544
- sphinx-autoapi
46-
- pydata-sphinx-theme>=0.3.0
45+
- pydata-sphinx-theme>=0.6.0
4746
- tox-conda
4847
- pip:
4948
- apprise
5049
- bump2version
5150
- pytest-randomly
5251
- sphinx-tabs
52+
- chaospy>=4.2.3

0 commit comments

Comments
 (0)