-
-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
revised demographics.py and tests and csv data files #36
Conversation
Hi @rickecon, You mentioned that for you the model was breaking at "curve_fit" within the get_fert function. I was testing just now. I'm using test_demographics.py and deliberately failing test_get_fert to get so I can print within the get_fert function.
These values are then scaled to exactly match the under 15 / over 50 totals and included in fert_rates, which gives these values:
So unfortunately, this does not explain why your version is not running. Let me know if I can check something else. |
Updating demog_uk PR branch
Updates to jpycroft's branch
Hi @rickecon, Notes on switch to get_data_df from get_sdmx_data_df to download from eurostat.
|
## [0.1.2] - 2022-10-26 | ||
|
||
### Changed | ||
|
||
* Updated `demographics.py` and `test_demographics.py` (and `calibrate.py`). | ||
* Added some `.csv` data files and `.png` image files. | ||
* Updated the `initial_guess_r_SS` starting value in `oguk_default_parameters.json`. | ||
======= |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(think this might be a merge conflict BTW)
Hi @rickecon, @nikhilwoodruff, To update on trying to run OG-UK from the demog_uk. I note that the tests are failing and, Nikhil, your point above that a merge conflict might be involved. At present, I get the following error (full output attached): File "c:\users\jonat\repos\og-uk\oguk\calibrate.py", line 153, in get_tax_function_parameters (dict_params is a dictionary, btw: type(dict_params): <class 'dict'>) This seems strange, because presumably it works for others, and (I think) it used to work for me too. In any case, I can no longer solve for the SS. I can't work out which changes that I made that could cause this. There were the changes to demographics.py to switch from get_data_df to get_sdmx_data_df. I also reinstalled the environment.yml (because I removed and reinstalled Anaconda), using the version on the demog_uk branch. |
Hello @rickecon @jdebacker @nikhilwoodruff,
I think this is getting close now ...
This new pull request replaces the original one started in March 2021. With changing git addresses and so on, it best to start afresh.
@rickecon: I notice that the old pull request included changes to parameter_plots.py & OG-UKplots.mplstyle. Are these still needed?
test_demographics.py
The testing suite for all of the functions in demographics.py is based on the OG-USA test file. Note that some tests are fairly simple and simply test whether the output is the correct shape.
The six tests in test_demographics.py are:
• test_get_pop_objs tests whether the steady state omega_SS equals the long run omega[-1,:]
• test_pop_smooth tests smooth evolution of omega and g_n
• test_imm_smooth test smooth evolution of imm_rates
• test_fert_rates tests the shape of fert_rates
• test_get_mort (added by Rick) tests the shape of mort_rates, the values of mort_rates against a data list within the test (with 100-period lives and with fewer)
• test_get_imm_resid tests shape of imm_rates
demographics.py
For demographics.py, recent changes are largely code to create further csv files for the downloaded code (saved in \data\demographics), which required some rewriting/restructuring of the code. The raw data can also be checked from these csv files. There are seven csv files needed.
Alternatively, all data can be taken from the Eurostat site by setting download=True in each function.
I was having issues with recovering dataframes from csv files that behaved differently to the original dataframes. I’ve found solutions which work, though there may be more elegant ways of doing it.