If anyone knows how to help, me and my friends are writing a code, and I keep getting this error and it doesn’t run, very new to dynare and I don`t know how to fix. If someone could help me out please do. Thank you very much for your time.
dynare RBC_carbon.mod
Starting Dynare (version 5.4).
Calling Dynare with arguments: none
Starting preprocessing of the model file …
ERROR: RBC_carbon.mod: line 77, cols 1-6: syntax error, unexpected NAME
Error using dynare
Dynare: preprocessing failed
Without the file it is impossible to tell. But it may be a missing semicolon at the end of the previous line.
Here`s the full code professor. We are currently struggling with making omega1 between 0.05 and 1, I was hoping to find out how it can be done. Thank you so much for your time! If I need to send the file itself I can do that also.
%% RBC model - All
%% By Ghassane Benmir, October 2023
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% First declare all the endogenous variables:
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
var
c % Consumption
l % Labour
g % Government Spending
t % Taxes/Transfers
w % Wages
y % Output
rF % Risk free rate
b % Bonds supply
lambda % The lagrangian with respect to consumption and savings (bonds) - also represents the marginal utility of consumption
e_a % The shock variable within the law of motion to output
em % Emissions
miu % Abatement
ctax % Carbon tax
;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Second declare all the exogenous variables:
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
varexo
eta_a % The exogenous output shock
;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Third declare all the parameters :
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
parameters
beta
alpha
delta
chi
phi
l0
y0
b0
g0
sdev_a
sig_a
rho_a
sdev_g
sig_g
rho_g
sdev_b
sig_b
rho_b
phi_em
omega1
omega2
;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Third (bis) calibration for all the params
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
beta = 0.9959; % Time preference
alpha = 1/3; % Share of capital income
chi = 12; % Level of disutility (we calibrate it such that we have l=1/3 at the Steady state)
phi = 1; % Frisch elasticity of labour disutility
l0 = 1/3; % Hours worked (1/3 of 24h a day)
y0 = 1; % Exogenous Income or GDP
b0 = 0; % Fixed supply of bonds (Net-zero supply)
g0 = .3; % Gog spending as % of GDP (30% here)
sdev_a = .01; % Standard deviation of the exogenous shock to income
rho_a = .9; % The shock persistence level
sig_a = 1; % The signe of the shock (1 if positive, -1 is negative)
phi_em = 0.3; % emission intensity
omega1 = 0.1; % abatement cost parameter 1
omega2 = 2.7; % abatement cost parameter 2
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Fourth delcare your model (i.e. the FOCs and Equations of the model)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
model;
%%%% Households Side %%%%
[name='FOC w.r.t to b: Euler Equation']
lambda = rF(+1)*beta*lambda(+1);
[name='FOC w.r.t to c: Marginal Utility of Consumption']
c = 1/lambda;
[name='FOC w.r.t to l: Disutility of labour']
w = chi*l^phi/lambda;
[name='Consumer Budget Constraint']
b = rF(-1)*b(-1) + w(-1)*l(-1) - t(-1) - c(-1);
% y = c + i + g ; % (this is the same equation)
%%%% Firms Side %%%%
[name='Emission abatement']
em = (1-miu)*phi*y;
[name='FOC w.r.t l']
w = (1-alpha)*e_a*l^(-alpha);
[name='FOC w.r.t miu']
phi_em = -(omega1*omega2*(miu^(omega2-1)));
[name='FOC w.r.t em']
ctax = 1;
%%%% Government Spending %%%%
[name='Gov Spending']
g = g0*y;
[name='Gov Budget Constraint']
g = t ;
%%%% Market Clearing conditions (to close the model)
[name='Supply of bonds']
b = b0 ;
%%%% Exogenous shock law of motion %%%%
[name='Law of motion of the output shock']
log(e_a) = rho_a*log(e_a(-1)) +sig_a*eta_a;
end;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Fifth delcare your steady state
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
steady_state_model;
e_a = 1 ;
%% Analytically without a solver (uncomment all the lines but comment the solver line)
% l = l0 ;
% b = b0 ;
% rF = 1/beta;
% rK = 1/beta - (1-delta) ;
% k_y = alpha/rK ;
% y = (e_a*k_y^(alpha)*l^(1-alpha))^(1/(1-alpha)) ;
% w = (1-alpha)*y/l ;
% k = alpha*y/rK ;
% i = delta*k;
% g = g0*y;
% t = g ;
% c = y - i - g ;
% lambda = 1/c ;
% q = lambda ;
% chi = w*lambda/l^phi ; % % This to make sure l = 1/3 at the steady state
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Sixth conduct all the checks (Residual, Blanchard-Khan ...)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
steady; % Provides you with the steady states values
resid(1); % Allow you to check if you computed correctly the steady states equations
check; % Checks the Blanchard Khan conditions to see if the model is well set
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Seventh declare the shocks
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
shocks;
var eta_a; stderr sdev_a ;
end;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Eight performe the simulation
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
stoch_simul (order=1, pruning, irf=30) c t y l lambda rF em miu ctax w ;
Could it be that you are missing some operators like * in your equations? For instance in your first equation there are obviously some *'s missing but also in your Emission abatement equation. Carefully check all of your equations.
You are missing the end
of the steady_state_model
-block. If you fix that, will get various problems. Foremost is the wrong number of equations.
rbc_test.mod (5.1 KB)