Dear all,
I am writing my thesis on a NK model with durables. In what follows, I paste the code for my Dynare model. The model is non-linear. I want to obtain the Impulse Response Functions after a monetary shock i_star with variance (sigma_star)^2=(0.0025^2).
After running the code on MATLAB, I obtain the error message in the title “Unable to perform assignment because the size of the left side is 4-by-3 and the size of the right side is 4-by-4.”.
I am very inexperienced in Dynare. What does this error message mean? How can I solve it?
DYNARE CODE
% endogenous variables
var c k xd z b omega n nc w d y xs i q v p;
% exogenous variables
varexo i_star;
% parameters
parameters p_beta p_phi p_taus p_varphi p_eps p_psi p_pbar p_alpha p_delta sigma_star;
p_beta=0.9;
p_phi=1;
p_taus=0.3;
p_varphi=1.5;
p_eps=1.5;
p_psi=0.5;
p_pbar=0;
p_alpha=0.5;
p_delta=0;
sigma_star=0.0025;
% model
model;
(1-p_alpha)/c = p_beta*(((v+d)/v)*(1-p_alpha)/c(+1)); % FOC omega (shares in firms)
q*(1-p_alpha)/c = p_beta*((1-p_alpha)/c(+1)*q*(1-p_delta) + p_alpha/k(+1)); % Euler equation for K (the durable good)
(1-p_alpha)/c = p_beta*( ( (1+i)/(1+p(+1)) ) * (1-p_alpha)/c(+1) ); % FOC zs(+1) (Euler equation with consumption)
n^p_phi = ((1-p_alpha)/c)*w; % FOC n
p*(1-p) = ((p_eps-1)/p_psi) * ((p_eps/(p_eps-1))*w - (1+p_taus)); % price setting by firms
d = ((1 + p_taus)*y - w*n - (p_psi/2)*p^2*y - p_taus*y); % profit function
y = nc; % Production constraint
(1 - (p_psi/2)*p^2)*y = c; % Goods mkt equilibrium
xs= xd; % Durable goods mkt eq (xs is quantity supplied and xd is quantity demanded)
omega= 1; % Shares mkt equilibrium
n= nc; % Labor mkt equilibrium
k= 1; % fixed stock of real estate (this is an assumption of my model)
b(+1)= z; % Dynamics of liquidity (bonds at the beginning of next period are equal to bonds saved at the end of the preceding period)
k(+1)= (1-p_delta)*k + xs; % Dynamics of real estate (real estate is equal to real estate in the preceding period, less depreciation, which is assumed to be equal to zero and plus the durable goods produced in the period)
z= 0; %Null constraint on liquidity (it is assumed that consumers cannot hold liquidity, but they spend all their holdings on goods)
1 + i = p_beta^(-1)*(((1+p)/(1+p_pbar))^p_varphi)*exp(i_star); % Mon Pol rule (Taylor rule)
end;
% guess for steady state (I computed the values using Matlab and the
% parameter values given above)
initval;
c = (5^(1/2)*39^(1/2))/30;
k = 1;
xd = 0;
z = 0;
b = 0;
omega = 1;
n = (5^(1/2)*39^(1/2))/30;
nc = (5^(1/2)*39^(1/2))/30;
w = 13/30;
d = (17*5^(1/2)*39^(1/2))/900;
y = (5^(1/2)*39^(1/2))/30;
xs = 0;
i = 1/9;
q = (3*5^(1/2)*39^(1/2))/10;
v = (17*5^(1/2)*39^(1/2))/100;
p = 0;
end;
% Checking that the Blanchard - Kahn conditions are fulfilled
check;
% Specifying the variance of the shocks
shocks;
var i_star = sigma_star^2;
end;
% Let Dynare compute the steady state
steady;
% Simulation
stoch_simul(order=1, irf=40);