Skip to content

Commit

Permalink
track 'who_dies' to t-1 spot in history for HARK 0.13 core; generic m…
Browse files Browse the repository at this point in the history
…onte carlo now matches exact
  • Loading branch information
sbenthall committed Nov 13, 2023
1 parent 799de9a commit 2d212ae
Show file tree
Hide file tree
Showing 3 changed files with 1,418 additions and 212 deletions.
5 changes: 4 additions & 1 deletion HARK/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -1061,7 +1061,10 @@ def simulate(self, sim_periods=None):
elif var_name in self.controls:
self.history[var_name][self.t_sim, :] = self.controls[var_name]
else:
self.history[var_name][self.t_sim, :] = getattr(self, var_name)
if var_name is 'who_dies' and self.t_sim > 1:
self.history[var_name][self.t_sim - 1, :] = getattr(self, var_name)
else:
self.history[var_name][self.t_sim, :] = getattr(self, var_name)
self.t_sim += 1

return self.history
Expand Down
2 changes: 1 addition & 1 deletion HARK/simulation/monte_carlo.py
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,7 @@ def sim_birth(self, which_agents):
None
"""
if self.read_shocks:
t = self.t_sim - 1 if self.t_sim > 0 else 0
t = self.t_sim
initial_vals = {
init_var: self.newborn_init_history[init_var][t, which_agents]
for init_var
Expand Down
Loading

0 comments on commit 2d212ae

Please sign in to comment.