|
28 | 28 |
|
29 | 29 |
|
30 | 30 | def calculate_excluded_from_labour_supply_responses( |
31 | | - sim: Simulation, count_adults: int = 1 |
| 31 | + sim: Simulation, count_adults: int = 2 |
32 | 32 | ): |
33 | 33 | """Calculate which individuals are excluded from labour supply responses. |
34 | 34 |
|
@@ -97,10 +97,10 @@ class LabourSupplyResponseData(BaseModel): |
97 | 97 |
|
98 | 98 | def apply_labour_supply_responses( |
99 | 99 | sim: Simulation, |
100 | | - target_variable: str = "household_net_income", |
| 100 | + target_variable: str = "hbai_household_net_income", |
101 | 101 | input_variable: str = "employment_income", |
102 | 102 | year: int = 2025, |
103 | | - count_adults: int = 1, |
| 103 | + count_adults: int = 2, |
104 | 104 | delta: float = 1_000, |
105 | 105 | ) -> pd.DataFrame: |
106 | 106 | """Apply labour supply responses to simulation and return the response vector. |
@@ -197,10 +197,10 @@ def apply_labour_supply_responses( |
197 | 197 |
|
198 | 198 | def apply_progression_responses( |
199 | 199 | sim: Simulation, |
200 | | - target_variable: str = "household_net_income", |
| 200 | + target_variable: str = "hbai_household_net_income", |
201 | 201 | input_variable: str = "employment_income", |
202 | 202 | year: int = 2025, |
203 | | - count_adults: int = 1, |
| 203 | + count_adults: int = 2, |
204 | 204 | delta: float = 1_000, |
205 | 205 | pre_calculated_income_rel_change: np.ndarray = None, |
206 | 206 | ) -> pd.DataFrame: |
@@ -233,6 +233,7 @@ def apply_progression_responses( |
233 | 233 | derivative_changes = derivative_changes.rename( |
234 | 234 | columns={col: f"deriv_{col}" for col in derivative_changes.columns} |
235 | 235 | ) |
| 236 | + derivative_changes["person_id"] = sim.calculate("person_id", year).values |
236 | 237 |
|
237 | 238 | # Add in actual implied wages |
238 | 239 | gross_wage = sim.calculate("employment_income", year) / sim.calculate( |
@@ -262,20 +263,13 @@ def apply_progression_responses( |
262 | 263 |
|
263 | 264 | # Calculate changes in income levels (drives income effects) |
264 | 265 | if pre_calculated_income_rel_change is not None: |
265 | | - # Use pre-calculated values |
266 | 266 | n_people = len(sim.calculate("person_id", year)) |
267 | 267 | income_changes = pd.DataFrame( |
268 | 268 | { |
269 | | - "baseline": np.zeros( |
270 | | - n_people |
271 | | - ), # Not needed for behavioral response |
272 | | - "scenario": np.zeros( |
273 | | - n_people |
274 | | - ), # Not needed for behavioral response |
| 269 | + "baseline": np.zeros(n_people), |
| 270 | + "scenario": np.zeros(n_people), |
275 | 271 | "rel_change": pre_calculated_income_rel_change, |
276 | | - "abs_change": np.zeros( |
277 | | - n_people |
278 | | - ), # Not needed for behavioral response |
| 272 | + "abs_change": np.zeros(n_people), |
279 | 273 | } |
280 | 274 | ) |
281 | 275 | else: |
|
0 commit comments