60 period OLG, too few equations problem


I am starting to run a 60-period 0LG model with endogenous working hours and bequests. The code was running correctly until I made working hours (n) endogenous, and I get the error: ERROR: There are 165 equations but 205 endogenous variables!

However, given that I have written all cohorts’ euler equations, budget constraints and included equations for wage, interest rate, aggregate capital and labour supply and bequests I am unsure what else to add.

Pensions are modelled such that they are a fraction of the agents last wage when employed. Also, since agents die stochastically till certain death at age 60, they discount the future by the probability of surviving next period, and each cohort is of a different size, depending on how many agents are alive. Agents work for the first 40 period and retire for the next 20. I hope this will help make the code understandable.

I have attached the mod file.defined_benefit_work.mod (24.8 KB)

Thank you in advance for any help!


There are now 40 equations missing. That indicates it has to do with the periods the agents are working. When you moved to endogenous labor supply, you added variables and equations. You need to check whether you added as many variables as equations.

1 Like