$TITLE Ramsey Model: Primal NLP Formulation SET T /1*50/ SET TFIRST(T), TLAST(T); TFIRST(T) = YES$(ORD(T) EQ 1); TLAST(T) = YES$(ORD(T) EQ CARD(T)); SCALAR G Growth rate /0.02/ R Interest rate /0.05/ K0 Capital-output ratio /3.00/ DELTA Depreciation rate /0.07/ KVS Base year capital value share; PARAMETER QREF(T) Reference quantity path PREF(T) Reference price path; QREF(T) = (1+G)**(ORD(T)-1); PREF(T) = (1/(1+R))**(ORD(T)-1); KVS = K0 * (DELTA + R); PARAMETER ALPHA; ALPHA(T) = ((1+G)/(1+R))**(ORD(T)-1); ALPHA(TLAST) = ALPHA(TLAST) / (1-(1+G)/(1+R)); POSITIVE VARIABLES K(T) Capital stock C(T) Consumption I(T) Investment; VARIABLES UTILITY Utility function; EQUATIONS CC(T) Capacity constraint, KK(T) Capital balance, TC(T) Terminal condition (provides for post-terminal growth), UTIL Discounted log of consumption: objective function; CC(T).. (K(T)/K0)**KVS * QREF(T)**(1-KVS) =E= C(T) + I(T); KK(T+1).. (1-DELTA)*K(T) + I(T) =G= K(T+1); TC(TLAST).. I(TLAST) =G= (G+DELTA)*K(TLAST); UTIL.. UTILITY =E= -SUM(T, ALPHA(T)*LOG(C(T))); MODEL PRIMAL /CC, KK, TC, UTIL/; C.L(T) = = 1 - (DELTA + G) * K0; K.LO(T) = 1E-4; C.LO(T) = 1E-4; I.LO(T) = 1E-4; K.FX(TFIRST) = K0; SOLVE PRIMAL MINIMIZING UTILITY USING NLP; K.FX(TFIRST) = K0*0.80; SOLVE PRIMAL MINIMIZING UTILITY USING NLP; PARAMETER SOLUTION Solution values; SOLUTION(T,"PK") = KK.M(T)/CC.M(T); SOLUTION(TFIRST,"PK") = -K.M(TFIRST)/CC.M(TFIRST); SOLUTION(T,"C") = C.L(T); SOLUTION(T,"I") = I.L(T); SOLUTION(T,"K") = K.L(T); DISPLAY SOLUTION;
$TITLE Ramsey Model: MCP based on KKT conditions for primal model SET T /1*50/ SET TFIRST(T), TLAST(T); TFIRST(T) = YES$(ORD(T) EQ 1); TLAST(T) = YES$(ORD(T) EQ CARD(T)); SCALAR G Growth rate /0.02/ R Interest rate /0.05/ K0 Capital-output ratio /3.00/ DELTA Depreciation rate /0.07/ Kstock Capital index /1.00/ KVS Base year capital value share I0 Base year investment C0 Base year consumption; I0 = (DELTA + G) * K0; C0 = 1 - I0; PARAMETER QREF(T) Reference quantity path PREF(T) Reference price path; QREF(T) = (1+G)**(ORD(T)-1); PREF(T) = (1/(1+R))**(ORD(T)-1); KVS = K0 * (DELTA + R); PARAMETER ALPHA; ALPHA(T) = ((1+G)/(1+R))**(ORD(T)-1); ALPHA(TLAST) = ALPHA(TLAST) / (1-(1+G)/(1+R)); POSITIVE VARIABLES P(T) Price of output, PK(T) Price of capital, RK(T) Price of rental capital, PTC(T) Price of capital in terminal period K(T) Capital stock C(T) Consumption I(T) Investment; EQUATIONS CC(T) Capacity constraint, KK(T) Capital balance, TC(T) Terminal condition (provides for post-terminal growth), OPT_C(T) First order optimality condition for C, OPT_K(T) First order optimality condition for K, OPT_I(T) First order optimality condition for I; CC(T).. (K(T)/K0)**KVS * QREF(T)**(1-KVS) =E= C(T) + I(T); KK(T).. (1-DELTA)*K(T-1) + (K0*KSTOCK)$TFIRST(T) + I(T-1) =G= K(T); TC(TLAST).. I(TLAST) =G= (G+DELTA)*K(TLAST); OPT_C(T).. C(T)*P(T) =E= C0 * ALPHA(T); OPT_K(T).. PK(T) + (PTC(T)*(G+DELTA))$TLAST(T) =E= P(T)*KVS*(K(T)/K0)**KVS * QREF(T)**(1-KVS)/K(T) + PK(T+1)*(1-DELTA); OPT_I(T).. P(T) =E= PK(T+1) + PTC(T)$TLAST(T); MODEL KKT / OPT_C.C, OPT_K.K, OPT_I.I, CC.P, KK.PK, TC.PTC /; * Initialize price levels C.L(T) = C0 * QREF(T); I.L(T) = I0 * QREF(T); K.L(T) = K0 * QREF(T); P.L(T) = PREF(T); PK.L(T) = (1+R) * PREF(T); PTC.L(T) = PREF(T); PK.LO(T) = 1E-6; PK.UP(T) = +INF; SOLVE KKT USING MCP; KSTOCK = 0.8; SOLVE KKT USING MCP;
$TITLE Ramsey Model: MCP based on the MPSGE formulation $if not setglobal termcnd $setglobal termcnd MCP SCALAR NLPTERM /0/, MCPTERM/0/; %termcnd%term = 1; SET T /1*50/ SET TFIRST(T), TLAST(T); TFIRST(T) = YES$(ORD(T) EQ 1); TLAST(T) = YES$(ORD(T) EQ CARD(T)); SCALAR G Growth rate /0.02/ R Interest rate /0.05/ K0 Capital-output ratio /3.00/ DELTA Depreciation rate /0.07/ Kstock Capital index /1.00/ KVS Base year capital value share L0 Base year labor input; L0 = 1 - K0 * (DELTA + R); PARAMETER QREF(T) Reference quantity path PREF(T) Reference price path; QREF(T) = (1+G)**(ORD(T)-1); PREF(T) = (1/(1+R))**(ORD(T)-1); KVS = K0 * (DELTA + R); PARAMETER ALPHA; ALPHA(T) = ((1+G)/(1+R))**(ORD(T)-1); ALPHA(TLAST)$NLPTERM = ALPHA(TLAST) / (1-(1+G)/(1+R)); ALIAS (T,TT); ALPHA(T) = ALPHA(T) / SUM(TT, ALPHA(TT)); POSITIVE VARIABLES Y(T) Output I(T) Investment K(T) Capital stock P(T) Output price RK(T) Return to capital U Utility PU Unit expenditure function PK(T) Capital price PL(T) Wage rate PKT Terminal capital RA Representative agent TK Post-terminal capital stock; EQUATIONS PR_Y(T) Zero profit condition for output, PR_C(T) Zero profit condition for consumption, PR_K(T) Zero profit condition for capital, PR_I(T) Zero profit condition for investment, PR_U Zero profit condition for utility, M_P(T) Market clearing for output, M_PK(T) Market clearing for capital, M_RK(T) Market clearing for rental capital, M_PL(T) Market clearing for labor, M_PU Market clearing for utility, M_PKT Market clearing for terminal investment, I_RA Income balance for representative agent, TERMK Terminal constraint for capital stock; * Zero profit conditions PR_Y(T).. (RK(T)/(R+DELTA))**KVS * PL(T)**(1-KVS) =E= P(T); PR_U.. PROD(T, (P(T)/PREF(T))**ALPHA(T) ) =E= PU; PR_K(T).. PK(T) + ( (PKT*(G+DELTA))$TLAST(T) )$NLPTERM =E= RK(T) + (1-DELTA)*(PK(T+1) + (PKT$TLAST(T))$MCPTERM); PR_I(T).. P(T) =E= PK(T+1) + PKT$TLAST(T); * Market clearing conditions M_P(T).. Y(T) =E= ALPHA(T) * PU * U / P(T) + I(T); M_PU.. U*PU =E= RA; M_PK(T).. K(T) =E= (1-DELTA)*K(T-1) + I(T-1) + (K0*KSTOCK)$TFIRST(T); M_RK(T).. K(T) * (RK(T)/(R+DELTA)) =E= K0 * (RK(T)/(R+DELTA))**KVS * PL(T)**(1-KVS) * Y(T); M_PL(T).. QREF(T) * PL(T) =E= (RK(T)/(R+DELTA))**KVS * PL(T)**(1-KVS) * Y(T); M_PKT.. SUM(TLAST, I(TLAST) - (G+DELTA)*K(TLAST) )$NLPTERM + SUM(TLAST, K(TLAST)*(1-DELTA) + I(TLAST) - TK)$MCPTERM =E= 0; I_RA.. RA =E= SUM(T, PL(T)*L0*QREF(T)) + SUM(TFIRST, PK(TFIRST)*K0*KSTOCK) - (TK * PKT)$MCPTERM; TERMK$MCPTERM.. SUM(T$TLAST(T+1), I(T+1)/I(T) - Y(T+1)/Y(T)) =E= 0; MODEL MCP /PR_Y.Y, PR_U.U, PR_K.K, PR_I.I, M_P.P, M_PU.PU, M_PK.PK, M_RK.RK, M_PL.PL, M_PKT.PKT, I_RA.RA, TERMK.TK/; Y.L(T) = QREF(T); I.L(T) = (DELTA + G) * K0 * QREF(T); K.L(T) = K0 * QREF(T); P.L(T) = PREF(T); RK.L(T) = PREF(T) * (DELTA+R); PK.L(T) = (1+R) * PREF(T); PL.L(T) = PREF(T); PKT.L = SUM(TLAST, PREF(TLAST)); TK.L = K0 * (1+G)**CARD(T); Y.LO(T) = 1.E-5; I.LO(T) = 1.E-5; PU.L = PROD(T, (P.L(T)/PREF(T))**ALPHA(T) ); U.L = ( SUM(T, PL.L(T)*L0*QREF(T)) + SUM(TFIRST, PK.L(TFIRST)*K0*KSTOCK) - TK.L * PKT.L) / PU.L; RA.FX = U.L * PU.L; MCP.ITERLIM = 0; SOLVE MCP USING MCP; KSTOCK = 0.80; MCP.ITERLIM = 2000; SOLVE MCP USING MCP; PARAMETER SOLUTION Solution values; SOLUTION(T,"PK") = PK.L(T)/P.L(T); SOLUTION(T,"C") = ALPHA(T) * PU.L * U.L / P.L(T) ; SOLUTION(T,"I") = I.L(T); SOLUTION(T,"K") = K.L(T); DISPLAY SOLUTION;
$TITLE Ramsey Model: Dual NLP Formulation SET T /1*50/ SET TFIRST(T), TLAST(T); TFIRST(T) = YES$(ORD(T) EQ 1); TLAST(T) = YES$(ORD(T) EQ CARD(T)); SCALAR G Growth rate /0.02/ R Interest rate /0.05/ K0 Capital-output ratio /3.00/ DELTA Depreciation rate /0.07/ Kstock Capital index /1.00/ KVS Base year capital value share; PARAMETER QREF(T) Reference quantity path PREF(T) Reference price path; QREF(T) = (1+G)**(ORD(T)-1); PREF(T) = (1/(1+R))**(ORD(T)-1); KVS = K0 * (DELTA + R); PARAMETER ALPHA; ALPHA(T) = ((1+G)/(1+R))**(ORD(T)-1); ALPHA(TLAST) = ALPHA(TLAST) / (1-(1+G)/(1+R)); VARIABLE OBJ Objective price; POSITIVE VARIABLES P(T) Price of output, PC(T) Consumption price PK(T) Price of capital, RK(T) Price of rental capital, PL(T) Wage rate, PT Price of capital in terminal period; EQUATIONS OBJDEF Objective function, PCDEF(T) Defines PC PRF_Y(T) Zero profit condition for output, PRF_I(T) Zero profit condition for investment, PRF_K(T) Zero profit condition for capital; OBJDEF.. OBJ =E= SUM(T, ALPHA(T)*LOG(PC(T))) - SUM(T, PL(T) * QREF(T)) - SUM(TFIRST, PK(TFIRST)* K0 * KSTOCK); PCDEF(T).. PC(T) =E= P(T) / PREF(T); PRF_Y(T).. (RK(T)/(R+DELTA))**KVS * (PL(T)/(1-KVS))**(1-KVS) =E= P(T); PRF_I(T).. P(T) =E= PK(T+1) + PT$TLAST(T); PRF_K(T).. PK(T) + (PT*(G+DELTA))$TLAST(T) =E= RK(T) + PK(T+1)*(1-DELTA); MODEL DUAL /OBJDEF, PCDEF, PRF_Y, PRF_I, PRF_K /; P.L(T) = PREF(T); PC.L(T) = 1; PK.L(T) = (1+R) * PREF(T); RK.L(T) = PREF(T) * (DELTA+R); PL.L(T) = PREF(T)*(1-KVS); PT.L = SUM(TLAST, PREF(TLAST)); PC.LO(T) = 0.001; P.LO(T) = 1E-6; PK.LO(T) = 1E-6; RK.LO(T) = 1E-6; PL.LO(T) = 1E-6; PT.LO = 1E-6; SOLVE DUAL USING NLP MAXIMIZING OBJ; KSTOCK = 0.80; SOLVE DUAL USING NLP MAXIMIZING OBJ;
$TITLE Ramsey Model -- MPSGE formulation with alternative termination methods $setglobal termcnd MCP SCALAR NLPTERM /0/, MCPTERM/0/; %termcnd%term = 1; SET T /1*50/; SET TFIRST(T) TLAST(T); TFIRST(T) = YES$(ORD(T) EQ 1); TLAST(T) = YES$(ORD(T) EQ CARD(T)); SCALAR G Growth rate /0.02/ R Interest rate /0.05/ K0 Capital-output ratio /3.00/ DELTA Depreciation rate /0.07/ Kstock Capital index /1.00/ RK0 Base year return to capital I0 Base year investment C0 Base year consumption L0 Base year labor input; I0 = (DELTA + G) * K0; C0 = 1 - I0; L0 = 1 - K0 * (DELTA + R); PARAMETER QREF(T) Reference quantity path PREF(T) Reference price path; QREF(T) = (1+G)**(ORD(T)-1); PREF(T) = (1/(1+R))**(ORD(T)-1); PARAMETER ALPHA; ALPHA(T) = ((1+G)/(1+R))**(ORD(T)-1); ALPHA(TLAST) = ALPHA(TLAST) / (1-(1+G)/(1+R)); $ONTEXT $MODEL:RAMSEY $SECTORS: Y(T) ! Output I(T) ! Investment K(T) ! Capital stock $COMMODITIES: P(T) ! Output price RK(T) ! Return to capital PK(T) ! Capital price PL(T) ! Wage rate PKT ! Terminal capital $CONSUMERS: RA ! Representative agent $AUXILIARY: TK$MCPTERM ! Post-terminal capital stock $PROD:Y(T) s:1 O:P(T) Q:1 I:PL(T) Q:L0 I:RK(T) Q:K0 P:(DELTA+R) $PROD:K(T)$MCPTERM O:PK(T+1) Q:(1-DELTA) O:PKT$TLAST(T) Q:(1-DELTA) O:RK(T) Q:1 I:PK(T) Q:1 $PROD:K(T)$NLPTERM O:PK(T+1) Q:(1-DELTA) O:RK(T) Q:1 I:PK(T) Q:1 I:PKT$TLAST(T) Q:(G+DELTA) $PROD:I(T) O:PK(T+1) Q:1 O:PKT$TLAST(T) Q:1 I:P(T) Q:1 $DEMAND:RA s:1 D:P(T)$MCPTERM Q:(QREF(T)*C0) P:PREF(T) D:P(T)$NLPTERM Q:C0 P:ALPHA(T) E:PL(T) Q:(L0*QREF(T)) E:PK(TFIRST) Q:(K0*KSTOCK) E:PKT$MCPTERM Q:-1 R:TK $REPORT: V:C(T) D:P(T) DEMAND:RA $CONSTRAINT:TK$MCPTERM SUM(T$TLAST(T+1), I(T+1)/I(T) - Y(T+1)/Y(T)) =E= 0; $OFFTEXT $SYSINCLUDE mpsgeset RAMSEY Y.L(T) = QREF(T); I.L(T) = I0 * QREF(T); K.L(T) = K0 * QREF(T); P.L(T) = PREF(T); RK.L(T) = PREF(T) * (DELTA+R); PK.L(T) = (1+R) * PREF(T); PL.L(T) = PREF(T); PKT.L = SUM(TLAST, PREF(TLAST)); TK.L = K0 * (1+G)**CARD(T); RAMSEY.ITERLIM = 0; $INCLUDE RAMSEY.GEN SOLVE RAMSEY USING MCP; RAMSEY.ITERLIM = 1000; KSTOCK = 0.80; $INCLUDE RAMSEY.GEN SOLVE RAMSEY USING MCP; PARAMETER SOLUTION Solution values; SOLUTION(T,"PK") = PK.L(T)/P.L(T); SOLUTION(T,"C") = C.L(T); SOLUTION(T,"I") = I.L(T); SOLUTION(T,"K") = K.L(T); DISPLAY SOLUTION;
$TITLE Extending the Ramsey Model: Environmental Taxes and Transition * Default values appear here: $set BETA 1 $set BOPCON no $set PHI 0 $set X0 1 $set XKSHR 0 $set E0 0.05 $set ESUB 0.5 $set ETRNDX 2 $set ESUBDM 2 $set ESUBT 0.5 $set BSINIT 0.10 $set BSGROW 0.10 $set BSCOST 2 $set GR 0.02 $ontext The following code is used for the CGI (Netscape) interface: $LIBINCLUDE CGI INPUT BETA 1 "Forward-looking consumers" 0.5 $LIBINCLUDE CGI INPUT BOPCON no "Balance of payments constraint" yes $LIBINCLUDE CGI INPUT PHI 0 "Adjustment speed parameter" 0.1 0.2 0.3 $LIBINCLUDE CGI INPUT X0 1 "Base year export share" 0.5 $LIBINCLUDE CGI INPUT XKSHR 0 "Extant (clay) capital share" 0.9 0.5 $LIBINCLUDE CGI INPUT E0 0.05 "Base year energy value share" 0.10 $LIBINCLUDE CGI INPUT ESUB 0.5 "Elasticity of energy demand" 0.25 1.0 $LIBINCLUDE CGI INPUT ETRNDX 2 "Elasticity of export supply (D vs X)" 4 $LIBINCLUDE CGI INPUT ESUBDM 2 "Armington elasticity (D vs M)" 4 8 $LIBINCLUDE CGI INPUT ESUBT 0.5 "Intertemporal elasticity of substitution" 1 $LIBINCLUDE CGI INPUT BSINIT 0.10 "Initial backstop supply index" 0.05 0.25 $LIBINCLUDE CGI INPUT BSGROW 0.10 "Upper bound on backstop growth" 0.25 $LIBINCLUDE CGI INPUT BSCOST 2 "Cost of carbon-free energy" 1.5 4 $LIBINCLUDE CGI INPUT GR 0.02 "Base year growth rate" 0.01 0.03 $offtext SET T Time periods /1997*2100/ T2050 /1997*2050/ TL(*) Time periods to be labeled /2000,2010,2020,2030,2040,2050/; PARAMETER YEAR(T); YEAR(T) = 1996 + ORD(T); SCALAR BETA Forward-looking share /%BETA%/, BOPCON Balance of payments constraint BSCOST Cost of carbon-free energy /%BSCOST%/, BSGROW Backstop growth rate (per yr) /%BSGROW%/, BSINIT Initial bound on backstop /%BSINIT%/, DEPR Annual depreciation rate /0.07/ E0 Initial energy input /%E0%/, X0 Initial macro exports /%X0%/, ESUBT Intertemporal elasticity /%ESUBT%/, GR Annual potential growth rate /%GR%/, PHI Adjustment speed /%PHI%/, KSTOCK Initial capital stock / 3/, R Annual net interest rate /0.05/, XKSHR Extant capital share /%XKSHR%/, ETRNDX Elasticity of transformation /%ETRNDX%/, ESUB Elasticity of substitution /%ESUB%/ ESUBDM Elasticity of substitution /%ESUBDM%/ RDCOST Research and development cost /0/ RDIDEA Research and development ideas ; BOPCON = 1$%BOPCON%; ABORT$(BETA EQ 0) "Forward-looking consumer share cannot be zero!", BETA; * Defining options for solvers OPTION MCP=PATH; * Set declarations SETS TFIRST(T) First period TSECOND(T) Second period TLAST(T) Last period TRD(T) Time periods in which R&D can be conducted; * Set definitions: TFIRST(T) = YES$(ORD(T) EQ 1); TSECOND(T) = YES$(ORD(T) EQ 2); TLAST(T) = YES$(ORD(T) EQ CARD(T)); TRD(T) = NO; ALIAS (TT,T); * Defining scalars SCALARS L0 Initial labor, K0 Initial rental capital, J0 Initial net investment, I0 Initial gross investment, C0 Initial consumption, D0 Production for the domestic market, M0 Base year imports A0 Base year Armington supply UBAR Utility in benchmark Y0 Initial GDP, CAPFLO Capital flows (= (NOT BOPCON)) PK0 Reference price for capital, PKA0 Reduced cost of investment, RK0 User cost of capital in benchmark; * Free capital flows? CAPFLO = YES$(NOT BOPCON); *============================================================================ * Calibration *============================================================================ * Normalize output to unity: Y0 = 1; * Domestic output: ABORT$(X0 LT 0 OR X0 GT 1) " Invalide export share: ",X0; X0 = ROUND(X0, 3); D0 = ROUND(1 - X0, 3); * Net investment on the initial steady-state covers growth * plus deprecition: J0 = (DEPR + GR) * KSTOCK; * Gross investment includes the adjustment cost premium: I0 = J0 * (1 + PHI * J0/(2*KSTOCK)); * Aggregate imports (determined by trade balance): M0 = X0 - E0; * Aggregate supply: A0 = D0 + M0; * Consumption equals gross output less gross investment less * energy costs less capital maintenance costs: C0 = A0 - I0; DISPLAY I0, C0; * Price of capital stock is the marginal cost of a unit of * capital plus interest: PK0 = (1 + R) * (1+PHI*(DEPR+GR)); DISPLAY PK0; * Shadow price of adjustment premium for existing capital: PKA0 = PHI*(DEPR+GR)**2/2; * Rental price of capital: RK0 = PK0*(R+DEPR)/(1+R)-PKA0; * Value of base year factor earnings: K0 = RK0*KSTOCK; L0 = Y0 - E0 - RK0 * KSTOCK; display K0, L0, E0; ABORT$(L0<0) "Inconsistent labor calibration!",L0; DISPLAY PK0, PKA0, RK0, K0, L0; * Defining discounting and growth factors PARAMETER PREF(T) Reference price for scaling, QREF(T) Reference quantity CREF(T) Reference consumption path for intertemporal consumer, CARBLIM(T) Carbon target BS0(T) Backstop technology stock KX(T) Extant capital stock KXT Terminal capital stock; * Reference price path is determined by the interest rate: PREF(T) = 1/(1+R)**(ORD(T)-1); * Reference quantity path is determined by the growth rate: QREF(T) = (1+GR)**(ORD(T)-1); * Reference consumption path for the intertemporal consumer: CREF(T) = (C0-(1-BETA)*(L0+K0)) * QREF(T); * No carbon limits or backstop technologies in the reference * equilibrum: CARBLIM(T) = 0; BS0(T) = 0; * Present value of consumption over the model horizon: UBAR = (C0-(1-BETA)*(L0+K0))*SUM(T,QREF(T)*PREF(T)); DISPLAY PREF, QREF, UBAR; * Extant capital depreciates over the model horizon: KX(T) = XKSHR * RK0*KSTOCK * (1-DEPR)**(ORD(T)-1); * Quantity of extant capital in the post-terminal period: LOOP(TLAST(T), KXT = XKSHR * KSTOCK * (1-DEPR)**ORD(T)); *============================================================= * MPSGE Model Specification *============================================================= $ONTEXT $MODEL:DYNAMIC $SECTORS: U ! Utility activity (intertemporal consumer) Y(T) ! Output activity YX(T)$KX(T) ! Output from extant capital M(T)$M0 ! Imports X(T) ! Export J(T) ! Investment activity K(T) ! Capital activity C(T) ! Consumption activity A(T) ! Armington supply ME(T) ! Energy Imports RD(T)$TRD(T) ! Research and development BACKSTOP(T)$CARBLIM(T) ! Backstop energy production $COMMODITIES: PU ! Price of utility PT ! Price of investment in the last period P_RD$RDIDEA ! Price of new ideas PFX(T)$BOPCON ! Price of foreign exchange PVFX$CAPFLO ! Price of foreign exchange (capital flows) PA(T) ! Price of domestic-import composite PD(T)$D0 ! Price of output to the domestic market PM(T)$M0 ! Price of imports PX(T) ! Price of exports PC(T) ! Price of consumption PE(T) ! Price of energy in foreign currency PK(T) ! Price of capital RKX(T)$KX(T) ! Shadow price on extant capital PKA(T)$PHI ! Price of capital RK(T) ! Price of renting capital PL(T) ! Price of labor PBS(T)$CARBLIM(T) ! Shadow price on backstop technology PCARB(T)$CARBLIM(T) ! Price of emission restrictions $CONSUMERS: RA WORKER(T)$(1-BETA) $AUXILIARY: TC ! Terminal capital demand $PROD:M(T)$M0 O:PM(T) Q:M0 I:PFX(T)$BOPCON Q:M0 I:PVFX$CAPFLO Q:(M0*PREF(T)) P:(1/PREF(T)) $PROD:C(T) O:PC(T) Q:C0 I:PA(T) Q:C0 $PROD:U s:esubt O:PU Q:UBAR I:PC(T) Q:CREF(T) P:PREF(T) $PROD:A(T) s:esubdm O:PA(T) Q:A0 I:PM(T) Q:M0 P:PREF(T) I:PD(T) Q:D0 P:PREF(T) $PROD:Y(T) t:etrndx s:esub KL:1 O:PD(T) Q:D0 P:PREF(T) O:PX(T) Q:X0 P:PREF(T) I:PL(T) Q:L0 KL: P:PREF(T) I:RK(T) Q:K0 KL: P:PREF(T) I:PE(T) Q:E0 P:PREF(T) $PROD:X(T) O:PFX(T)$BOPCON Q:X0 O:PVFX$CAPFLO Q:(PREF(T)*X0) I:PX(T) Q:X0 $PROD:YX(T)$KX(T) s:0 O:PD(T) Q:D0 O:PX(T) Q:X0 I:PL(T) Q:L0 I:RKX(T) Q:K0 I:PE(T) Q:E0 $PROD:BACKSTOP(T)$CARBLIM(T) O:PE(T) Q:E0 O:PBS(T+1) Q:(E0*(1+BSGROW)) I:PBS(T) Q:E0 I:PA(T) Q:(BSCOST*E0) $PROD:RD(T)$TRD(T) s:0 O:PBS(T) Q:RDIDEA I:PA(T) Q:(RDCOST*RDIDEA) I:P_RD Q:RDIDEA $PROD:K(T) O:PK(T+1) Q:((1-DEPR)*KSTOCK) O:RK(T) Q:(RK0*KSTOCK) O:PKA(T) Q:(PKA0*KSTOCK) O:PT$TLAST(T) Q:((1-DEPR)*KSTOCK) I:PK(T) Q:KSTOCK $PROD:J(T) s:0 ADJ:1 O:PK(T+1) Q:J0 O:PT$TLAST(T) Q:J0 I:PA(T) Q:J0 I:PKA(T) Q:(J0*PHI*(DEPR+GR)/2) ADJ: I:PA(T) Q:(J0*PHI*(DEPR+GR)/2) ADJ: $PROD:ME(T) O:PE(T) Q:E0 I:PCARB(T)$CARBLIM(T) Q:E0 I:PVFX$CAPFLO Q:(PREF(T)*E0) I:PFX(T)$BOPCON Q:E0 $DEMAND:WORKER(T)$(1-BETA) E:PL(T) Q:((1-BETA)*L0*QREF(T)) E:RK(T) Q:((1-BETA)*K0*QREF(T)) E:PCARB(T) Q:((1-BETA)*CARBLIM(T)) D:PC(T) Q:((1-BETA)*(L0+K0)*QREF(T)) $REPORT: V:WELFARE(T)$(1-BETA) W:WORKER(T) $DEMAND:RA D:PU Q:UBAR E:P_RD Q:RDIDEA E:PCARB(T) Q:(BETA*CARBLIM(T)) E:PL(T) Q:(BETA*L0*QREF(T)) E:RK(T) Q:((BETA-1)*K0*QREF(T)) E:PK(TFIRST) Q:((1-XKSHR)*KSTOCK) E:RKX(T) Q:KX(T) E:PT Q:KXT E:PKA(T) Q:(KX(T)*PKA0/RK0) E:PT Q:(-(J0+(1-DEPR)*KSTOCK)) R:TC $CONSTRAINT:TC SUM(T$TLAST(T+1), J(T+1)/J(T) - Y(T+1)/Y(T)) =E= 0; $OFFTEXT $SYSINCLUDE MPSGESET DYNAMIC *======================================================================== * Setting the level values for activities and prices *======================================================================== * Activities YX.L(T) = XKSHR * (1-DEPR)**(ORD(T)-1); Y.L(T) = QREF(T) - YX.L(T); X.L(T) = QREF(T); M.L(T) = QREF(T); A.L(T) = QREF(T); K.L(T) = QREF(T) - YX.L(T); J.L(T) = QREF(T); C.L(T) = QREF(T); ME.L(T) = QREF(T); U.L = 1; TC.L = SUM(TLAST,QREF(TLAST)); * Prices PA.L(T) = PREF(T); PKA.L(T)= PREF(T)$PHI; PE.L(T) = PREF(T); PVFX.L = 1; PD.L(T) = PREF(T); PM.L(T) = PREF(T); PX.L(T) = PREF(T); PFX.L(T) = PREF(T); PC.L(T) = PREF(T); PK.L(T) = PREF(T)*PK0; RK.L(T) = PREF(T); RKX.L(T) = PREF(T); PL.L(T) = PREF(T); PT.L = SUM(TLAST,PK.L(TLAST)/(1+R)); RA.L = UBAR; BACKSTOP.L(T) = 0; RD.L(T) = 0; P_RD.L = 0; PBS.L(T) = 0; *======================================================================== * Solve: *======================================================================== DISPLAY A0, M0, D0, PA.L, PM.L, PD.L; RDIDEA = 0; DYNAMIC.OPTFILE=1; DYNAMIC.ITERLIM=0; $INCLUDE DYNAMIC.GEN SOLVE DYNAMIC USING MCP RDCOST = 1; RDIDEA = E0*BSINIT; TRD(T) = YES$(YEAR(T) LE 2015); CARBLIM("2000") = E0 / (1+GR)**7; LOOP(T$(YEAR(T) GE 2000), CARBLIM(T+1) = CARBLIM(T) * 0.99;); TRD(T)$(NOT CARBLIM(T)) = NO; * Do a pre-solve with fixed terminal capital: TC.FX = TC.L; DYNAMIC.ITERLIM=1000; $INCLUDE DYNAMIC.GEN SOLVE DYNAMIC USING MCP TC.LO = 0; TC.UP = +INF; $INCLUDE DYNAMIC.GEN SOLVE DYNAMIC USING MCP *======================================================================== * Reporting: *======================================================================== PARAMETER QUANT Quantitative results GRATE Growth rates PRICE Price effects; PARAMETER I(T) Gross investment GDP(T) Gross domestic product TRDBAL Trade balance (X-M in present value) CURACT Current account (X-B-F in present value) PNORM Numeraire price index; PNORM = SUM(TFIRST, PFX.L(TFIRST))$BOPCON + PVFX.L$CAPFLO; TRDBAL(T) = ( X0*X.L(T) - E0*ME.L(T) - M0*M.L(T) ) * ( (PVFX.L*PREF(T))$CAPFLO + PFX.L(T)$BOPCON ) / PC.L(T); TRDBAL("TOTAL") = SUM(T, TRDBAL(T)*PC.L(T)); DISPLAY TRDBAL; CURACT(T) = SUM(TT$(YEAR(TT) LT YEAR(T)), TRDBAL(TT)) * R + TRDBAL(T); I(T) = (J.L(T)*J0*(PK.L(T+1)+PT.L$TLAST(T)) - PKA.L(T)*PKA0*KSTOCK*K.L(T)) / PA.L(T); GDP(T) = (PL.L(T)*L0*QREF(T) + RK.L(T)*K.L(T)*K0 + RKX.L(T)*KX(T))/PC.L(T) + PCARB.L(T)*CARBLIM(T) + (RD.L(T)*P_RD.L*RDIDEA)$TRD(T); GRATE(T,"G_C") = 100 * (C.L(T+1)/C.L(T)-1); GRATE(T,"G_E") = 100 * ( (ME.L(T+1)+BACKSTOP.L(T+1)$CARBLIM(T+1)) / (ME.L(T) +BACKSTOP.L(T)$CARBLIM(T)) - 1); GRATE(T,"G_K") = 100 * ( (K.L(T+1)+KX(T+1)/(RK0*KSTOCK)) / (K.L(T) +KX(T )/(RK0*KSTOCK)) - 1); GRATE(T,"G_Y") = 100 * ( (Y.L(T+1)+YX.L(T+1))/(Y.L(T)+YX.L(T)) - 1); GRATE(T,"G_J")$J.L(T) = 100 * ( J.L(T+1)/J.L(T) - 1); GRATE(TLAST,"G_C") = 0; GRATE(TLAST,"G_E") = 100 * GR; GRATE(TLAST,"G_K") = 100 * GR; GRATE(TLAST,"G_Y") = 100 * GR; GRATE(TLAST,"G_J") = 100 * GR; QUANT(T,"E") = 100*( (ME.L(T)+BACKSTOP.L(T)$CARBLIM(T)) / QREF(T)-1); QUANT(T,"B") = 100 * TRDBAL(T) / GDP(T); QUANT(T,"A") = 100 * CURACT(T) / GDP(T); QUANT(T,"GDP") = 100 * (GDP(T) / (QREF(T)*(C0+I0)) - 1); QUANT(T,"C") = 100*(C.L(T)/QREF(T)-1); QUANT(T,"C_w")$(1-beta) = 100*(WORKER.L(T)/((1-BETA)*(L0+K0)*QREF(T)*PC.L(T))-1); QUANT(T,"C_o")$(1-beta) = 100*((C0*C.L(T)-WORKER.L(T)/PC.L(T))/(QREF(T)*(C0-(1-BETA)*(L0+K0)))-1); QUANT(T,"Y") = 100*((Y.L(T)+YX.L(T))/QREF(T)-1); QUANT(T,"K") = 100*((K.L(T)+KX(T)/(RK0*KSTOCK))/QREF(T)-1); QUANT(T,"J") = 100*(J.L(T)/QREF(T)-1); QUANT(T,"RD") = 100*RD.L(T); QUANT(T,"BS") = 100*BACKSTOP.L(T)/QREF(T); PRICE(T,"PCARB") = (PCARB.L(T)/PC.L(T))$CARBLIM(T); PRICE(T,"R")$PC.L(T+1) = 100*(PC.L(T)/PC.L(T+1)-1); PRICE(T,"PL") = 100*(PL.L(T)/PC.L(T)-1); PRICE(T,"PE") = 100*(PE.L(T)/PC.L(T)-1); PRICE(T,"PBS") = 100*PBS.L(T)/PE.L(T); PRICE(T,"RK") = 100*(RK.L(T)/PC.L(T)-1); PRICE(T,"VK") = 100* ( ( KSTOCK*K.L(T)*PK.L(T) + SUM(TT$(YEAR(TT) GE YEAR(T)), RKX.L(TT)*KX(TT) + PKA.L(TT)*KX(T)*PKA0/RK0 )$XKSHR + (PT.L*KXT)$XKSHR ) / (KSTOCK*QREF(T)*PK0*PC.L(T)) - 1); PRICE(T,"RKX")$KX(T) = 100*(RKX.L(T)/PC.L(T)-1); DISPLAY QUANT, GRATE, PRICE; * Generate reports for the CGI interface: PARAMETER STATUS Solution status WELFAR Welfare indices (pct Hicksian EV) EPRICE Energy price (pct change from BaU) EQUANT Energy quantity (pct change from BaU) CAPSTK Capital Stock (pct change from BaU) OUTPUT Macro output (pct change from BaU) GDPPCT Gross Domestic Product (pct change from BaU) CONSUM Aggregate consumption (pct change from BaU) INVEST Aggregate investment (pct change from BaU) CURACT Current account (pct change from BaU) INTRAT Domestic interest rate (percent); SET STATS /RESUSD, ITERS, MODSTA/; STATUS("RESUSD") = DYNAMIC.RESUSD; STATUS("ITERS") = DYNAMIC.ITERUSD; STATUS("MODSTA") = DYNAMIC.MODELSTAT; SET CONSUMERS(*); CONSUMERS(T) = YES; CONSUMERS("INVESTOR") = YES; WELFAR("Investor") = 100 * (U.L-1); WELFAR(T) = NA$(NOT (1-BETA)) + WELFARE.L(T)$(1-BETA); EPRICE(T) = round(100*(PE.L(T)/PC.L(T)-1), 2); EQUANT(T) = round(100*( (ME.L(T)+BACKSTOP.L(T)$CARBLIM(T)) / QREF(T)-1), 2); CAPSTK(T) = round(100*((K.L(T)+KX(T)/(RK0*KSTOCK))/QREF(T)-1), 2); GDPPCT(T) = round(100 * (GDP(T) / (QREF(T)*(C0+I0)) - 1), 2); OUTPUT(T) = round(100*((Y.L(T)+YX.L(T))/QREF(T)-1), 2); CONSUM(T) = round(100*(C.L(T)/QREF(T)-1), 2); INVEST(T) = round(100*(J.L(T)/QREF(T)-1), 2); CURACT(T) = round(100 * CURACT(T) / GDP(T), 2); INTRAT(T)$PC.L(T+1) = round(100*(PC.L(T)/PC.L(T+1)-1),2); $ontext * Code for the Netscape interface $LIBINCLUDE CGI OUTPUT STATUS STATS $LIBINCLUDE CGI OUTPUT WELFAR CONSUMERS $LIBINCLUDE CGI PLOT EPRICE T2050 TL $LIBINCLUDE CGI PLOT EQUANT T2050 TL $LIBINCLUDE CGI PLOT CAPSTK T2050 TL $LIBINCLUDE CGI PLOT GDPPCT T2050 TL $LIBINCLUDE CGI PLOT OUTPUT T2050 TL $LIBINCLUDE CGI PLOT CONSUM T2050 TL $LIBINCLUDE CGI PLOT INVEST T2050 TL $LIBINCLUDE CGI PLOT CURACT T2050 TL $LIBINCLUDE CGI PLOT INTRAT T2050 TL $offtext DISPLAY EPRICE, EQUANT, CAPSTK, OUTPUT, GDPPCT, CONSUM, INVEST, CURACT, INTRAT; $if not setglobal batch $exit * Code for saving results: FILE KREP / %SC%.REP/; PUT KREP; $SETGLOBAL PREFIX '"%SC%."' $LIBINCLUDE GAMS2TXT QUANT $LIBINCLUDE GAMS2TXT PRICE $LIBINCLUDE GAMS2TXT GRATE