Model Specification and Steady state computation

I’m working on a model where firms’ productivity follows a lognormal distribution, and there’s an endogenous productivity threshold (a_bar) that separates firms using bank loans from those using capital markets. This threshold depends on the bank loan rate (r_l), which is endogenous and time-varying.

In my steady state MATLAB code, I have integrals that depend on this threshold:

% Productivity threshold (endogenous, depends on r_l)
a_bar = @(r_l) ( F ./ ( (1-alpha) .* (alpha^alpha * Q_bar).^(1/(1-alpha)) ...
    .* ( 1 - (1 + r_s)/(1 + r) * ((1 + r_s)/(1 + r_l)).^(alpha/(1-alpha)) ) ) ) .^ (1-alpha);

% PDF and integrand
lognormal_pdf = @(a) ( 1 ./ ( a*sigma*sqrt(2*pi)) ) .* exp( - (log(a)-0).^2 / (2*sigma^2) );
integrand     = @(a) a.^(1/(1-alpha)) .* lognormal_pdf(a);

% Truncated integrals (functions of r_l through a_bar)
Int_low  = @(r_l) integral(integrand, 0, a_bar(r_l));
Int_high = @(r_l) integral(integrand, a_bar(r_l), Inf);

These integrals then enter key equilibrium conditions, such as:

matlab


L = lambda * ( alpha*(1+r_s)/(1+r_l)*Q_bar ) ^ (1/(1-alpha)) * Int_low;

S = lambda * ( alpha^alpha*Q_bar ) ^ (1/(1-alpha)) * Int_high;

v = (1-lambda) * ( ((1+r_s)/(1+r_l))^(alpha/(1-alpha)) * Int_low + Int_high ) * (alpha*Q_bar)^(alpha/(1-alpha));

I need to write the dynamic model in a .mod file where a_bar, Int_low, and Int_high vary over time as r_l (and potentially r_s and Q_bar) vary. However, Dynare doesn’t allow me to use MATLAB’s integral() function directly in the model block since it requires fixed bounds.

  1. What is the recommended approach for handling endogenous threshold-dependent integrals in Dynare when the threshold varies over time?
  2. Should I use an external function to compute these integrals at each period? If so, how do I properly declare and call such functions in the .mod file?
  3. Are there alternative methods (e.g., approximating the integrals, using auxiliary variables, or specific Dynare features) that would be appropriate for this type of problem?

Any guidance on the proper workflow or examples of similar implementations would be greatly appreciated.