From 3ba81e522d7c5c7ebf0fba7bd749ad76ce4732b4 Mon Sep 17 00:00:00 2001 From: bouzaghrane Date: Sun, 4 Dec 2022 19:40:43 +0000 Subject: [PATCH 1/7] age variables labor participation --- demos_urbansim/variables.py | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/demos_urbansim/variables.py b/demos_urbansim/variables.py index 486cf17..0cdbf35 100755 --- a/demos_urbansim/variables.py +++ b/demos_urbansim/variables.py @@ -31,6 +31,31 @@ def intercept(persons): # size = persons.to_frame(columns=["age"]).shape[0] # return np.zeros(size) - 99 +@orca.column('persons') +def agebin1_labor(persons): + p = persons.to_frame(columns=['age'])['age'] + return p.between(20, 30, inclusive='both') * 1 + +@orca.column('persons') +def agebin2_labor(persons): + p = persons.to_frame(columns=['age'])['age'] + return p.between(31, 40, inclusive='both') * 1 + +@orca.column('persons') +def agebin3_labor(persons): + p = persons.to_frame(columns=['age'])['age'] + return p.between(41, 50, inclusive='both') * 1 + +@orca.column('persons') +def agebin4_labor(persons): + p = persons.to_frame(columns=['age'])['age'] + return p.between(51, 70, inclusive='both') * 1 + +@orca.column('persons') +def agebin5_labor(persons): + p = persons.to_frame(columns=['age'])['age'] + return (p>70) * 1 + @orca.column('persons') def agebin1(persons): p = persons.to_frame(columns=['age'])['age'] From c936d6ae04f5a33330f8ba61fb1f06755676b848 Mon Sep 17 00:00:00 2001 From: bouzaghrane Date: Sun, 4 Dec 2022 19:41:26 +0000 Subject: [PATCH 2/7] entering/exiting workforce calibration data --- .../06197001/entering_workforce_obs.csv | 42 +++++++++++++++++++ .../06197001/exiting_workforce_obs.csv | 42 +++++++++++++++++++ 2 files changed, 84 insertions(+) create mode 100644 demos_urbansim/outputs/calibration/06197001/entering_workforce_obs.csv create mode 100644 demos_urbansim/outputs/calibration/06197001/exiting_workforce_obs.csv diff --git a/demos_urbansim/outputs/calibration/06197001/entering_workforce_obs.csv b/demos_urbansim/outputs/calibration/06197001/entering_workforce_obs.csv new file mode 100644 index 0000000..5e6d06c --- /dev/null +++ b/demos_urbansim/outputs/calibration/06197001/entering_workforce_obs.csv @@ -0,0 +1,42 @@ +year,share +2010,0.825 +2011,0.823 +2012,0.813 +2013,0.803 +2014,0.775 +2015,0.756 +2016,0.751 +2017,0.726 +2018,0.721 +2019,0.719 +2020,0.719 +2021,0.719 +2022,0.719 +2023,0.719 +2024,0.719 +2025,0.719 +2026,0.719 +2027,0.719 +2028,0.719 +2029,0.719 +2030,0.719 +2031,0.719 +2032,0.719 +2033,0.719 +2034,0.719 +2035,0.719 +2036,0.719 +2037,0.719 +2038,0.719 +2039,0.719 +2040,0.719 +2041,0.719 +2042,0.719 +2043,0.719 +2044,0.719 +2045,0.719 +2046,0.719 +2047,0.719 +2048,0.719 +2049,0.719 +2050,0.719 \ No newline at end of file diff --git a/demos_urbansim/outputs/calibration/06197001/exiting_workforce_obs.csv b/demos_urbansim/outputs/calibration/06197001/exiting_workforce_obs.csv new file mode 100644 index 0000000..54db8ad --- /dev/null +++ b/demos_urbansim/outputs/calibration/06197001/exiting_workforce_obs.csv @@ -0,0 +1,42 @@ +year,share +2010,0.044 +2011,0.043 +2012,0.042 +2013,0.042 +2014,0.042 +2015,0.043 +2016,0.042 +2017,0.042 +2018,0.041 +2019,0.040 +2020,0.04 +2021,0.04 +2022,0.04 +2023,0.04 +2024,0.04 +2025,0.04 +2026,0.04 +2027,0.04 +2028,0.04 +2029,0.04 +2030,0.04 +2031,0.04 +2032,0.04 +2033,0.04 +2034,0.04 +2035,0.04 +2036,0.04 +2037,0.04 +2038,0.04 +2039,0.04 +2040,0.04 +2041,0.04 +2042,0.04 +2043,0.04 +2044,0.04 +2045,0.04 +2046,0.04 +2047,0.04 +2048,0.04 +2049,0.04 +2050,0.04 \ No newline at end of file From a7561822baa1e1ab96bf14f81660581005281176 Mon Sep 17 00:00:00 2001 From: bouzaghrane Date: Sun, 4 Dec 2022 19:42:06 +0000 Subject: [PATCH 3/7] labor force model configs --- .../custom/06197001/demos_in_labor_force.yaml | 27 ++++++++++++++++++ .../06197001/demos_out_labor_force.yaml | 28 +++++++++++++++++++ 2 files changed, 55 insertions(+) create mode 100644 demos_urbansim/configs/calibrated_configs/custom/06197001/demos_in_labor_force.yaml create mode 100644 demos_urbansim/configs/calibrated_configs/custom/06197001/demos_out_labor_force.yaml diff --git a/demos_urbansim/configs/calibrated_configs/custom/06197001/demos_in_labor_force.yaml b/demos_urbansim/configs/calibrated_configs/custom/06197001/demos_in_labor_force.yaml new file mode 100644 index 0000000..656298c --- /dev/null +++ b/demos_urbansim/configs/calibrated_configs/custom/06197001/demos_in_labor_force.yaml @@ -0,0 +1,27 @@ +modelmanager_version: 0.2.dev9 +saved_object: + filters: worker == 0 + fitted_parameters: + - -0.0185182 + - 0.3578597 + - 0.8037832 + - 1.2053345 + - 2.3996862 + - 4.3787252 + - 0.2860831 + - -0.4146881 + - -0.7963939 + model_expression: stay_out ~ agebin1_labor + agebin2_labor + agebin3_labor + agebin4_labor + agebin5_labor + gender2 + edubin2 + edubin3 + 1 + name: enter_labor_force + out_column: null + out_filters: + - worker == 0 + out_tables: persons + out_transform: null + out_value_false: 0 + out_value_true: 1 + summary_table: null + tables: persons + tags: [] + template: BinaryLogitStep + template_version: 0.2.dev9 \ No newline at end of file diff --git a/demos_urbansim/configs/calibrated_configs/custom/06197001/demos_out_labor_force.yaml b/demos_urbansim/configs/calibrated_configs/custom/06197001/demos_out_labor_force.yaml new file mode 100644 index 0000000..aeacc3c --- /dev/null +++ b/demos_urbansim/configs/calibrated_configs/custom/06197001/demos_out_labor_force.yaml @@ -0,0 +1,28 @@ +modelmanager_version: 0.2.dev9 +saved_object: + filters: + - worker == 1 + fitted_parameters: + - -1.554846 + - 0.100934 + - -0.2373369 + - -0.3938537 + - 0.425738 + - 1.5008334 + - 0.3530349 + - -0.5569076 + - -0.9928796 + model_expression: leaving_workforce ~ agebin1_labor + agebin2_labor + agebin3_labor + agebin4_labor + agebin5_labor + gender2 + edubin2 + edubin3 + 1 + name: exit_labor_force + out_column: null + out_filters: + - worker == 1 + out_tables: persons + out_transform: null + out_value_false: 0 + out_value_true: 1 + summary_table: null + tables: persons + tags: [] + template: BinaryLogitStep + template_version: 0.2.dev9 \ No newline at end of file From 9d2bb7d47abb10e00ca74d2ec15119116cc23f24 Mon Sep 17 00:00:00 2001 From: bouzaghrane Date: Sun, 4 Dec 2022 19:42:51 +0000 Subject: [PATCH 4/7] add income and hsize ct data --- demos_urbansim/data/hsize_ct_06197001.csv | 1082 ++++++++++++++++- demos_urbansim/data/income_rates_06197001.csv | 138 ++- 2 files changed, 1195 insertions(+), 25 deletions(-) diff --git a/demos_urbansim/data/hsize_ct_06197001.csv b/demos_urbansim/data/hsize_ct_06197001.csv index 72cd9da..0200dc3 100644 --- a/demos_urbansim/data/hsize_ct_06197001.csv +++ b/demos_urbansim/data/hsize_ct_06197001.csv @@ -358,4 +358,1084 @@ year,lcm_county_id,hh_size,total_number_of_households 2020,06081,four or more,70640 2020,06085,four or more,190976 2020,06095,four or more,42659 -2020,06097,four or more,42744 \ No newline at end of file +2020,06097,four or more,42744 +2021,06001,one,144803 +2021,06013,one,85236 +2021,06041,one,29456 +2021,06055,one,11697 +2021,06075,one,130549 +2021,06081,one,63919 +2021,06085,one,133580 +2021,06095,one,32123 +2021,06097,one,53369 +2022,06001,one,145364 +2022,06013,one,93045 +2022,06041,one,32079 +2022,06055,one,12668 +2022,06075,one,136815 +2022,06081,one,68901 +2022,06085,one,133027 +2022,06095,one,32956 +2022,06097,one,50422 +2023,06001,one,147123 +2023,06013,one,87191 +2023,06041,one,31895 +2023,06055,one,12022 +2023,06075,one,134187 +2023,06081,one,61638 +2023,06085,one,133896 +2023,06095,one,33333 +2023,06097,one,54235 +2024,06001,one,137552 +2024,06013,one,89899 +2024,06041,one,35035 +2024,06055,one,12038 +2024,06075,one,134065 +2024,06081,one,62818 +2024,06085,one,134405 +2024,06095,one,30882 +2024,06097,one,54859 +2025,06001,one,138663 +2025,06013,one,86408 +2025,06041,one,32333 +2025,06055,one,13149 +2025,06075,one,133937 +2025,06081,one,57938 +2025,06085,one,130568 +2025,06095,one,33174 +2025,06097,one,53210 +2026,06001,one,138557 +2026,06013,one,83423 +2026,06041,one,33013 +2026,06055,one,14161 +2026,06075,one,124885 +2026,06081,one,59046 +2026,06085,one,127972 +2026,06095,one,29229 +2026,06097,one,52393 +2027,06001,one,139647 +2027,06013,one,81688 +2027,06041,one,30282 +2027,06055,one,12348 +2027,06075,one,131049 +2027,06081,one,62017 +2027,06085,one,128155 +2027,06095,one,35098 +2027,06097,one,54959 +2028,06001,one,140793 +2028,06013,one,87593 +2028,06041,one,29428 +2028,06055,one,11005 +2028,06075,one,125466 +2028,06081,one,56594 +2028,06085,one,130039 +2028,06095,one,33767 +2028,06097,one,49557 +2029,06001,one,152150 +2029,06013,one,91579 +2029,06041,one,32844 +2029,06055,one,13628 +2029,06075,one,133760 +2029,06081,one,60842 +2029,06085,one,137042 +2029,06095,one,34647 +2029,06097,one,51370 +2030,06001,one,140797 +2030,06013,one,86988 +2030,06041,one,30769 +2030,06055,one,12237 +2030,06075,one,131319 +2030,06081,one,58558 +2030,06085,one,129387 +2030,06095,one,32896 +2030,06097,one,51098 +2021,06001,two,162979 +2021,06013,two,117662 +2021,06041,two,39735 +2021,06055,two,19210 +2021,06075,two,114470 +2021,06081,two,81812 +2021,06085,two,174087 +2021,06095,two,43508 +2021,06097,two,62958 +2022,06001,two,165327 +2022,06013,two,117999 +2022,06041,two,35076 +2022,06055,two,16492 +2022,06075,two,112272 +2022,06081,two,81822 +2022,06085,two,181001 +2022,06095,two,44173 +2022,06097,two,64120 +2023,06001,two,164872 +2023,06013,two,119625 +2023,06041,two,34107 +2023,06055,two,15284 +2023,06075,two,120874 +2023,06081,two,80920 +2023,06085,two,181860 +2023,06095,two,45790 +2023,06097,two,64288 +2024,06001,two,174249 +2024,06013,two,118368 +2024,06041,two,33538 +2024,06055,two,17461 +2024,06075,two,115777 +2024,06081,two,81625 +2024,06085,two,184136 +2024,06095,two,48014 +2024,06097,two,65613 +2025,06001,two,174839 +2025,06013,two,122036 +2025,06041,two,37115 +2025,06055,two,15708 +2025,06075,two,119352 +2025,06081,two,82396 +2025,06085,two,190772 +2025,06095,two,48322 +2025,06097,two,64098 +2026,06001,two,172573 +2026,06013,two,125588 +2026,06041,two,36030 +2026,06055,two,16264 +2026,06075,two,124120 +2026,06081,two,80781 +2026,06085,two,188040 +2026,06095,two,48734 +2026,06097,two,64563 +2027,06001,two,176194 +2027,06013,two,126838 +2027,06041,two,34908 +2027,06055,two,16195 +2027,06075,two,120182 +2027,06081,two,85661 +2027,06085,two,194474 +2027,06095,two,47655 +2027,06097,two,66727 +2028,06001,two,177540 +2028,06013,two,125966 +2028,06041,two,40144 +2028,06055,two,16905 +2028,06075,two,123044 +2028,06081,two,87613 +2028,06085,two,197759 +2028,06095,two,47694 +2028,06097,two,67335 +2029,06001,two,179441 +2029,06013,two,121888 +2029,06041,two,37075 +2029,06055,two,16588 +2029,06075,two,119768 +2029,06081,two,88002 +2029,06085,two,203245 +2029,06095,two,49842 +2029,06097,two,68508 +2030,06001,two,173638 +2030,06013,two,125801 +2030,06041,two,37579 +2030,06055,two,16890 +2030,06075,two,119667 +2030,06081,two,85245 +2030,06085,two,194296 +2030,06095,two,48435 +2030,06097,two,65572 +2021,06001,three,96392 +2021,06013,three,69063 +2021,06041,three,14559 +2021,06055,three,5357 +2021,06075,three,43649 +2021,06081,three,37708 +2021,06085,three,116744 +2021,06095,three,26120 +2021,06097,three,25771 +2022,06001,three,97683 +2022,06013,three,63171 +2022,06041,three,13757 +2022,06055,three,5896 +2022,06075,three,45083 +2022,06081,three,41664 +2022,06085,three,112945 +2022,06095,three,24593 +2022,06097,three,29319 +2023,06001,three,98851 +2023,06013,three,65873 +2023,06041,three,14497 +2023,06055,three,8238 +2023,06075,three,47478 +2023,06081,three,45438 +2023,06085,three,113250 +2023,06095,three,25257 +2023,06097,three,29155 +2024,06001,three,103716 +2024,06013,three,70095 +2024,06041,three,16314 +2024,06055,three,7803 +2024,06075,three,49018 +2024,06081,three,42719 +2024,06085,three,114359 +2024,06095,three,26731 +2024,06097,three,26988 +2025,06001,three,103213 +2025,06013,three,67486 +2025,06041,three,15695 +2025,06055,three,8008 +2025,06075,three,47312 +2025,06081,three,47902 +2025,06085,three,116933 +2025,06095,three,23651 +2025,06097,three,32049 +2026,06001,three,101614 +2026,06013,three,68228 +2026,06041,three,17202 +2026,06055,three,7639 +2026,06075,three,51436 +2026,06081,three,51655 +2026,06085,three,118549 +2026,06095,three,27416 +2026,06097,three,30083 +2027,06001,three,99653 +2027,06013,three,66945 +2027,06041,three,16067 +2027,06055,three,7008 +2027,06075,three,49000 +2027,06081,three,47736 +2027,06085,three,117223 +2027,06095,three,28231 +2027,06097,three,27244 +2028,06001,three,101701 +2028,06013,three,73417 +2028,06041,three,14813 +2028,06055,three,6431 +2028,06075,three,53708 +2028,06081,three,45651 +2028,06085,three,126043 +2028,06095,three,25985 +2028,06097,three,27654 +2029,06001,three,99140 +2029,06013,three,71956 +2029,06041,three,14418 +2029,06055,three,7280 +2029,06075,three,51540 +2029,06081,three,45049 +2029,06085,three,118924 +2029,06095,three,25962 +2029,06097,three,26276 +2030,06001,three,100968 +2030,06013,three,71449 +2030,06041,three,15264 +2030,06055,three,7196 +2030,06075,three,52027 +2030,06081,three,48908 +2030,06085,three,120655 +2030,06095,three,27201 +2030,06097,three,29544 +2021,06001,four or more,141385 +2021,06013,four or more,104365 +2021,06041,four or more,17973 +2021,06055,four or more,13669 +2021,06075,four or more,54038 +2021,06081,four or more,73087 +2021,06085,four or more,182048 +2021,06095,four or more,38241 +2021,06097,four or more,38605 +2022,06001,four or more,139900 +2022,06013,four or more,106182 +2022,06041,four or more,21515 +2022,06055,four or more,13168 +2022,06075,four or more,52672 +2022,06081,four or more,66501 +2022,06085,four or more,186837 +2022,06095,four or more,39417 +2022,06097,four or more,40487 +2023,06001,four or more,145063 +2023,06013,four or more,109667 +2023,06041,four or more,22348 +2023,06055,four or more,11938 +2023,06075,four or more,52112 +2023,06081,four or more,70795 +2023,06085,four or more,190331 +2023,06095,four or more,38197 +2023,06097,four or more,41409 +2024,06001,four or more,148084 +2024,06013,four or more,109574 +2024,06041,four or more,18622 +2024,06055,four or more,13214 +2024,06075,four or more,54546 +2024,06081,four or more,70311 +2024,06085,four or more,189168 +2024,06095,four or more,39686 +2024,06097,four or more,43415 +2025,06001,four or more,155113 +2025,06013,four or more,116066 +2025,06041,four or more,20744 +2025,06055,four or more,12754 +2025,06075,four or more,56315 +2025,06081,four or more,75044 +2025,06085,four or more,195513 +2025,06095,four or more,40355 +2025,06097,four or more,41305 +2026,06001,four or more,159268 +2026,06013,four or more,114049 +2026,06041,four or more,20088 +2026,06055,four or more,11497 +2026,06075,four or more,58262 +2026,06081,four or more,71963 +2026,06085,four or more,201126 +2026,06095,four or more,43793 +2026,06097,four or more,40465 +2027,06001,four or more,158095 +2027,06013,four or more,116575 +2027,06041,four or more,22962 +2027,06055,four or more,12297 +2027,06075,four or more,60092 +2027,06081,four or more,68771 +2027,06085,four or more,193959 +2027,06095,four or more,40143 +2027,06097,four or more,39899 +2028,06001,four or more,155376 +2028,06013,four or more,109157 +2028,06041,four or more,20569 +2028,06055,four or more,12974 +2028,06075,four or more,60609 +2028,06081,four or more,69796 +2028,06085,four or more,191267 +2028,06095,four or more,44845 +2028,06097,four or more,42888 +2029,06001,four or more,154901 +2029,06013,four or more,114369 +2029,06041,four or more,20961 +2029,06055,four or more,10611 +2029,06075,four or more,60783 +2029,06081,four or more,71110 +2029,06085,four or more,184426 +2029,06095,four or more,39942 +2029,06097,four or more,44535 +2030,06001,four or more,157771 +2030,06013,four or more,114061 +2030,06041,four or more,21288 +2030,06055,four or more,12161 +2030,06075,four or more,59128 +2030,06081,four or more,70640 +2030,06085,four or more,190976 +2030,06095,four or more,42659 +2030,06097,four or more,42744 +2031,06001,one,144803 +2031,06013,one,85236 +2031,06041,one,29456 +2031,06055,one,11697 +2031,06075,one,130549 +2031,06081,one,63919 +2031,06085,one,133580 +2031,06095,one,32123 +2031,06097,one,53369 +2032,06001,one,145364 +2032,06013,one,93045 +2032,06041,one,32079 +2032,06055,one,12668 +2032,06075,one,136815 +2032,06081,one,68901 +2032,06085,one,133027 +2032,06095,one,32956 +2032,06097,one,50422 +2033,06001,one,147123 +2033,06013,one,87191 +2033,06041,one,31895 +2033,06055,one,12022 +2033,06075,one,134187 +2033,06081,one,61638 +2033,06085,one,133896 +2033,06095,one,33333 +2033,06097,one,54235 +2034,06001,one,137552 +2034,06013,one,89899 +2034,06041,one,35035 +2034,06055,one,12038 +2034,06075,one,134065 +2034,06081,one,62818 +2034,06085,one,134405 +2034,06095,one,30882 +2034,06097,one,54859 +2035,06001,one,138663 +2035,06013,one,86408 +2035,06041,one,32333 +2035,06055,one,13149 +2035,06075,one,133937 +2035,06081,one,57938 +2035,06085,one,130568 +2035,06095,one,33174 +2035,06097,one,53210 +2036,06001,one,138557 +2036,06013,one,83423 +2036,06041,one,33013 +2036,06055,one,14161 +2036,06075,one,124885 +2036,06081,one,59046 +2036,06085,one,127972 +2036,06095,one,29229 +2036,06097,one,52393 +2037,06001,one,139647 +2037,06013,one,81688 +2037,06041,one,30282 +2037,06055,one,12348 +2037,06075,one,131049 +2037,06081,one,62017 +2037,06085,one,128155 +2037,06095,one,35098 +2037,06097,one,54959 +2038,06001,one,140793 +2038,06013,one,87593 +2038,06041,one,29428 +2038,06055,one,11005 +2038,06075,one,125466 +2038,06081,one,56594 +2038,06085,one,130039 +2038,06095,one,33767 +2038,06097,one,49557 +2039,06001,one,152150 +2039,06013,one,91579 +2039,06041,one,32844 +2039,06055,one,13628 +2039,06075,one,133760 +2039,06081,one,60842 +2039,06085,one,137042 +2039,06095,one,34647 +2039,06097,one,51370 +2040,06001,one,140797 +2040,06013,one,86988 +2040,06041,one,30769 +2040,06055,one,12237 +2040,06075,one,131319 +2040,06081,one,58558 +2040,06085,one,129387 +2040,06095,one,32896 +2040,06097,one,51098 +2031,06001,two,162979 +2031,06013,two,117662 +2031,06041,two,39735 +2031,06055,two,19210 +2031,06075,two,114470 +2031,06081,two,81812 +2031,06085,two,174087 +2031,06095,two,43508 +2031,06097,two,62958 +2032,06001,two,165327 +2032,06013,two,117999 +2032,06041,two,35076 +2032,06055,two,16492 +2032,06075,two,112272 +2032,06081,two,81822 +2032,06085,two,181001 +2032,06095,two,44173 +2032,06097,two,64120 +2033,06001,two,164872 +2033,06013,two,119625 +2033,06041,two,34107 +2033,06055,two,15284 +2033,06075,two,120874 +2033,06081,two,80920 +2033,06085,two,181860 +2033,06095,two,45790 +2033,06097,two,64288 +2034,06001,two,174249 +2034,06013,two,118368 +2034,06041,two,33538 +2034,06055,two,17461 +2034,06075,two,115777 +2034,06081,two,81625 +2034,06085,two,184136 +2034,06095,two,48014 +2034,06097,two,65613 +2035,06001,two,174839 +2035,06013,two,122036 +2035,06041,two,37115 +2035,06055,two,15708 +2035,06075,two,119352 +2035,06081,two,82396 +2035,06085,two,190772 +2035,06095,two,48322 +2035,06097,two,64098 +2036,06001,two,172573 +2036,06013,two,125588 +2036,06041,two,36030 +2036,06055,two,16264 +2036,06075,two,124120 +2036,06081,two,80781 +2036,06085,two,188040 +2036,06095,two,48734 +2036,06097,two,64563 +2037,06001,two,176194 +2037,06013,two,126838 +2037,06041,two,34908 +2037,06055,two,16195 +2037,06075,two,120182 +2037,06081,two,85661 +2037,06085,two,194474 +2037,06095,two,47655 +2037,06097,two,66727 +2038,06001,two,177540 +2038,06013,two,125966 +2038,06041,two,40144 +2038,06055,two,16905 +2038,06075,two,123044 +2038,06081,two,87613 +2038,06085,two,197759 +2038,06095,two,47694 +2038,06097,two,67335 +2039,06001,two,179441 +2039,06013,two,121888 +2039,06041,two,37075 +2039,06055,two,16588 +2039,06075,two,119768 +2039,06081,two,88002 +2039,06085,two,203245 +2039,06095,two,49842 +2039,06097,two,68508 +2040,06001,two,173638 +2040,06013,two,125801 +2040,06041,two,37579 +2040,06055,two,16890 +2040,06075,two,119667 +2040,06081,two,85245 +2040,06085,two,194296 +2040,06095,two,48435 +2040,06097,two,65572 +2031,06001,three,96392 +2031,06013,three,69063 +2031,06041,three,14559 +2031,06055,three,5357 +2031,06075,three,43649 +2031,06081,three,37708 +2031,06085,three,116744 +2031,06095,three,26120 +2031,06097,three,25771 +2032,06001,three,97683 +2032,06013,three,63171 +2032,06041,three,13757 +2032,06055,three,5896 +2032,06075,three,45083 +2032,06081,three,41664 +2032,06085,three,112945 +2032,06095,three,24593 +2032,06097,three,29319 +2033,06001,three,98851 +2033,06013,three,65873 +2033,06041,three,14497 +2033,06055,three,8238 +2033,06075,three,47478 +2033,06081,three,45438 +2033,06085,three,113250 +2033,06095,three,25257 +2033,06097,three,29155 +2034,06001,three,103716 +2034,06013,three,70095 +2034,06041,three,16314 +2034,06055,three,7803 +2034,06075,three,49018 +2034,06081,three,42719 +2034,06085,three,114359 +2034,06095,three,26731 +2034,06097,three,26988 +2035,06001,three,103213 +2035,06013,three,67486 +2035,06041,three,15695 +2035,06055,three,8008 +2035,06075,three,47312 +2035,06081,three,47902 +2035,06085,three,116933 +2035,06095,three,23651 +2035,06097,three,32049 +2036,06001,three,101614 +2036,06013,three,68228 +2036,06041,three,17202 +2036,06055,three,7639 +2036,06075,three,51436 +2036,06081,three,51655 +2036,06085,three,118549 +2036,06095,three,27416 +2036,06097,three,30083 +2037,06001,three,99653 +2037,06013,three,66945 +2037,06041,three,16067 +2037,06055,three,7008 +2037,06075,three,49000 +2037,06081,three,47736 +2037,06085,three,117223 +2037,06095,three,28231 +2037,06097,three,27244 +2038,06001,three,101701 +2038,06013,three,73417 +2038,06041,three,14813 +2038,06055,three,6431 +2038,06075,three,53708 +2038,06081,three,45651 +2038,06085,three,126043 +2038,06095,three,25985 +2038,06097,three,27654 +2039,06001,three,99140 +2039,06013,three,71956 +2039,06041,three,14418 +2039,06055,three,7280 +2039,06075,three,51540 +2039,06081,three,45049 +2039,06085,three,118924 +2039,06095,three,25962 +2039,06097,three,26276 +2040,06001,three,100968 +2040,06013,three,71449 +2040,06041,three,15264 +2040,06055,three,7196 +2040,06075,three,52027 +2040,06081,three,48908 +2040,06085,three,120655 +2040,06095,three,27201 +2040,06097,three,29544 +2031,06001,four or more,141385 +2031,06013,four or more,104365 +2031,06041,four or more,17973 +2031,06055,four or more,13669 +2031,06075,four or more,54038 +2031,06081,four or more,73087 +2031,06085,four or more,182048 +2031,06095,four or more,38241 +2031,06097,four or more,38605 +2032,06001,four or more,139900 +2032,06013,four or more,106182 +2032,06041,four or more,21515 +2032,06055,four or more,13168 +2032,06075,four or more,52672 +2032,06081,four or more,66501 +2032,06085,four or more,186837 +2032,06095,four or more,39417 +2032,06097,four or more,40487 +2033,06001,four or more,145063 +2033,06013,four or more,109667 +2033,06041,four or more,22348 +2033,06055,four or more,11938 +2033,06075,four or more,52112 +2033,06081,four or more,70795 +2033,06085,four or more,190331 +2033,06095,four or more,38197 +2033,06097,four or more,41409 +2034,06001,four or more,148084 +2034,06013,four or more,109574 +2034,06041,four or more,18622 +2034,06055,four or more,13214 +2034,06075,four or more,54546 +2034,06081,four or more,70311 +2034,06085,four or more,189168 +2034,06095,four or more,39686 +2034,06097,four or more,43415 +2035,06001,four or more,155113 +2035,06013,four or more,116066 +2035,06041,four or more,20744 +2035,06055,four or more,12754 +2035,06075,four or more,56315 +2035,06081,four or more,75044 +2035,06085,four or more,195513 +2035,06095,four or more,40355 +2035,06097,four or more,41305 +2036,06001,four or more,159268 +2036,06013,four or more,114049 +2036,06041,four or more,20088 +2036,06055,four or more,11497 +2036,06075,four or more,58262 +2036,06081,four or more,71963 +2036,06085,four or more,201126 +2036,06095,four or more,43793 +2036,06097,four or more,40465 +2037,06001,four or more,158095 +2037,06013,four or more,116575 +2037,06041,four or more,22962 +2037,06055,four or more,12297 +2037,06075,four or more,60092 +2037,06081,four or more,68771 +2037,06085,four or more,193959 +2037,06095,four or more,40143 +2037,06097,four or more,39899 +2038,06001,four or more,155376 +2038,06013,four or more,109157 +2038,06041,four or more,20569 +2038,06055,four or more,12974 +2038,06075,four or more,60609 +2038,06081,four or more,69796 +2038,06085,four or more,191267 +2038,06095,four or more,44845 +2038,06097,four or more,42888 +2039,06001,four or more,154901 +2039,06013,four or more,114369 +2039,06041,four or more,20961 +2039,06055,four or more,10611 +2039,06075,four or more,60783 +2039,06081,four or more,71110 +2039,06085,four or more,184426 +2039,06095,four or more,39942 +2039,06097,four or more,44535 +2040,06001,four or more,157771 +2040,06013,four or more,114061 +2040,06041,four or more,21288 +2040,06055,four or more,12161 +2040,06075,four or more,59128 +2040,06081,four or more,70640 +2040,06085,four or more,190976 +2040,06095,four or more,42659 +2040,06097,four or more,42744 +2041,06001,one,144803 +2041,06013,one,85236 +2041,06041,one,29456 +2041,06055,one,11697 +2041,06075,one,130549 +2041,06081,one,63919 +2041,06085,one,133580 +2041,06095,one,32123 +2041,06097,one,53369 +2042,06001,one,145364 +2042,06013,one,93045 +2042,06041,one,32079 +2042,06055,one,12668 +2042,06075,one,136815 +2042,06081,one,68901 +2042,06085,one,133027 +2042,06095,one,32956 +2042,06097,one,50422 +2043,06001,one,147123 +2043,06013,one,87191 +2043,06041,one,31895 +2043,06055,one,12022 +2043,06075,one,134187 +2043,06081,one,61638 +2043,06085,one,133896 +2043,06095,one,33333 +2043,06097,one,54235 +2044,06001,one,137552 +2044,06013,one,89899 +2044,06041,one,35035 +2044,06055,one,12038 +2044,06075,one,134065 +2044,06081,one,62818 +2044,06085,one,134405 +2044,06095,one,30882 +2044,06097,one,54859 +2045,06001,one,138663 +2045,06013,one,86408 +2045,06041,one,32333 +2045,06055,one,13149 +2045,06075,one,133937 +2045,06081,one,57938 +2045,06085,one,130568 +2045,06095,one,33174 +2045,06097,one,53210 +2046,06001,one,138557 +2046,06013,one,83423 +2046,06041,one,33013 +2046,06055,one,14161 +2046,06075,one,124885 +2046,06081,one,59046 +2046,06085,one,127972 +2046,06095,one,29229 +2046,06097,one,52393 +2047,06001,one,139647 +2047,06013,one,81688 +2047,06041,one,30282 +2047,06055,one,12348 +2047,06075,one,131049 +2047,06081,one,62017 +2047,06085,one,128155 +2047,06095,one,35098 +2047,06097,one,54959 +2048,06001,one,140793 +2048,06013,one,87593 +2048,06041,one,29428 +2048,06055,one,11005 +2048,06075,one,125466 +2048,06081,one,56594 +2048,06085,one,130039 +2048,06095,one,33767 +2048,06097,one,49557 +2049,06001,one,152150 +2049,06013,one,91579 +2049,06041,one,32844 +2049,06055,one,13628 +2049,06075,one,133760 +2049,06081,one,60842 +2049,06085,one,137042 +2049,06095,one,34647 +2049,06097,one,51370 +2050,06001,one,140797 +2050,06013,one,86988 +2050,06041,one,30769 +2050,06055,one,12237 +2050,06075,one,131319 +2050,06081,one,58558 +2050,06085,one,129387 +2050,06095,one,32896 +2050,06097,one,51098 +2041,06001,two,162979 +2041,06013,two,117662 +2041,06041,two,39735 +2041,06055,two,19210 +2041,06075,two,114470 +2041,06081,two,81812 +2041,06085,two,174087 +2041,06095,two,43508 +2041,06097,two,62958 +2042,06001,two,165327 +2042,06013,two,117999 +2042,06041,two,35076 +2042,06055,two,16492 +2042,06075,two,112272 +2042,06081,two,81822 +2042,06085,two,181001 +2042,06095,two,44173 +2042,06097,two,64120 +2043,06001,two,164872 +2043,06013,two,119625 +2043,06041,two,34107 +2043,06055,two,15284 +2043,06075,two,120874 +2043,06081,two,80920 +2043,06085,two,181860 +2043,06095,two,45790 +2043,06097,two,64288 +2044,06001,two,174249 +2044,06013,two,118368 +2044,06041,two,33538 +2044,06055,two,17461 +2044,06075,two,115777 +2044,06081,two,81625 +2044,06085,two,184136 +2044,06095,two,48014 +2044,06097,two,65613 +2045,06001,two,174839 +2045,06013,two,122036 +2045,06041,two,37115 +2045,06055,two,15708 +2045,06075,two,119352 +2045,06081,two,82396 +2045,06085,two,190772 +2045,06095,two,48322 +2045,06097,two,64098 +2046,06001,two,172573 +2046,06013,two,125588 +2046,06041,two,36030 +2046,06055,two,16264 +2046,06075,two,124120 +2046,06081,two,80781 +2046,06085,two,188040 +2046,06095,two,48734 +2046,06097,two,64563 +2047,06001,two,176194 +2047,06013,two,126838 +2047,06041,two,34908 +2047,06055,two,16195 +2047,06075,two,120182 +2047,06081,two,85661 +2047,06085,two,194474 +2047,06095,two,47655 +2047,06097,two,66727 +2048,06001,two,177540 +2048,06013,two,125966 +2048,06041,two,40144 +2048,06055,two,16905 +2048,06075,two,123044 +2048,06081,two,87613 +2048,06085,two,197759 +2048,06095,two,47694 +2048,06097,two,67335 +2049,06001,two,179441 +2049,06013,two,121888 +2049,06041,two,37075 +2049,06055,two,16588 +2049,06075,two,119768 +2049,06081,two,88002 +2049,06085,two,203245 +2049,06095,two,49842 +2049,06097,two,68508 +2050,06001,two,173638 +2050,06013,two,125801 +2050,06041,two,37579 +2050,06055,two,16890 +2050,06075,two,119667 +2050,06081,two,85245 +2050,06085,two,194296 +2050,06095,two,48435 +2050,06097,two,65572 +2041,06001,three,96392 +2041,06013,three,69063 +2041,06041,three,14559 +2041,06055,three,5357 +2041,06075,three,43649 +2041,06081,three,37708 +2041,06085,three,116744 +2041,06095,three,26120 +2041,06097,three,25771 +2042,06001,three,97683 +2042,06013,three,63171 +2042,06041,three,13757 +2042,06055,three,5896 +2042,06075,three,45083 +2042,06081,three,41664 +2042,06085,three,112945 +2042,06095,three,24593 +2042,06097,three,29319 +2043,06001,three,98851 +2043,06013,three,65873 +2043,06041,three,14497 +2043,06055,three,8238 +2043,06075,three,47478 +2043,06081,three,45438 +2043,06085,three,113250 +2043,06095,three,25257 +2043,06097,three,29155 +2044,06001,three,103716 +2044,06013,three,70095 +2044,06041,three,16314 +2044,06055,three,7803 +2044,06075,three,49018 +2044,06081,three,42719 +2044,06085,three,114359 +2044,06095,three,26731 +2044,06097,three,26988 +2045,06001,three,103213 +2045,06013,three,67486 +2045,06041,three,15695 +2045,06055,three,8008 +2045,06075,three,47312 +2045,06081,three,47902 +2045,06085,three,116933 +2045,06095,three,23651 +2045,06097,three,32049 +2046,06001,three,101614 +2046,06013,three,68228 +2046,06041,three,17202 +2046,06055,three,7639 +2046,06075,three,51436 +2046,06081,three,51655 +2046,06085,three,118549 +2046,06095,three,27416 +2046,06097,three,30083 +2047,06001,three,99653 +2047,06013,three,66945 +2047,06041,three,16067 +2047,06055,three,7008 +2047,06075,three,49000 +2047,06081,three,47736 +2047,06085,three,117223 +2047,06095,three,28231 +2047,06097,three,27244 +2048,06001,three,101701 +2048,06013,three,73417 +2048,06041,three,14813 +2048,06055,three,6431 +2048,06075,three,53708 +2048,06081,three,45651 +2048,06085,three,126043 +2048,06095,three,25985 +2048,06097,three,27654 +2049,06001,three,99140 +2049,06013,three,71956 +2049,06041,three,14418 +2049,06055,three,7280 +2049,06075,three,51540 +2049,06081,three,45049 +2049,06085,three,118924 +2049,06095,three,25962 +2049,06097,three,26276 +2050,06001,three,100968 +2050,06013,three,71449 +2050,06041,three,15264 +2050,06055,three,7196 +2050,06075,three,52027 +2050,06081,three,48908 +2050,06085,three,120655 +2050,06095,three,27201 +2050,06097,three,29544 +2041,06001,four or more,141385 +2041,06013,four or more,104365 +2041,06041,four or more,17973 +2041,06055,four or more,13669 +2041,06075,four or more,54038 +2041,06081,four or more,73087 +2041,06085,four or more,182048 +2041,06095,four or more,38241 +2041,06097,four or more,38605 +2042,06001,four or more,139900 +2042,06013,four or more,106182 +2042,06041,four or more,21515 +2042,06055,four or more,13168 +2042,06075,four or more,52672 +2042,06081,four or more,66501 +2042,06085,four or more,186837 +2042,06095,four or more,39417 +2042,06097,four or more,40487 +2043,06001,four or more,145063 +2043,06013,four or more,109667 +2043,06041,four or more,22348 +2043,06055,four or more,11938 +2043,06075,four or more,52112 +2043,06081,four or more,70795 +2043,06085,four or more,190331 +2043,06095,four or more,38197 +2043,06097,four or more,41409 +2044,06001,four or more,148084 +2044,06013,four or more,109574 +2044,06041,four or more,18622 +2044,06055,four or more,13214 +2044,06075,four or more,54546 +2044,06081,four or more,70311 +2044,06085,four or more,189168 +2044,06095,four or more,39686 +2044,06097,four or more,43415 +2045,06001,four or more,155113 +2045,06013,four or more,116066 +2045,06041,four or more,20744 +2045,06055,four or more,12754 +2045,06075,four or more,56315 +2045,06081,four or more,75044 +2045,06085,four or more,195513 +2045,06095,four or more,40355 +2045,06097,four or more,41305 +2046,06001,four or more,159268 +2046,06013,four or more,114049 +2046,06041,four or more,20088 +2046,06055,four or more,11497 +2046,06075,four or more,58262 +2046,06081,four or more,71963 +2046,06085,four or more,201126 +2046,06095,four or more,43793 +2046,06097,four or more,40465 +2047,06001,four or more,158095 +2047,06013,four or more,116575 +2047,06041,four or more,22962 +2047,06055,four or more,12297 +2047,06075,four or more,60092 +2047,06081,four or more,68771 +2047,06085,four or more,193959 +2047,06095,four or more,40143 +2047,06097,four or more,39899 +2048,06001,four or more,155376 +2048,06013,four or more,109157 +2048,06041,four or more,20569 +2048,06055,four or more,12974 +2048,06075,four or more,60609 +2048,06081,four or more,69796 +2048,06085,four or more,191267 +2048,06095,four or more,44845 +2048,06097,four or more,42888 +2049,06001,four or more,154901 +2049,06013,four or more,114369 +2049,06041,four or more,20961 +2049,06055,four or more,10611 +2049,06075,four or more,60783 +2049,06081,four or more,71110 +2049,06085,four or more,184426 +2049,06095,four or more,39942 +2049,06097,four or more,44535 +2050,06001,four or more,157771 +2050,06013,four or more,114061 +2050,06041,four or more,21288 +2050,06055,four or more,12161 +2050,06075,four or more,59128 +2050,06081,four or more,70640 +2050,06085,four or more,190976 +2050,06095,four or more,42659 +2050,06097,four or more,42744 \ No newline at end of file diff --git a/demos_urbansim/data/income_rates_06197001.csv b/demos_urbansim/data/income_rates_06197001.csv index ccdc5d0..8c05f58 100644 --- a/demos_urbansim/data/income_rates_06197001.csv +++ b/demos_urbansim/data/income_rates_06197001.csv @@ -1,8 +1,8 @@ year,lcm_county_id,rate -2011,06001,-0.020 +2011,06001,-0.02 2011,06013,-0.017 2011,06041,-0.104 -2011,06055,-0.070 +2011,06055,-0.07 2011,06075,-0.051 2011,06081,-0.039 2011,06085,-0.027 @@ -20,7 +20,7 @@ year,lcm_county_id,rate 2013,06001,0.012 2013,06013,0.051 2013,06041,0.051 -2013,06055,0.020 +2013,06055,0.02 2013,06075,0.046 2013,06081,0.103 2013,06085,-0.008 @@ -34,7 +34,7 @@ year,lcm_county_id,rate 2014,06081,0.087 2014,06085,0.041 2014,06095,0.051 -2014,06097,0.090 +2014,06097,0.09 2015,06001,0.043 2015,06013,0.019 2015,06041,0.036 @@ -43,7 +43,7 @@ year,lcm_county_id,rate 2015,06081,-0.012 2015,06085,0.034 2015,06095,-0.023 -2015,06097,-0.030 +2015,06097,-0.03 2016,06001,0.077 2016,06013,0.071 2016,06041,0.009 @@ -53,10 +53,10 @@ year,lcm_county_id,rate 2016,06085,0.061 2016,06095,0.072 2016,06097,0.084 -2017,06001,0.040 +2017,06001,0.04 2017,06013,0.017 2017,06041,0.066 -2017,06055,0.120 +2017,06055,0.12 2017,06075,0.037 2017,06081,0.043 2017,06085,0.041 @@ -64,18 +64,18 @@ year,lcm_county_id,rate 2017,06097,0.057 2018,06001,0.023 2018,06013,0.028 -2018,06041,0.070 -2018,06055,-0.030 +2018,06041,0.07 +2018,06055,-0.03 2018,06075,-0.022 2018,06081,0.029 2018,06085,0.026 2018,06095,0.055 2018,06097,-0.024 -2019,06001,0.030 +2019,06001,0.03 2019,06013,0.024 2019,06041,-0.148 2019,06055,0.035 -2019,06075,0.070 +2019,06075,0.07 2019,06081,0.081 2019,06085,0.021 2019,06095,-0.003 @@ -90,18 +90,18 @@ year,lcm_county_id,rate 2020,06095,0.046 2020,06097,0.048 2021,06001,0.058 -2021,06013,0.050 +2021,06013,0.05 2021,06041,-0.022 2021,06055,0.038 2021,06075,0.073 -2021,06081,0.080 +2021,06081,0.08 2021,06085,0.048 2021,06095,0.051 2021,06097,0.051 2022,06001,0.061 2022,06013,0.053 2022,06041,-0.025 -2022,06055,0.040 +2022,06055,0.04 2022,06075,0.077 2022,06081,0.085 2022,06085,0.051 @@ -111,7 +111,7 @@ year,lcm_county_id,rate 2023,06013,0.056 2023,06041,-0.028 2023,06055,0.042 -2023,06075,0.080 +2023,06075,0.08 2023,06081,0.089 2023,06085,0.053 2023,06095,0.058 @@ -192,7 +192,7 @@ year,lcm_county_id,rate 2032,06013,0.056 2032,06041,-0.028 2032,06055,0.042 -2032,06075,0.080 +2032,06075,0.08 2032,06081,0.089 2032,06085,0.053 2032,06095,0.058 @@ -200,18 +200,18 @@ year,lcm_county_id,rate 2033,06001,0.061 2033,06013,0.053 2033,06041,-0.025 -2033,06055,0.040 +2033,06055,0.04 2033,06075,0.077 2033,06081,0.085 2033,06085,0.051 2033,06095,0.055 2033,06097,0.054 2034,06001,0.058 -2034,06013,0.050 +2034,06013,0.05 2034,06041,-0.022 2034,06055,0.038 2034,06075,0.073 -2034,06081,0.080 +2034,06081,0.08 2034,06085,0.048 2034,06095,0.051 2034,06097,0.051 @@ -231,12 +231,12 @@ year,lcm_county_id,rate 2036,06075,0.064 2036,06081,0.069 2036,06085,0.043 -2036,06095,0.040 +2036,06095,0.04 2036,06097,0.044 2037,06001,0.046 2037,06013,0.037 2037,06041,-0.008 -2037,06055,0.030 +2037,06055,0.03 2037,06075,0.059 2037,06081,0.061 2037,06085,0.039 @@ -258,9 +258,9 @@ year,lcm_county_id,rate 2039,06075,0.046 2039,06081,0.045 2039,06085,0.031 -2039,06095,0.020 +2039,06095,0.02 2039,06097,0.028 -2040,06001,0.030 +2040,06001,0.03 2040,06013,0.018 2040,06041,0.011 2040,06055,0.019 @@ -268,4 +268,94 @@ year,lcm_county_id,rate 2040,06081,0.035 2040,06085,0.027 2040,06095,0.012 -2040,06097,0.022 \ No newline at end of file +2040,06097,0.022 +2041,06001,0.0408 +2041,06013,0.0304 +2041,06041,-0.0016 +2041,06055,0.0262 +2041,06075,0.0522 +2041,06081,0.0526 +2041,06085,0.0352 +2041,06095,0.0268 +2041,06097,0.0334 +2042,06001,0.0408 +2042,06013,0.0304 +2042,06041,-0.0016 +2042,06055,0.0262 +2042,06075,0.0522 +2042,06081,0.0526 +2042,06085,0.0352 +2042,06095,0.0268 +2042,06097,0.0334 +2043,06001,0.0408 +2043,06013,0.0304 +2043,06041,-0.0016 +2043,06055,0.0262 +2043,06075,0.0522 +2043,06081,0.0526 +2043,06085,0.0352 +2043,06095,0.0268 +2043,06097,0.0334 +2044,06001,0.0408 +2044,06013,0.0304 +2044,06041,-0.0016 +2044,06055,0.0262 +2044,06075,0.0522 +2044,06081,0.0526 +2044,06085,0.0352 +2044,06095,0.0268 +2044,06097,0.0334 +2045,06001,0.0408 +2045,06013,0.0304 +2045,06041,-0.0016 +2045,06055,0.0262 +2045,06075,0.0522 +2045,06081,0.0526 +2045,06085,0.0352 +2045,06095,0.0268 +2045,06097,0.0334 +2046,06001,0.0408 +2046,06013,0.0304 +2046,06041,-0.0016 +2046,06055,0.0262 +2046,06075,0.0522 +2046,06081,0.0526 +2046,06085,0.0352 +2046,06095,0.0268 +2046,06097,0.0334 +2047,06001,0.0408 +2047,06013,0.0304 +2047,06041,-0.0016 +2047,06055,0.0262 +2047,06075,0.0522 +2047,06081,0.0526 +2047,06085,0.0352 +2047,06095,0.0268 +2047,06097,0.0334 +2048,06001,0.0408 +2048,06013,0.0304 +2048,06041,-0.0016 +2048,06055,0.0262 +2048,06075,0.0522 +2048,06081,0.0526 +2048,06085,0.0352 +2048,06095,0.0268 +2048,06097,0.0334 +2049,06001,0.0408 +2049,06013,0.0304 +2049,06041,-0.0016 +2049,06055,0.0262 +2049,06075,0.0522 +2049,06081,0.0526 +2049,06085,0.0352 +2049,06095,0.0268 +2049,06097,0.0334 +2050,06001,0.0408 +2050,06013,0.0304 +2050,06041,-0.0016 +2050,06055,0.0262 +2050,06075,0.0522 +2050,06081,0.0526 +2050,06085,0.0352 +2050,06095,0.0268 +2050,06097,0.0334 \ No newline at end of file From 76a0c4b61a16e7ab3a243bda1c2184f2506d73b2 Mon Sep 17 00:00:00 2001 From: bouzaghrane Date: Sun, 4 Dec 2022 19:45:21 +0000 Subject: [PATCH 5/7] add data paths for workforce calibration data --- demos_urbansim/datasources.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/demos_urbansim/datasources.py b/demos_urbansim/datasources.py index 1e8aded..db5afba 100644 --- a/demos_urbansim/datasources.py +++ b/demos_urbansim/datasources.py @@ -113,6 +113,14 @@ observed_marrital_data = pd.read_csv(observed_marrital_data_name) orca.add_table("observed_marrital_data", observed_marrital_data) +observed_entering_workforce_data_name = "outputs/calibration/%s/entering_workforce_obs.csv" % region_code +observed_entering_workforce_data = pd.read_csv(observed_entering_workforce_data_name) +orca.add_table("observed_entering_workforce", observed_entering_workforce_data) + +observed_exiting_workforce_data_name = "outputs/calibration/%s/exiting_workforce_obs.csv" % region_code +observed_exiting_workforce_data = pd.read_csv(observed_exiting_workforce_data_name) +orca.add_table("observed_exiting_workforce", observed_exiting_workforce_data) + # observed_enrollment_data_name = "outputs/calibration/%s/enrollment_over_time_obs.csv" % region_code # observed_enrollment_data = pd.read_csv(observed_enrollment_data_name) # orca.add_table("observed_enrollment_data", observed_enrollment_data) From cf4e1ee5f79f25df4881c232773901b075f87b50 Mon Sep 17 00:00:00 2001 From: bouzaghrane Date: Sun, 4 Dec 2022 19:45:43 +0000 Subject: [PATCH 6/7] remove maxpid and maxhhid as injectable --- demos_urbansim/datasources.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/demos_urbansim/datasources.py b/demos_urbansim/datasources.py index db5afba..54d1072 100644 --- a/demos_urbansim/datasources.py +++ b/demos_urbansim/datasources.py @@ -447,14 +447,16 @@ def year(): "hhmovein_over_time", "student_population", "marrital", + "exiting_workforce", + "entering_workforce" ] for table in demos_tables: orca.add_table(table, pd.DataFrame()) -orca.add_injectable("max_p_id", orca.get_table("persons").local.index.max()) -orca.add_injectable("max_hh_id", orca.get_table("households").local.index.max()) +# orca.add_injectable("max_p_id", orca.get_table("persons").local.index.max()) +# orca.add_injectable("max_hh_id", orca.get_table("households").local.index.max()) orca.add_injectable("persons_local_cols", orca.get_table("persons").local.columns) orca.add_injectable("households_local_cols", orca.get_table("households").local.columns) From 2f96621ace0af6dda5450ad3272b7533f5ab474f Mon Sep 17 00:00:00 2001 From: bouzaghrane Date: Sun, 4 Dec 2022 19:55:38 +0000 Subject: [PATCH 7/7] labor models --- demos_urbansim/models.py | 494 +++++++++++++++++++++++---------------- 1 file changed, 294 insertions(+), 200 deletions(-) diff --git a/demos_urbansim/models.py b/demos_urbansim/models.py index 9fc0d58..7f2d5cc 100644 --- a/demos_urbansim/models.py +++ b/demos_urbansim/models.py @@ -146,6 +146,9 @@ def household_stats(persons, households): """ print("HH Size from Persons: ", orca.get_table("persons").local["household_id"].unique().shape[0]) print("HH Size from Household: ", orca.get_table("households").local.index.unique().shape[0]) + print("HH in HH_DF not in P_DF:", len(sorted(set(orca.get_table("households").local.index.unique()) - set(orca.get_table("persons").local["household_id"].unique())))) + print("HH in P_DF not in HH_DF:", len(sorted(set(orca.get_table("persons").local["household_id"].unique()) - set(orca.get_table("households").local.index.unique())))) + print("HHs with NA persons:", orca.get_table("households").local["persons"].isna().sum()) print("HH duplicates: ", orca.get_table("households").local.index.has_duplicates) # print("Counties: ", households["lcm_county_id"].unique()) print("Persons Size: ", orca.get_table("persons").local.index.unique().shape[0]) @@ -173,32 +176,26 @@ def fatality_model(persons, households, year): # fatality_list = mortality.choices.astype(int) # print(fatality_list.sum(), " fatalities") - if year <= 2019: - mortality.run() - fatality_list = mortality.choices.astype(int) - # print(fatality_list.sum(), " fatalities") - predicted_share = fatality_list.sum() / persons_df.shape[0] - observed_fatalities = orca.get_table("observed_fatalities_data").to_frame() - target = observed_fatalities[observed_fatalities["year"]==year]["count"] - target_share = target / persons_df.shape[0] - - error = np.sqrt(np.mean((fatality_list.sum() - target)**2)) - # print("here") - while error >= 1000: - # print("here") - mortality.fitted_parameters[0] += np.log(target.sum()/fatality_list.sum()) - # breakpoint() - mortality.run() - fatality_list = mortality.choices.astype(int) - # print(fatality_list.sum()) - predicted_share = fatality_list.sum() / persons_df.shape[0] - error = np.sqrt(np.mean((fatality_list.sum() - target)**2)) - # print(error) - else: - # Running fatality Model - mortality = mm.get_step("mortality") - mortality.run() - fatality_list = mortality.choices.astype(int) + # mortality.run() + # fatality_list = mortality.choices.astype(int) + # # print(fatality_list.sum(), " fatalities") + # predicted_share = fatality_list.sum() / persons_df.shape[0] + # observed_fatalities = orca.get_table("observed_fatalities_data").to_frame() + # target = observed_fatalities[observed_fatalities["year"]==year]["count"] + # target_share = target / persons_df.shape[0] + + # error = np.sqrt(np.mean((fatality_list.sum() - target)**2)) + # # print("here") + # while error >= 1000: + # # print("here") + # mortality.fitted_parameters[0] += np.log(target.sum()/fatality_list.sum()) + # # breakpoint() + # mortality.run() + # fatality_list = mortality.choices.astype(int) + # # print(fatality_list.sum()) + # predicted_share = fatality_list.sum() / persons_df.shape[0] + # error = np.sqrt(np.mean((fatality_list.sum() - target)**2)) + # # print(error) print(fatality_list.sum(), " fatalities") @@ -495,9 +492,19 @@ def remove_dead_persons(persons, households, fatality_list, year): orca.add_table("persons", alive[persons_columns]) orca.add_table("households", houses[households_columns]) orca.add_table("graveyard", dead_people[persons_columns]) - orca.add_injectable( - "max_p_id", orca.get_injectable("max_p_id"), alive["household_id"].max() - ) + # orca.add_injectable( + # "max_p_id", orca.get_injectable("max_p_id"), alive["household_id"].max() + # ) + metadata = orca.get_table("metadata").to_frame() + max_hh_id = metadata.loc["max_hh_id", "value"] + max_p_id = metadata.loc["max_p_id", "value"] + persons_df = orca.get_table("persons").local + households_df = orca.get_table("households").local + if households_df.index.max() > max_hh_id: + metadata.loc["max_hh_id", "value"] = households_df.index.max() + if persons_df.index.max() > max_p_id: + metadata.loc["max_p_id", "value"] = persons_df.index.max() + orca.add_table("metadata", metadata) # print("DONE updating persons.") @@ -770,97 +777,149 @@ def education_model(persons, year): update_education_status(persons, student_list, year) -# @orca.step("laborforce_model") -# def laborforce_model(persons, year): -# """ -# Run the education model and update the persons table - -# Args: -# persons (DataFrameWrapper): DataFrameWrapper of the persons table - -# Returns: -# None -# """ -# # Add temporary variable -# persons_df = persons.local - -# # Run the education model -# # print("Running the deucation model...") -# in_workforce_model = mm.get_step("entering_workforce") -# in_workforce_model.run() -# in_workforce_persons = in_workforce_model.choices.astype(int) -# out_workforce_model = mm.get_step("leaving_workforce") -# out_workforce_model.run() -# out_workforce_persons = in_workforce_model.choices.astype(int) -# # Update student status -# # print("Updating student status...") -# update_education_status(persons, -# in_workforce_persons, -# out_workforce_persons, -# year) - - -# def update_education_status(persons, in_workforce_persons, out_workforce_persons, year): -# """ -# Function to update the worker status in persons table based -# on the labor participation model - -# Args: -# persons (DataFrameWrapper): DataFrameWrapper of the persons table -# student_list (pd.Series): Pandas Series containing the output of -# the education model - -# Returns: -# None -# """ -# # Pull Data -# persons_df = persons.to_frame( -# columns=["household_id", "worker"] -# ) -# persons_df["exit_workforce"] = out_workforce_persons -# # persons_df["exit_workforce"].fillna(2, inplace=True) - -# persons_df["enter_workforce"] = in_workforce_persons -# # persons_df["enter_workforce"].fillna(2, inplace=True) - -# # Update education levels -# persons_df["worker"] = np.where(persons_df["exit_workforce"]==1, 0, persons_df["worker"]) -# persons_df["worker"] = np.where(persons_df["enter_workforce"]==1, 1, persons_df["worker"]) - -# # TODO: Similarly, do something for work from home - -# orca.get_table("persons").update_col("worker", persons_df["worker"]) - -# # compute mean age of students -# # print("Updating students metrics...") +@orca.step("laborforce_model") +def laborforce_model(persons, year): + """ + Run the education model and update the persons table + + Args: + persons (DataFrameWrapper): DataFrameWrapper of the persons table + + Returns: + None + """ + # Add temporary variable + persons_df = orca.get_table("persons").local + persons_df["stay_out"] = -99 + persons_df["leaving_workforce"] = -99 + orca.add_table("persons", persons_df) + persons_df = orca.get_table("persons").local + # breakpoint() + # Run The In Model + # print("Running the deucation model...") + in_workforce_model = mm.get_step("enter_labor_force") + in_workforce_model.run() + stay_unemployed_list = in_workforce_model.choices.astype(int) + predicted_share = stay_unemployed_list.sum() / stay_unemployed_list.shape[0] + observed_ent_workforce = orca.get_table("observed_entering_workforce").to_frame() + target_share = observed_ent_workforce[observed_ent_workforce["year"]==year]["share"] + target = target_share * stay_unemployed_list.shape[0] + + error = np.sqrt(np.mean((predicted_share.sum() - target_share)**2)) + # print("here") + while error >= 0.01: + # print("here") + in_workforce_model.fitted_parameters[0] += np.log(target.sum()/stay_unemployed_list.sum()) + # breakpoint() + in_workforce_model.run() + stay_unemployed_list = in_workforce_model.choices.astype(int) + # print(birth_list.sum()) + predicted_share = stay_unemployed_list.sum() / stay_unemployed_list.shape[0] + error = np.sqrt(np.mean((predicted_share.sum() - target_share)**2)) + print(error) -# agg_households = persons_df.groupby("household_id").agg( -# sum_workers = ("workers", "sum") -# ) + out_workforce_model = mm.get_step("exit_labor_force") + out_workforce_model.run() + exit_workforce_list = out_workforce_model.choices.astype(int) + predicted_share = exit_workforce_list.sum() / exit_workforce_list.shape[0] + observed_exit_workforce = orca.get_table("observed_exiting_workforce").to_frame() + target_share = observed_exit_workforce[observed_exit_workforce["year"]==year]["share"] + target = target_share * exit_workforce_list.shape[0] + # breakpoint() + error = np.sqrt(np.mean((predicted_share.sum() - target_share)**2)) + # print("here") + while error >= 0.01: + # print("here") + out_workforce_model.fitted_parameters[0] += np.log(target.sum()/exit_workforce_list.sum()) + # breakpoint() + out_workforce_model.run() + exit_workforce_list = out_workforce_model.choices.astype(int) + # print(birth_list.sum()) + predicted_share = exit_workforce_list.sum() / exit_workforce_list.shape[0] + error = np.sqrt(np.mean((predicted_share.sum() - target_share)**2)) + # breakpoint() + print(error) + + # breakpoint() + + # Update labor status + update_labor_status(persons, stay_unemployed_list, exit_workforce_list, year) + + +def update_labor_status(persons, stay_unemployed_list, exit_workforce_list, year): + """ + Function to update the worker status in persons table based + on the labor participation model + + Args: + persons (DataFrameWrapper): DataFrameWrapper of the persons table + student_list (pd.Series): Pandas Series containing the output of + the education model + + Returns: + None + """ + # Pull Data + persons_df = orca.get_table("persons").local + persons_cols = orca.get_injectable("persons_local_cols") + households_df = orca.get_table("households").local + households_cols = orca.get_injectable("households_local_cols") + + persons_df["exit_workforce"] = exit_workforce_list + persons_df["exit_workforce"].fillna(2, inplace=True) + + persons_df["remain_unemployed"] = stay_unemployed_list + persons_df["remain_unemployed"].fillna(2, inplace=True) + + # Update education levels + persons_df["worker"] = np.where(persons_df["exit_workforce"]==1, 0, persons_df["worker"]) + persons_df["worker"] = np.where(persons_df["remain_unemployed"]==0, 1, persons_df["worker"]) + + # TODO: Similarly, do something for work from home + -# agg_households["hh_workers"] = np.where( -# agg_households["workers"] == 0, -# "none", -# np.where(agg_households["workers"] == 1, "one", "two or more")) + agg_households = persons_df.groupby("household_id").agg( + sum_workers = ("worker", "sum") + ) -# # TODO: Make sure that the actual workers don't get restorted due to difference in indexing -# # TODO: Make sure there is a better way to do this -# orca.get_table("households").update_col("workers", agg_households["workers"]) -# orca.get_table("households").update_col("hh_workers", agg_households["hh_workers"]) - -# workers = persons_df[persons_df["student"] == 1] -# workers_over_time = orca.get_table("workers_over_time").to_frame() -# workers_population = orca.get_table("workers_population").to_frame() -# if workers_population.empty: -# workers_population = pd.DataFrame( -# data={"year": [year], "count": [workers.shape[0]]} -# ) -# else: -# workers_population_new = pd.DataFrame( -# data={"year": [year], "count": [workers.shape[0]]} -# ) -# workers_population = pd.concat([workers_population, workers_population_new]) -# orca.add_table("workers_population", workers_population) + agg_households["hh_workers"] = np.where( + agg_households["sum_workers"] == 0, + "none", + np.where(agg_households["sum_workers"] == 1, "one", "two or more")) + + # TODO: Make sure that the actual workers don't get restorted due to difference in indexing + # TODO: Make sure there is a better way to do this + #orca.get_table("households").update_col("workers", agg_households["workers"]) + #orca.get_table("households").update_col("hh_workers", agg_households["hh_workers"]) + households_df.update(agg_households) + + workers = persons_df[persons_df["worker"] == 1] + exiting_workforce_df = orca.get_table("exiting_workforce").to_frame() + entering_workforce_df = orca.get_table("entering_workforce").to_frame() + if entering_workforce_df.empty: + entering_workforce_df = pd.DataFrame( + data={"year": [year], "count": [persons_df[persons_df["remain_unemployed"]==0].shape[0]]} + ) + else: + entering_workforce_df_new = pd.DataFrame( + data={"year": [year], "count": [persons_df[persons_df["remain_unemployed"]==0].shape[0]]} + ) + entering_workforce_df = pd.concat([entering_workforce_df, entering_workforce_df_new]) + + if exiting_workforce_df.empty: + exiting_workforce_df = pd.DataFrame( + data={"year": [year], "count": [persons_df[persons_df["exit_workforce"]==1].shape[0]]} + ) + else: + exiting_workforce_df_new = pd.DataFrame( + data={"year": [year], "count": [persons_df[persons_df["exit_workforce"]==1].shape[0]]} + ) + exiting_workforce_df = pd.concat([exiting_workforce_df, exiting_workforce_df_new]) + + orca.add_table("entering_workforce", entering_workforce_df) + orca.add_table("exiting_workforce", exiting_workforce_df) + orca.add_table("persons", persons_df[persons_cols]) + orca.add_table("households", households_df[households_cols]) @orca.step("birth_model") @@ -932,30 +991,26 @@ def birth_model(persons, households, year): # target = observed_births[observed_births["year"]==year]["count"] # target_share = target / eligible_hh_df.shape[0] - if year <= 2019: - birth.run() - birth_list = birth.choices.astype(int) - predicted_share = birth_list.sum() / eligible_hh_df.shape[0] - observed_births = orca.get_table("observed_births_data").to_frame() - target = observed_births[observed_births["year"]==year]["count"] - target_share = target / eligible_hh_df.shape[0] + birth.run() + birth_list = birth.choices.astype(int) + predicted_share = birth_list.sum() / eligible_hh_df.shape[0] + observed_births = orca.get_table("observed_births_data").to_frame() + target = observed_births[observed_births["year"]==year]["count"] + target_share = target / eligible_hh_df.shape[0] - error = np.sqrt(np.mean((birth_list.sum() - target)**2)) + error = np.sqrt(np.mean((birth_list.sum() - target)**2)) + # print("here") + while error >= 1000: # print("here") - while error >= 1000: - # print("here") - birth.fitted_parameters[0] += np.log(target.sum()/birth_list.sum()) - # breakpoint() - birth.run() - birth_list = birth.choices.astype(int) - # print(birth_list.sum()) - predicted_share = birth_list.sum() / eligible_hh_df.shape[0] - error = np.sqrt(np.mean((birth_list.sum() - target)**2)) - # print(error) - else: - # Running fatality Model + birth.fitted_parameters[0] += np.log(target.sum()/birth_list.sum()) + # breakpoint() birth.run() birth_list = birth.choices.astype(int) + # print(birth_list.sum()) + predicted_share = birth_list.sum() / eligible_hh_df.shape[0] + error = np.sqrt(np.mean((birth_list.sum() - target)**2)) + # print(error) + # print(birth_list.sum(), " births") @@ -1009,7 +1064,11 @@ def update_birth(persons, households, birth_list): grave = orca.get_table("pop_over_time").to_frame() # If not empty, update the highest index with max index of all people - highest_index = max(orca.get_injectable("max_p_id"), highest_index) + metadata = orca.get_table("metadata").to_frame() + + max_p_id = metadata.loc["max_p_id", "value"] + + highest_index = max(max_p_id, highest_index) if not grave.empty: graveyard = orca.get_table("graveyard") @@ -1154,7 +1213,9 @@ def update_households_after_kids(persons, households, kids_moving): persons_df["moveoutkid"] = kids_moving highest_index = households_df.index.max() - current_max_household_id = max(orca.get_injectable("max_hh_id"), highest_index) + metadata = orca.get_table("metadata").to_frame() + max_hh_id = metadata.loc["max_hh_id", "value"] + current_max_household_id = max(max_hh_id, highest_index) kids_leaving = persons_df[persons_df["moveoutkid"] == 1]["household_id"].unique() single_per_household = ( @@ -1389,9 +1450,9 @@ def update_households_after_kids(persons, households, kids_moving): # add to orca orca.add_table("households", households_df[households_local_cols]) orca.add_table("persons", persons_df[persons_local_cols]) - orca.add_injectable( - "max_hh_id", max(households_df.index.max(), orca.get_injectable("max_hh_id")) - ) + # orca.add_injectable( + # "max_hh_id", max(households_df.index.max(), orca.get_injectable("max_hh_id")) + # ) metadata = orca.get_table("metadata").to_frame() max_hh_id = metadata.loc["max_hh_id", "value"] @@ -1656,7 +1717,9 @@ def relate(size, marriage=True): # print('Finished Pairing') # print("Updating households and persons table") # print(final.household_id.unique().shape[0]) - current_max_id = max(orca.get_injectable("max_hh_id"), household_df.index.max()) + metadata = orca.get_table("metadata").to_frame() + max_hh_id = metadata.loc["max_hh_id", "value"] + current_max_id = max(max_hh_id, household_df.index.max()) final["hh_new_id"] = np.where(final["stay"].isin([1]), final["household_id"], np.where(final["stay"].isin([0]),final["partner_house"],final["new_household_id"] + current_max_id + 1)) # final["new_relate"] = relate(final.shape[0]) @@ -1819,12 +1882,27 @@ def relate(size, marriage=True): # household_df = pd.concat([household_df, new_households]) # breakpoint() + print("HH Size from Persons: ", p_df["household_id"].unique().shape[0]) + print("HH Size from Household: ", household_df.index.unique().shape[0]) + print("HH in HH_DF not in P_DF:", len(sorted(set(household_df.index.unique()) - set(p_df["household_id"].unique())))) + print("HH in P_DF not in HH_DF:", len(sorted(set(p_df["household_id"].unique()) - set(household_df.index.unique())))) + print("HHs with NA persons:", household_df["persons"].isna().sum()) + print("HH duplicates: ", household_df.index.has_duplicates) + # print("Counties: ", households["lcm_county_id"].unique()) + print("Persons Size: ", p_df.index.unique().shape[0]) + print("Persons Duplicated: ", p_df.index.has_duplicates) + + if len(sorted(set(household_df.index.unique()) - set(p_df["household_id"].unique()))) > 0: + breakpoint() + if len(sorted(set(p_df["household_id"].unique()) - set(household_df.index.unique()))) > 0: + breakpoint() + # print('Time to run marriage', sp.duration) orca.add_table("households", household_df[household_cols]) orca.add_table("persons", p_df[persons_cols]) - orca.add_injectable( - "max_hh_id", max(orca.get_injectable("max_hh_id"), household_df.index.max()) - ) + # orca.add_injectable( + # "max_hh_id", max(orca.get_injectable("max_hh_id"), household_df.index.max()) + # ) # print("households size", household_df.shape[0]) metadata = orca.get_table("metadata").to_frame() @@ -2050,7 +2128,9 @@ def first(size): # print("Finished Pairing") # print("Updating households and persons table") # print(final.household_id.unique().shape[0]) - current_max_id = max(orca.get_injectable("max_hh_id"), household_df.index.max()) + metadata = orca.get_table("metadata").to_frame() + max_hh_id = metadata.loc["max_hh_id", "value"] + current_max_id = max(max_hh_id, household_df.index.max()) final["hh_new_id"] = np.where( final["stay"].isin([1]), @@ -2252,9 +2332,9 @@ def first(size): # print('Time to run marriage', sp.duration) orca.add_table("households", household_df[household_cols]) orca.add_table("persons", p_df[persons_cols]) - orca.add_injectable( - "max_hh_id", max(orca.get_injectable("max_hh_id"), household_df.index.max()) - ) + # orca.add_injectable( + # "max_hh_id", max(orca.get_injectable("max_hh_id"), household_df.index.max()) + # ) # print("households size", household_df.shape[0]) @@ -2375,10 +2455,12 @@ def update_cohabitating_households(persons, households, cohabitate_list): households_df.update(households_new) + metadata = orca.get_table("metadata").to_frame() + max_hh_id = metadata.loc["max_hh_id", "value"] # Create household characteristics for new households formed leaving_house["household_id"] = ( np.arange(len(breakup_hh)) - + max(orca.get_injectable("max_hh_id"), households_df.index.max()) + + max(max_hh_id, households_df.index.max()) + 1 ) leaving_house["person"] = 1 @@ -2474,12 +2556,27 @@ def update_cohabitating_households(persons, households, cohabitate_list): persons_df = pd.concat([persons_df, leaving_house]) + print("HH Size from Persons: ", persons_df["household_id"].unique().shape[0]) + print("HH Size from Household: ", households_df.index.unique().shape[0]) + print("HH in HH_DF not in P_DF:", len(sorted(set(households_df.index.unique()) - set(persons_df["household_id"].unique())))) + print("HH in P_DF not in HH_DF:", len(sorted(set(persons_df["household_id"].unique()) - set(households_df.index.unique())))) + print("HHs with NA persons:", households_df["persons"].isna().sum()) + print("HH duplicates: ", households_df.index.has_duplicates) + # print("Counties: ", households["lcm_county_id"].unique()) + print("Persons Size: ", persons_df.index.unique().shape[0]) + print("Persons Duplicated: ", persons_df.index.has_duplicates) + + if len(sorted(set(households_df.index.unique()) - set(persons_df["household_id"].unique()))) > 0: + breakpoint() + if len(sorted(set(persons_df["household_id"].unique()) - set(households_df.index.unique()))) > 0: + breakpoint() + # add to orca orca.add_table("households", households_df[households_local_cols]) orca.add_table("persons", persons_df[persons_local_cols]) - orca.add_injectable( - "max_hh_id", max(orca.get_injectable("max_hh_id"), households_df.index.max()) - ) + # orca.add_injectable( + # "max_hh_id", max(orca.get_injectable("max_hh_id"), households_df.index.max()) + # ) metadata = orca.get_table("metadata").to_frame() max_hh_id = metadata.loc["max_hh_id", "value"] max_p_id = metadata.loc["max_p_id", "value"] @@ -2565,7 +2662,8 @@ def update_divorce(persons, households, divorce_list): ~persons_divorce.index.isin(leaving_house.index) ].copy() - max_hh_id = orca.get_injectable('max_hh_id') + metadata = orca.get_table("metadata").to_frame() + max_hh_id = metadata.loc["max_hh_id", "value"] # give the people leaving a new household id, update their marriage status, and other variables leaving_house["relate"] = 0 leaving_house["MAR"] = 3 @@ -2811,9 +2909,9 @@ def update_divorce(persons, households, divorce_list): # add to orca orca.add_table("households", new_households[households_local_cols]) orca.add_table("persons", persons_df[persons_local_cols]) - orca.add_injectable( - "max_hh_id", max(orca.get_injectable("max_hh_id"), new_households.index.max()) - ) + # orca.add_injectable( + # "max_hh_id", max(orca.get_injectable("max_hh_id"), new_households.index.max()) + # ) metadata = orca.get_table("metadata").to_frame() max_hh_id = metadata.loc["max_hh_id", "value"] @@ -2963,38 +3061,33 @@ def households_reorg(persons, households, year): divorce_model.filters = "index in " + list_ids divorce_model.out_filters = "index in " + list_ids - if year <= 2019: - divorce_model.run() - divorce_list = divorce_model.choices.astype(int) - print("Number of divorces:") - print(divorce_list.value_counts()) - # breakpoint() - predicted_num = (2*divorce_list.sum() + (persons_df[persons_df["age"]>=15]["MAR"]==3).sum()) - predicted_share = predicted_num / persons_df.shape[0] - - observed_marrital = orca.get_table("observed_marrital_data").to_frame() - target = observed_marrital[(observed_marrital["year"]==year) & (observed_marrital["MAR"]==3)]["count"] - target_share = target.sum() / persons_df.shape[0] - - error = np.sqrt(np.mean((predicted_share - target_share)**2)) - print(error) - # print("here") - while error >= 0.02: - # print("here") - divorce_model.fitted_parameters[0] += np.log(target.sum()/predicted_num) - # breakpoint() - divorce_model.run() - divorce_list = divorce_model.choices.astype(int) - # print(fatality_list.sum()) - predicted_num = (2*divorce_list.sum() + (persons_df[persons_df["age"]>=15]["MAR"]==3).sum()) - # print(predicted_num.sum()) - predicted_share = predicted_num / persons_df.shape[0] - error = np.sqrt(np.mean((predicted_share - target_share)**2)) - print(error) - else: - # Running fatality Model - divorce_model.run() - divorce_list = divorce_model.choices.astype(int) + divorce_model.run() + divorce_list = divorce_model.choices.astype(int) + # print("Number of divorces:") + # print(divorce_list.value_counts()) + # # breakpoint() + # predicted_num = (2*divorce_list.sum() + (persons_df[persons_df["age"]>=15]["MAR"]==3).sum()) + # predicted_share = predicted_num / persons_df.shape[0] + + # observed_marrital = orca.get_table("observed_marrital_data").to_frame() + # target = observed_marrital[(observed_marrital["year"]==year) & (observed_marrital["MAR"]==3)]["count"] + # target_share = target.sum() / persons_df.shape[0] + + # error = np.sqrt(np.mean((predicted_share - target_share)**2)) + # print(error) + # # print("here") + # while error >= 0.02: + # # print("here") + # divorce_model.fitted_parameters[0] += np.log(target.sum()/predicted_num) + # # breakpoint() + # divorce_model.run() + # divorce_list = divorce_model.choices.astype(int) + # # print(fatality_list.sum()) + # predicted_num = (2*divorce_list.sum() + (persons_df[persons_df["age"]>=15]["MAR"]==3).sum()) + # # print(predicted_num.sum()) + # predicted_share = predicted_num / persons_df.shape[0] + # error = np.sqrt(np.mean((predicted_share - target_share)**2)) + # print(error) ######################################### @@ -3103,21 +3196,21 @@ def household_transition(households, persons, year, metadata): if control_totals[control_totals.index == year].hh_type.min() == -1: control_totals = control_totals[['total_number_of_households']] full_transition(households, control_totals, 'total_number_of_households', year, 'block_id', linked_tables=linked_tables) - households = orca.get_table('households').local - households.loc[households['block_id'] == "-1", 'lcm_county_id'] = "-1" - households.index.rename('household_id', inplace=True) + households_df = orca.get_table('households').local + households_df.loc[households_df['block_id'] == "-1", 'lcm_county_id'] = "-1" + households_df.index.rename('household_id', inplace=True) persons_df = orca.get_table('persons').local # persons = persons.loc[persons['household_id'].isin(households.index.unique())] - orca.add_table('households', households) + orca.add_table('households', households_df) orca.add_table('persons', persons_df) - orca.add_injectable( - 'max_hh_id', max(orca.get_injectable('max_hh_id'), households.index.max()) - ) + # orca.add_injectable( + # 'max_hh_id', max(orca.get_injectable("max_hh_id"), households.index.max()) + # ) metadata_df = orca.get_table('metadata').to_frame() max_hh_id = metadata_df.loc['max_hh_id', 'value'] max_p_id = metadata_df.loc['max_p_id', 'value'] - if households.index.max() > max_hh_id: - metadata_df.loc['max_hh_id', 'value'] = households.index.max() + if households_df.index.max() > max_hh_id: + metadata_df.loc['max_hh_id', 'value'] = households_df.index.max() if persons_df.index.max() > max_p_id: metadata_df.loc['max_p_id', 'value'] = persons_df.index.max() orca.add_table('metadata', metadata_df) @@ -3947,6 +4040,7 @@ def generate_metrics(year, persons, households): demo_models = [ "update_age", "household_stats", + "laborforce_model", "households_reorg", "household_stats", "kids_moving_model", @@ -3958,7 +4052,7 @@ def generate_metrics(year, persons, households): "education_model", "household_stats", # "generate_metrics", - # "export_demo_stats", + "export_demo_stats", ] pre_processing_steps = price_models + ["build_networks", "generate_outputs"] rem_variables = ["remove_temp_variables"]