Hi, I am working on a problem for class. My original problem was that I could not get my residuals to 0, and I am not sure how to get there. I added the ‘inv’ variable to the model and it got rid of the other residuals, made them zero, but mc is now negative infinity. I am very unfamiliar with how dynare and how everything works, with the model balancing and getting the residuals to 0, so all help is welcome. The parameters given at the beginning are from the assignment.
Here are my code blocks:
// Dynare Mod File
// Oliver Meihls
// 2024
// Dynare Model File for Business Cycle Analysis
// Declare endogenous variables
var c k y inv L N NE z phi_e mc w;
// Declare exogenous shocks
varexo epsilon_z epsilon_phi_e;
// Parameters
parameters alpha beta delta epsilon eta sigma phi_e_bar z_bar rho_z rho_e kappa;
// Assign parameter values
alpha = 0.32;
beta = 0.985;
delta = 0.025;
epsilon = 4;
eta = 0.7519;
sigma = 2;
phi_e_bar = 0.5;
z_bar = 1;
rho_z = 0.95;
rho_e = 0.95;
kappa = 0.7519;
// Model Equations
model;
// 1. Resource Constraint
y = c + inv + phi_e * NE;
// 2. Capital Accumulation
k = (1 - delta) * k(-1) + inv;
// 3. Euler Equation for Capital
c^(-sigma) = beta * (c(+1)^(-sigma)) * (1 + alpha * y(+1) / k(+1) - delta);
// 4. Labor-Leisure Condition
w = (1 - alpha) * y / L;
// 5. Firm Entry Condition
// phi_e = beta * phi_e(+1) + (1 - delta) * phi_e;
phi_e = rho_e * phi_e(-1) + epsilon_phi_e;
// 6. Marginal Cost and Production Function Relationship
mc = y / (z * L^(1 - alpha) * k^alpha);
// 7. New Firm Creation Dynamics
N = (1 - delta) * N(-1) + (phi_e * NE);
// 8. TFP Shock Process (no change)
z = rho_z * z(-1) + epsilon_z;
// 9. New Firm Creation Rule
NE = z * (N - N(-1)) + epsilon_phi_e;
// 10. Investment
inv = k - ((1 - delta) * k);
// 7. Labor Supply (Labor-Leisure Trade-off)
w = kappa * L^(1/eta) * c^(-sigma);
end;
// Initial Steady-State Values
initval;
// Capital guess
k = 6.9655;
// Steady-state labor
L = 0.33;
// TFP normalized to 1
z = 1;
// Firm entry cost at steady state
phi_e = .48;
// Output from production function
y = z * L^(1 - alpha) * k^alpha;
// Investment from capital accumulation
inv = delta * k;
// Consumption from resource constraint
c = y - inv - phi_e * NE;
// Firms in steady state
N = NE / delta;
// New entrants
// NE = delta * N
NE = (1/phi_e) * (delta * N);
// Real wage based on MPL
w = (1 - alpha) * y / L;
// Marginal cost in steady state (normalized)
mc = 1;
epsilon_z = 0;
epsilon_phi_e = 0;
end;
// Solve for steady state
resid(1); // This does not work and gives me an error saying, '....expecting NON_ZERO'
steady;
// Shock Processes and IRFs
//shocks;
// var epsilon_z; stderr 0.01;
// var epsilon_phi_e; stderr 0.01;
//end;
shocks;
// var epsilon_z; stderr 0.01;
// var epsilon_phi_e; stderr 0.01;
var epsilon_z; stderr sigma_z;
var epsilon_phi_e; stderr sigma_e;
end;
// Stochastic simulations
stoch_simul(order=1, irf=30, hp_filter=1600, periods=2100);
MC residuals are ‘-Inf’. Residuals before adding the ‘inv’ equation into the models section were:
Residuals of the static equations:
Equation number 1: y : 0.000000
Equation number 2: k : 0.000000
Equation number 3: 3 : 0.000000
Equation number 4: 4 : 0.000000
Equation number 5: phi_e : -0.460800
Equation number 6: 6 : 0.000000
Equation number 7: mc : 0.000000
Equation number 8: N : 0.000000
Equation number 9: z : 0.050000
Equation number 10: 10 : 0.004873
Equation number 11: NE : 0.000000
All help is welcome! I think this is steady-state but honestly I’m not 100% sure so the flair is hopefully correct.
Thanks!