Created
February 1, 2024 16:01
-
-
Save sbenthall/efc4e2610b2a2fe6590d12abf49b78b4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--------------------------------------------------------------------------- | |
IndexError Traceback (most recent call last) | |
Input In [39], in <cell line: 1>() | |
----> 1 compute_target_wealth() | |
Input In [38], in compute_target_wealth(CRRA, DiscFac, RiskyAvg, RiskyStd, PermShkStd, PermGroFac, UnempPrb) | |
22 agent = SequentialPortfolioConsumerType(**agent_parameters) | |
23 pprint(agent.parameters) | |
---> 24 agent.solve() | |
26 ## subjective return | |
27 srle1 = price_dividend_ratio_random_walk(DiscFac, CRRA) | |
File ~/projects/ufm/SHARKFin/sharkfin-env/lib/python3.10/site-packages/HARK/core.py:287, in AgentType.solve(self, verbose) | |
283 with np.errstate( | |
284 divide="ignore", over="ignore", under="ignore", invalid="ignore" | |
285 ): | |
286 self.pre_solve() # Do pre-solution stuff | |
--> 287 self.solution = solve_agent( | |
288 self, verbose | |
289 ) # Solve the model by backward induction | |
290 self.post_solve() | |
File ~/projects/ufm/SHARKFin/sharkfin-env/lib/python3.10/site-packages/HARK/core.py:895, in solve_agent(agent, verbose) | |
892 t_last = time() | |
893 while go: | |
894 # Solve a cycle of the model, recording it if horizon is finite | |
--> 895 solution_cycle = solve_one_cycle(agent, solution_last) | |
896 if not infinite_horizon: | |
897 solution = solution_cycle + solution | |
File ~/projects/ufm/SHARKFin/sharkfin-env/lib/python3.10/site-packages/HARK/core.py:1019, in solve_one_cycle(agent, solution_last) | |
1016 temp_dict = {name: solve_dict[name] for name in these_args} | |
1018 # Solve one period, add it to the solution, and move to the next period | |
-> 1019 solution_t = solve_one_period(**temp_dict) | |
1020 solution_cycle.insert(0, solution_t) | |
1021 solution_next = solution_t | |
File ~/projects/ufm/SHARKFin/sharkfin-env/lib/python3.10/site-packages/HARK/core.py:1047, in make_one_period_oo_solver.<locals>.one_period_solver(**kwds) | |
1044 if hasattr(solver, "prepare_to_solve"): | |
1045 solver.prepare_to_solve() | |
-> 1047 solution_now = solver.solve() | |
1048 return solution_now | |
File ~/projects/ufm/SHARKFin/sharkfin-env/lib/python3.10/site-packages/HARK/ConsumptionSaving/ConsPortfolioModel.py:1252, in ConsSequentialPortfolioSolver.solve(self) | |
1251 def solve(self): | |
-> 1252 solution = ConsPortfolioSolver.solve(self) | |
1254 solution = self.add_SequentialShareFuncAdj(solution) | |
1256 return solution | |
File ~/projects/ufm/SHARKFin/sharkfin-env/lib/python3.10/site-packages/HARK/ConsumptionSaving/ConsPortfolioModel.py:913, in ConsPortfolioSolver.solve(self) | |
910 self.calc_EndOfPrdvP() | |
912 # Construct a basic solution for this period | |
--> 913 self.optimize_share() | |
914 self.make_basic_solution() | |
915 self.make_ShareFuncAdj() | |
File ~/projects/ufm/SHARKFin/sharkfin-env/lib/python3.10/site-packages/HARK/ConsumptionSaving/ConsPortfolioModel.py:681, in ConsPortfolioSolver.optimize_share(self) | |
679 for j in range(self.aNrmCount): | |
680 if not (constrained_top[j] or constrained_bot[j]): | |
--> 681 idx = np.argwhere(crossing[j, :])[0][0] | |
682 bot_s = self.ShareGrid[idx] | |
683 top_s = self.ShareGrid[idx + 1] | |
IndexError: index 0 is out of bounds for axis 0 with size 0 | |
| |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment