the preprocessor is giving me an error saying that q is not used in the model block, but it is present in the heterogeneity model block:
// Declare heterogeneity dimension
heterogeneity_dimension households;
// Household-level variables
var(heterogeneity=households)
c (long_name = 'consumption')
a (long_name = 'assets')
;
// Household-level shocks
varexo(heterogeneity=households)
e (long_name = 'idiosyncratic efficiency')
;
// Aggregate variables
var
q (long_name = 'Real bond price')
Z (long_name = 'Aggregate endowment')
;
// Aggregate shocks
varexo
eps_Z (long_name = 'Aggregate endowment shock')
;
// Parameters
parameters
beta (long_name = 'Discount factor')
eis (long_name = 'Elasticity of intertemporal substitution')
rhoZ (long_name = 'Persistence of aggregate endowment shock')
;
eis = 0.5;
beta = 0.99;
rhoZ = 0.95;
verbatim;
initial_guess = struct;
initial_guess.agg.q = 1/beta*1.01;
rho_e = 0.966;
sig_e = 0.5;
[grid_e, ~, Pi_e] = rouwenhorst(rho_e, sig_e, 15, 1e-12, 1e5);
initial_guess.shocks.grids.e = grid_e;
initial_guess.shocks.Pi.e = Pi_e;
grid_a = logspace(log10(0.25), log10(200.25), 30)-0.25-0.25;
initial_guess.pol.grids.a = grid_a;
c = 0.1*(grid_a+grid_e);
a = grid_a+grid_e-c;
initial_guess.pol.values.c = c;
initial_guess.pol.values.a = a;
initial_guess.pol.order = {'e', 'a'};
end;
// Household optimization problem
model(heterogeneity=households);
[name='Euler equation with borrowing constraint']
beta * c(+1)^(-1/eis) - q * c^(-1/eis) = 0 ⟂ a >= -0.25;
[name='Budget constraint']
a(-1) + Z * e - c - q * a = 0;
end;
// Aggregate equilibrium conditions
model;
[name='Asset market clearing']
SUM(a) = 0;
[name='Aggregate shock process']
log(Z) = rhoZ*log(Z(-1))+eps_Z;
end;
// Aggregate shock specification
shocks;
var eps_Z; stderr 0.01;
end;