New to Dynare and finding Steady state

Hello everyone,

I’m completely new to Dynare and want to create a simple RBC model.

I’ve encountered errors related to maximum cardinality matching and am unsure how to fix this.
Can anyone take a quick look at the code?
Thanks a lot

var
C // Consumption
B // Bonds
Y // Income
R // Interest rate
Lambda // Lagrangian (Shadow cost of consumption)
a // Variable Endogenous variable representing productivity
I // Investment 
K // Capital
Y_f // GDP
; 

varexo epsilon; 

parameters
beta // time preference
y0 // exogenous steady-state level of income
b0 // initial level of bonds
rho // persistence of the productivity shock
sigma // size of shock
alpha // capital share in output
delta // depreciation rate
l // labor 
;

// Assign values to the parameters 
beta = 0.99;
y0 = 1;
b0 = 0;
rho = 0.95; // Persistence of the AR(1) shock
sigma = -1;  // Standard deviation of the shock
alpha = 0.36;
delta = 0.1;
l = 1;

model;
    1/C = Lambda; // First-order condition for consumption
    Lambda = beta * R * Lambda(+1); // Euler for Household
    Y + R(-1) * B(-1) = C + B;
    Y = y0 *(a);
    B = b0;
    log(a) = rho * log(a(-1)) + sigma * epsilon;
    Y_f = K^alpha * l^(1-alpha);
    I = K - (1 - delta) * K(+1); 
    1 = beta * alpha * (Y_f(+1)/K(+1)) + beta * (1 - delta); // Euler for Firm

  
end;

steady_state_model;
    Y = y0;
    B = b0;
    R = 1 / beta;
    C = Y + R * B - B;
    Lambda = 1 / C;
    a = 1;  // This would mean a = 0, as log(1) is = 0
    K = (alpha * y0) / (R + delta);
    Y_f = K * (1 - beta*(1 - delta)) / (beta * alpha);
    I = delta * (K /l); 
    
end;

shocks;
    var epsilon; stderr .1;  // Define the standard deviation of the shock
end;

steady;
resid;
check;

You can ignore the message about the cardinality matching. The bigger issue is that nothing in your modeling strategy makes sure that

is indeed the steady state. Also, the timing in

is wrong.

Thank you for your reply, Professor.

I changed the timing in for the Capital AF but am unsure what to do with y0 and b0, as it worked in a previous model, where I was only looking at the household’s perspective. My previous model focused solely on the household’s perspective, but now that I am incorporating the firm with Y_l ​ and I, how can I modify my modelling strategy?

I apologise for the simple questions.

This is my current code:

var C B Y R Lambda a I K Y_f;

varexo epsilon;

parameters beta y0 b0 rho sigma alpha delta l;

beta = 0.99;
y0 = 1;
b0 = 0;
rho = 0.95;
sigma = 0.1;
alpha = 0.36;
delta = 0.1;
l = 1;

model;
    1/C = Lambda;
    Lambda = beta * R * Lambda(+1);
    Y + R(-1) * B(-1) = C + B;
    Y = y0 * a;
    B = b0;
    log(a) = rho * log(a(-1)) + sigma * epsilon;
    K = (1 - delta) * K(-1)
 + I;
    Y_f = K^alpha * l^(1 - alpha);
    I = K - (1 - delta) * K(-1);
end;

steady_state_model;
    Y = y0;
    B = b0;
    R = 1 / beta;
    C = Y + R * B - B;
    Lambda = 1 / C;
    a = 1;
    K = (alpha * y0) / (R + delta);
    Y_f = K^alpha * l^(1 - alpha);
    I = delta * (K / l);
end;

shocks;
    var epsilon; stderr 0.1;
end;

steady;
resid;
check;

You cannot fix output given that capital is an endogenous choice. But you should be able to solve for the steady state of capital and then of output.