# NK Model - 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

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

% Simulation

stoch_simul(order=1, irf=40);
``````

Please provide the full error message. On my machine, I get

``````Error using print_info (line 32)
Blanchard & Kahn conditions are not satisfied: indeterminacy.``````

Dear jpfeifer, thank you for the quick reply.

Here is the command and the error message:

dynare RANK_durable_dynare

Configuring Dynare …
[mex] Generalized QZ.
[mex] Sylvester equation solution.
[mex] Kronecker products.
[mex] Sparse kronecker products.
[mex] Local state space iteration (second order).
[mex] Bytecode evaluation.
[mex] k-order perturbation solver.
[mex] k-order solution simulation.
[mex] Quasi Monte-Carlo sequence (Sobol).
[mex] Markov Switching SBVAR.

Using 64-bit preprocessor
Starting Dynare (version 4.5.7).
Starting preprocessing of the model file …
Found 16 equation(s).
Evaluating expressions…done
Computing static model derivatives:

• order 1
Computing dynamic model derivatives:
• order 1
Processing outputs …
done
Preprocessing completed.

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.

Error in dyn_first_order_solver (line 213)
E(row_indx_de_1,index_e1) = -aa(row_indx,index_e);

Error in stochastic_solvers (line 267)

Error in resol (line 144)
[dr,info] = stochastic_solvers(dr,check_flag,M,options,oo);

Error in check (line 73)
[dr,info,M,options,oo] = resol(1,M,options,oo);

Error in RANK_durable_dynare (line 219)
oo_.dr.eigval = check(M_,options_,oo_);

Error in dynare (line 235)
evalin(‘base’,fname) ;

I see. The problem is

``````MODEL_DIAGNOSTICS: The following endogenous variables aren't present at the current period in the model:
b
``````

Dear jpfeifer, sorry for the late reply. I wish you a Merry Christmas. Thank you so much for your support.

I have modified the code, adding the correct time indicators next to variables v, q, b and k.

Now, the model is running! For the sake of clarity, I attach the complete code at the end of this message.

I have one final question. Dynare is telling me the following:

MODEL SUMMARY

Number of variables: 17
Number of stochastic shocks: 1
Number of state variables: 3
Number of jumpers: 5
Number of static variables: 9

What variables are, respectively, state, jumpers and static? My guesses are as follows.

Are they correct?

STATE VARIABLES: k, b and r_star;
JUMPERS: c, p, d, q, v
STATIC VARIABLES: r, n, nc, w, y, xs, xd, omega, z

Thank you,
Paolo

MODEL

% endogenous variables
var c k xd z b omega n nc w d y xs r q v p r_star;

% exogenous variables
varexo shock_r_star;

% parameters
parameters p_beta p_phi p_taus p_varphi p_eps p_psi p_pbar p_alpha p_delta sigma_star rho;

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=1;
rho=0.9;

% model

model;

(1-p_alpha)/c = p_beta*(((v(+1)+d(+1))/v)(1-p_alpha)/c(+1)); % FOC omega
q
(1-p_alpha)/c = p_beta*((1-p_alpha)/c(+1)q(+1)(1-p_delta) + p_alpha/k); % Euler equation for K
(1-p_alpha)/c = p_beta*( ( (1+r)/(1+p(+1)) ) * (1-p_alpha)/c(+1) ); % FOC zs(+1)
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 - wn - (p_psi/2)p^2y - 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
omega= 1; % Shares mkt equilibrium
n= nc; % Labor mkt equilibrium
k= 1; % fixed stock of real estate
b= z(-1); % Dynamics of liquidity
k= (1-p_delta)k(-1) + xs; % Dynamics of real estate
z= 0; %Null constraint on liquidity
1 + r = p_beta^(-1)
(((1+p)/(1+p_pbar))^p_varphi)exp(r_star); % Mon Pol rule
r_star = rho
r_star(-1) + shock_r_star;

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;
r = 1/9;
q = (3
5^(1/2)39^(1/2))/10;
v = (17
5^(1/2)*39^(1/2))/100;
p = 0;
r_star = 0;

end;

% Checking that the Blanchard - Kahn conditions are fulfilled

check;

% Specifying the variance of the shocks

shocks;

var shock_r_star = sigma_star^2;

end;

% Let Dynare compute the steady state