Open AntonSteino opened 1 year ago
Does the simulated permanent income look like expected?
Den 17. feb. 2023 kl. 16.11 skrev AntonSteino @.***>:
Hi, I've looked at the lecture 2 notebook, playing around to introduce a handheld "retirement" period by giving G a time subscript. This results in a strange overconsumption pattern in the last period pre retirement. I don't know whether it's an economic or a coding issue, can anyone figure it out?
I've changed the .py file such that G becomes a vector:
I've changed the notebook for the simulation such that there is a drop in income and no drift from period 16:
This leads to increasing savings until period 14. In period 15 everyone increases their consumption (sim.C), and household consumption jumps with on average 0.386 ( compared to an average increase of 0.014 between period 13 and 14).
It seems like all households are positively surprised, which cannot be the case.Here are the average consumption and permanent income figures over the life cycle:
— Reply to this email directly, view it on GitHubhttps://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FThomasHJorgensen%2FHouseholdBehaviorCourse%2Fissues%2F1&data=05%7C01%7Cthomas.h.jorgensen%40econ.ku.dk%7C40bfa1718b2842fafc8c08db10f93834%7Ca3927f91cda14696af898c9f1ceffa91%7C0%7C0%7C638122434795560631%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=qo6YHSuwAYFsUR62FvjbVZJX2eXkR4kf4gPyRx%2Fk8Xw%3D&reserved=0, or unsubscribehttps://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAAUTBVZRT2EJIK43XBQW6CTWX6IJJANCNFSM6AAAAAAU7RJOAI&data=05%7C01%7Cthomas.h.jorgensen%40econ.ku.dk%7C40bfa1718b2842fafc8c08db10f93834%7Ca3927f91cda14696af898c9f1ceffa91%7C0%7C0%7C638122434795560631%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=PeEwdiMCZhTwh86uzfzrAO9eAD9IFmBwoGnTtokvGG8%3D&reserved=0. You are receiving this because you are subscribed to this thread.Message ID: @.***>
Yes, both permanent income and asset accumulation look like expected. But there is a strange jump in cash-on-hand. In period 15 average M is much higher than average (1+r)*A+Y, which is why I suspect there is a code error somewhere.
Okay, so I've found some bits of the code in the .py file that seem to be wrong.
In the simulation part, lines 185-6, all time subscripts are 't', although from the equations on the slides, it should have been 't+1' for sim.psi and sim.m. This means that sim.m will be too high in period 15, because the 'fac' will be too small. However, if you try to run the corrected code you get an error, as there is no values for 't = 20'. You could probably shorten the simulation period to par.T-1, but this is more cumbersome than one would think, so I haven't worked that out in full.
Also, line 197 should be 'sim.C = sim.csim.P' and not 'sim.C = sim.Csim.P'.
Thank you very much.
Have look now. I have updated the simulation to be in levels. It should be easy for you to modify the growth rate.
Thomas
Thomas Jørgensen Associate Professor
University of Copenhagen Department of Economics
DIR +45 42764004 www.tjeconomics.comhttp://www.tjeconomics.com/
[Logo for Københavns Universitet]
How we protect personal datahttps://informationssikkerhed.ku.dk/english/protection-of-information-privacy/privacy-policy/
From: AntonSteino @.> Sent: 21. februar 2023 20:50 To: ThomasHJorgensen/HouseholdBehaviorCourse @.> Cc: Thomas Høgholm Jørgensen @.>; Comment @.> Subject: Re: [ThomasHJorgensen/HouseholdBehaviorCourse] Strange behaviour when changing par.G (lecture 2) (Issue #1)
Okay, so I've found some bits of the code in the .py file that seem to be wrong.
In the simulation part, lines 185-6, all time subscripts are 't', although from the equations on the slides, it should have been 't+1' for sim.psi and sim.m. This means that sim.m will be too high in period 15, because the 'fac' will be too small. However, if you try to run the corrected code you get an error, as there is no values for 't = 20'. You could probably shorten the simulation period to par.T-1, but this is more cumbersome than one would think, so I haven't worked that out in full.
Also, line 197 should be 'sim.C = sim.csim.P' and not 'sim.C = sim.Csim.P'.
— Reply to this email directly, view it on GitHubhttps://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FThomasHJorgensen%2FHouseholdBehaviorCourse%2Fissues%2F1%23issuecomment-1439010486&data=05%7C01%7Cthomas.h.jorgensen%40econ.ku.dk%7C94069db4a6d147d5429f08db1444df90%7Ca3927f91cda14696af898c9f1ceffa91%7C0%7C0%7C638126058260811759%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=D1E6kiBRPAu5w7WfKgWEZtrIECOd5nfkPz%2BGMSRRK8w%3D&reserved=0, or unsubscribehttps://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAAUTBV4PNIOK5ZMSC2ESQZ3WYUL77ANCNFSM6AAAAAAU7RJOAI&data=05%7C01%7Cthomas.h.jorgensen%40econ.ku.dk%7C94069db4a6d147d5429f08db1444df90%7Ca3927f91cda14696af898c9f1ceffa91%7C0%7C0%7C638126058260811759%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=ezsw0lrYk5IwqsV%2ByIvU6OhgWIPvbnQGw0mI5B35YUM%3D&reserved=0. You are receiving this because you commented.Message ID: @.***>
Hi, I've looked at the lecture 2 notebook, playing around to introduce a handheld "retirement" period by giving G a time subscript. This results in a strange overconsumption pattern in the last period pre retirement. I don't know whether it's an economic or a coding issue, can anyone figure it out?
I've changed the .py file such that G becomes a vector:
I've changed the notebook for the simulation such that there is a drop in income and no drift from period 16:
This leads to increasing savings until period 14. In period 15 everyone increases their consumption (sim.C), and household consumption jumps with on average 0.386 ( compared to an average increase of 0.014 between period 13 and 14).
It seems like all households are positively surprised, which cannot be the case.Here are the average consumption and permanent income figures over the life cycle: