Hi everyone,
Disclaimer: I have engaged in extensive googling but have not been able to find an answer to this question. Apologies if this has already been answered.
I'm usually around the Stata forum but I'm trying to pick up Mata generally and optimize() in particular.
What I want to accomplish is to reproduce a dynamic optimization problem described in Section 6.1.2 of the Book Adams, Clarke, Quinn (2015) Microeconometrics and MATLAB.
I started with the simpler problem from Section 6.1.1 with linear constraints (flow equations) that has the following strcuture:
However, in a slightly modified version of this issue in Section 6.1.2 the flow constraints becomes(Cobb-Douglas-style) non-linear.
That is, the flow constraints now is: kt+1=f(kt-ct, theta)= theta*(kt-ct)^alpha
I am not able to come up with a solution for this modified flow equation. After a substantial amount of Googling it seems like that Mata cannot handle such constraints. Is this correct?
Thanks for any insight.
Best,
Ulrich
Edit: typo
Disclaimer: I have engaged in extensive googling but have not been able to find an answer to this question. Apologies if this has already been answered.
I'm usually around the Stata forum but I'm trying to pick up Mata generally and optimize() in particular.
What I want to accomplish is to reproduce a dynamic optimization problem described in Section 6.1.2 of the Book Adams, Clarke, Quinn (2015) Microeconometrics and MATLAB.
I started with the simpler problem from Section 6.1.1 with linear constraints (flow equations) that has the following strcuture:
- Household has an endowment of W1 and must decide how much to consume each of T periods (the cake-eating problem).
- The household maximizes discounted utility over those T periods.
- The flow equation for capital is given by: kt+1=kt-ct
- This can be summarized in the following fashion: sum(ct)+kt+1=k1
Code:
// Rewrite optimization problem 6.1.1 Linear Flow Eqns, p.84 from Adams et al (2015) Microeconometrics for Matlab mata mata clear set matastrict off // Define flow utility equation function u(todo, numeric rowvector c, numeric scalar T, numeric scalar beta, u, g, H) { t = 1..T u = beta:^(t:-1) * log(c') } // Set params beta = 0.9 T = 10 k1 = 100 c0 = J(1, T, 10) // Set constraints C = J(1, T, 1) c = k1 // Set up optimization problem s = optimize_init() optimize_init_evaluator(s, &u()) optimize_init_evaluatortype(s,"v0") optimize_init_params(s,c0) optimize_init_argument(s, 1, T) optimize_init_argument(s, 2, beta) optimize_init_constraints(s, (C,c)) c_optim = optimize(s) c_optim sum(c_optim) end
That is, the flow constraints now is: kt+1=f(kt-ct, theta)= theta*(kt-ct)^alpha
I am not able to come up with a solution for this modified flow equation. After a substantial amount of Googling it seems like that Mata cannot handle such constraints. Is this correct?
Thanks for any insight.
Best,
Ulrich
Edit: typo
Comment