Hello.
I'm trying to perform 2 tasks: the first is to loop over a numerical solution for a parameter, and the second is to take the results of the solution and save them into STATA for use as a graph.
My code is as follows:
What I want to do is create is save the output of my program (q_f, p_t. q_a. p_a, and kappa) as an observation in a .dta file, and then to repeat the function for the range of t between 0 and 0.35. How am I to do this, aside from copying x into excel, changing t in my do file, and then rerunning the program?
I'm trying to perform 2 tasks: the first is to loop over a numerical solution for a parameter, and the second is to take the results of the solution and save them into STATA for use as a graph.
My code is as follows:
Code:
local c = 1 local sigma = 2.3 local lambda = .005 local a_f = 1000 local a_a = 1000 local p_x = `sigma'/(`sigma' - 1) * `c' local t_h = .35 local t = .15 clear mata mata /** * values[1] = q_f * values[2] = p_t * values[3] = q_a * values[4] = p_a * values[5] = kappa(t) */ void function ces(real colvector x, real colvector values) { values[1] = x[1] - x[2]^(-`sigma')*`a_f' values[2] = x[2] - ((`p_x' * 1/(1+x[5])) - (`t'/(`lambda'*x[1]))) values[3] = x[3] - (`a_a' * x[4]^(-`sigma')) values[4] = x[4] - `p_x' * 1/(1+x[5]) values[5] = x[5] - (`t'/((1-`t_h')*(`sigma'-1))) * (x[1]/x[3]) } S = solvenl_init() solvenl_init_evaluator(S, &ces()) solvenl_init_type(S,"zero") solvenl_init_technique(S, "newton") solvenl_init_numeq(S, 5) solvenl_init_startingvals(S, J(5,1,50)) solvenl_init_iter_log(S, "on") x = solvenl_solve(S)