//--------------------------------------------------------------------// // Ramsey.ox // Nov 99 (PJW) // // Ox version of the steady state Ramsey model. Requires the // Newton's Method solution algorithm in newton.ox. // // \$Id: ramsey.ox 1.2 1999/11/15 17:29:56 wilcoxen Exp \$ //--------------------------------------------------------------------// #include #include "newton.ox" // Parameters and exogenous variables decl rho = 0.05 ; // time preference rate decl delta = 0.10 ; // depreciation rate decl a = 0.5 ; // technology parameter: q = k^a - b decl b = 0.222222 ; // tax on production: q = k^a - b // Endogenous variables decl q; // gross output decl k; // capital stock decl i; // investment decl c; // consumption decl xlbl={ "Q", "K", "I", "C" }; //--------------------------------------------------------------------// // f() // // Evalue the model for a given guess of the endogenous variables // in vector "guess" and return a vector of miss distances. Will // be called by the newton algorithm. //--------------------------------------------------------------------// f(guess) { decl miss; miss = ones(4,1); // initialize the result vector // Map the guess vector into the model's variables q = guess[0]; k = guess[1]; i = guess[2]; c = guess[3]; // Evaluate the equations miss[0] = q - k^a + b ; // q = k^a - b miss[1] = q - c - i ; // q = c + i miss[2] = i - delta*k ; // i = delta*k miss[3] = a*k^(a-1) - rho - delta ; // a*k^(a-1) = rho + delta return(miss); } //--------------------------------------------------------------------// // printResults() // // Print out results nicely, including labels and a column of // percentage changes from the base case. //--------------------------------------------------------------------// printResults(x,basex) { decl column_formats = {"%7.3f","%8.2f %%"}; decl pct; pct = 100*(x-basex)./basex; print("%r", xlbl, "%cf", column_formats, x ~ pct ); } //--------------------------------------------------------------------// // main() // // The main program that sets up the model and runs experiments //--------------------------------------------------------------------// main() { decl x, basex; x = ones(4,1); // initial guess of the endogenous variables println( "\nSteady State Ramsey Model" ); println( "-------------------------" ); //----- Experiment 1: Solve for the base case. println( "\nSimulation 1: Base Case\n" ); x = solveNewton(f,x); printResults(x,x); basex = x; // save the base case solution for use later. //----- Experiment 2: A 100% increase in b println( "\nSimulation 2: Doubling B\n" ); b = b*2; x = solveNewton(f,x); printResults(x,basex); b = b/2; }