Nonlinear equation solver for neoclassical growth model
1 view (last 30 days)
Show older comments
Hello!
I am trying to replicate a neoclassical growth model by computing the optimal paths of the main variables of the model. As such, I am starting from fixed initial values for capital, consumption, investment, and output (k_path(1), c_path(1), i_path(1), y_path(1)) and have to reach fixed final values for all these variables (k_path(T), c_path(T), i_path(T), y_path(T)). There are 4 equations describing the relationships between these variables:
- Euler equation:
c_path(t) = beta * c_path(t - 1) * ((1 + g)^(-1) * (theta * k_path(t)^(theta - 1) * (gamma * l_path(t))^(1 - theta) + 1 - delta));
- Law of motion for capital:
k_path(t) = (i_path(t - 1) + (1 - delta) * k_path(t - 1)) / ((1 + g) * (1 + n_path(t) / 100));
- Resource constraint:
y_path(t) = c_path(t) + i_path(t);
- Production function:
y_path(t) = k_path(t)^theta * (gamma * l_path(t))^(1-theta);
where l_path and n_path are labour and population growth rate respectively (both of them are exogenous variables), beta is the discount factor, g is the growth rate, theta is the weight for capital in the production function, gamma is a parameter related to labour efficiency, delta is the depreciation rate.
The algorithm for this task should be normally based on a nonlinear equation solver. Do you think that fsolve is the best function to perform this? Or is there a better alternative given the nature of the equations?
9 Comments
Edu Benet Cerda
on 13 Oct 2023
@Sergiu, Thanks for sharing the paper. This seems to be a Ramsey-Cass-Koopmans model. There is a MATLAB tool called dynare that is well suited to solving some of these models. Below you will find an implementation of a very similar model where some of the equations are straight the same or very close.
If you have any issues running it, feel free to reach out directly at ebenetce@mathworks.com
Answers (1)
Torsten
on 13 Oct 2023
Edited: Torsten
on 13 Oct 2023
- Set the right-hand sides of the resource constraint and the production constraint equal and solve for i(t). You will get an equation where i(t) depends on k(t) and c(t) (l(t) is externally given).
- Insert the equation for k(t) (law of motion for capital) in the equation under (1). Now equation (1) for i(t) depends on i(t-1), k(t-1) and c(t) (l(t) and n(t) are externally given).
- The equation for c(t) (Euler equation) depends on c(t-1) and k(t) (l(t) is externally given). For k(t), insert equation (2) (law of motion for capital). Now the equation for c(t) depends on c(t-1),i(t-1),k(t-1) (n(t) and l(t) are externally given).
- Now continue step (2) and in the equation for i(t), insert the equation for c(t) derived under (3). Now i(t) depends on i(t-1), k(t-1) and c(t-1) (l(t) and n(t) are externally given).
- Summarizing: You now have an equation for k(t) that depends on i(t-1) and k(t-1) (n(t) is externally given), you have an equation for c(t) that depends on c(t-1),i(t-1),k(t-1) (n(t) and l(t) are externally given) and you have an equation for i(t) that depends on i(t-1), k(t-1) and c(t-1) (l(t) and n(t) are externally given).
- So specify initial conditions for c, i and k and use the recursions described above.
If you want to start with conditions for the last period and derive the "correct" three initial conditions, define c(0), i(0) and k(0) as unknowns for the nonlinear solver (e.g. "fsolve") and define the residuals as c_pre(T)-c(T), i_pre(T)-i(T), k_pre(T)-k(T) where c_pre(T), i_pre(T) and k_pre(T) are your prescribed values in period T.
This is a highly nonlinear system - I'm not sure "fsolve" will be able to find a solution. It would be better if you found a backwards recursion. Further you should take in mind that only a very limited number of end conditions allow suitable initial conditions, i.e. most of the backwards recursion problems won't have a solution.
0 Comments
See Also
Categories
Find more on Mathematics and Optimization in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!