Path from initval to steady

Hi there,

I have a query regarding initval.

We give the guess values in initval and then command steady. This takes us to the steady state.

Is there anyway where I can view this transition path from initval (initial guess) to the steady state found by dynare?

Best,
Ammu

Are you talking about stochastic or perfect foresight simulations? In the former, a numerical solver is used to find the steady state. That has nothing to do with the economic transition to the steady state if the system is saddle path stable. For the latter, see https://github.com/JohannesPfeifer/DSGE_mod/blob/master/Solow_model/Solow_SS_transition.mod

Hi Prof Pfeifer,

I am referring to perfect foresight simulation. I followed your codes but I get the following error message.

Note: I use normpdf/normcdf in the model equations.



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.3).
Starting preprocessing of the model file ...
Found 72 equation(s).
Evaluating expressions...done
Computing static model derivatives:
 - order 1
Computing dynamic model derivatives:
 - order 1
Processing outputs ...
done
Preprocessing completed.





Residuals of the static equations:

Equation number 1 : 0 : Standardised shock to collateral value
Equation number 2 : 0 : Standardised omega_sb
Equation number 3 : 0 : Household budget constraint
Equation number 4 : 0 : Rebate back the transaction cost to Household
Equation number 5 : 0 : lambda_2 definition
Equation number 6 : 0 : Household FOC - consumption
Equation number 7 : 0 : Household FOC - loans
Equation number 8 : 0 : Household FOC - deposits
Equation number 9 : 0 : Household FOC - CBDC
Equation number 10 : 0 : Household FOC - labour supply
Equation number 11 : 0 : Return on cash
Equation number 12 : 0 : Production function
Equation number 13 : 0 : MPL=MPK
Equation number 14 : 0 : Marginal cost of production
Equation number 15 : 0 : Firm profits
Equation number 16 : 0 : Budget constraint - financial investor (FI)
Equation number 17 : 0 : Rebate back the transaction cost to FI
Equation number 18 : 0 : Risk premium
Equation number 19 : 0 : FI FOC - deposits
Equation number 20 : 0 : FI FOC - consumption
Equation number 21 : 0 : FI FOC - labour supply
Equation number 22 : 0 : FI FOC -Domestic bonds
Equation number 23 : 0 : FI FOC -Foreign bonds
Equation number 24 : 0 : Bank balance sheet
Equation number 25 : 0 : Bank ex ante zero profit condition on loans and collateral
Equation number 26 : 0 : Bank loan optimality condition
Equation number 27 : 0 : Bank net worth
Equation number 28 : 0 : Bank loss
Equation number 29 : 0 : Consumer loan loss
Equation number 30 : 0 : Bank monitoring cost on penalties
Equation number 31 : 0 : Monitoring costs
Equation number 32 : 0 : Transaction costs
Equation number 33 : 0 : Collateral
Equation number 34 : 0 : Loan return threshold
Equation number 35 : 0 : Equating gross return on loans to return on collateral assets 
Equation number 36 : 0 : Bank share in the value of collateral
Equation number 37 : 0 : G determines the proportion of collateral spend on monitoring costs
Equation number 38 : 0 : First order derivative of gamma_B 
Equation number 39 : 0 : First order derivative of G
Equation number 40 : 0 : Bank net worth and costs
Equation number 41 : 0 : Government budget constraint
Equation number 42 : 0 : Government spending rule  
Equation number 43 : 0 : Debt to GDP ratio 
Equation number 44 : 0 : Deficit GDP ratio  
Equation number 45 : 0 : Total loan
Equation number 46 : 0 : Aggregate deposits
Equation number 47 : 0 : Goods market clearing
Equation number 48 : 0 : Aggregate consumption
Equation number 49 : 0 : GDP identity
Equation number 50 : 0 : Bond market clearing
Equation number 51 : 0 : CBDC market clearing
Equation number 52 : 0 : Balance of payment
Equation number 53 : 0 : Factor price and import price
Equation number 54 : 0 : NKPC
Equation number 55 : 0 : lambda_total
Equation number 56 : 0 : Fisher rule 
Equation number 57 : 0 : Interest rate rule
Equation number 58 : 0 : Real CBDC interest rate 
Equation number 59 : 0 : Households monetary transaction costs
Equation number 60 : 0 : Velocity
Equation number 61 : 0 : Liquidity generating function
Equation number 62 : 0 : First order deriative of s_c w.r.t. c_c  
Equation number 63 : 0 : First order deriative of s_c w.r.t. d_c  
Equation number 64 : 0 : First order deriative of s_c w.r.t. m_c  
Equation number 65 : 0 : First order deriative of f_c w.r.t. d_c  
Equation number 66 : 0 : First order deriative of f_c w.r.t. m_c  
Equation number 67 : 0 : Shock to marginal utility of consumption
Equation number 68 : 0 : Shock to demand for liquidity
Equation number 69 : 0 : Shock to standard deviation of log(omega_c)
Equation number 70 : 0 : Shock to standard deviation of log(pistar)
Equation number 71 : 0 : Shock to standard deviation of log(rstar)
Equation number 72 : 0 : Shock to standard deviation of log(cstar)



--------------------------------------------------------
MODEL SIMULATION:

Iter: 1,	 err. = 138.4719, 	 time = 0.13
Iter: 2,	 err. = 1238.1375, 	 time = 0.153
Last iteration provided complex number for the following variables:
b, 
Error using erfc
Input must be real and full.

Error in normcdf>localnormcdf (line 124)
p(todo) = 0.5 * erfc(-z ./ sqrt(2));

Error in normcdf (line 46)
[varargout{1:max(1,nargout)}] = localnormcdf(uflag,x,varargin{:});

Error in transition_dynamic (line 131)
rhs =(1-normcdf(y(108),0,1))*y(75)/y(76)+y(101)*(1-params(36))*y(32)/(y(54)*y(76));

Error in sim1 (line 103)
        [d1,jacobian] = model_dynamic(Y(i_cols), exogenousvariables, params, steadystate,it);

Error in perfect_foresight_solver_core (line 94)
                        sim1(oo_.endo_simul, oo_.exo_simul, oo_.steady_state, M_, options_);

Error in perfect_foresight_solver (line 61)
oo_ = perfect_foresight_solver_core(M_,options_,oo_);

Error in transition (line 974)
perfect_foresight_solver;

Error in dynare (line 223)
evalin('base',fname) ;

Have you check whether your model is saddle path stable, i.e. works with stochastic simulations at first order?

Hi Prof Pfeifer,

Yes it works with stochastic simulations at the first order. When I give a shock to one of exogenous variables (e_c), I get the following results. Do you think the perfect foresight solver is not working because we have a normcdf command in the equations. erfc does not accept complex numbers. Is there a way around this?

I get the following results when i do stoch_simul(order=1).

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.5).
Starting preprocessing of the model file ...
Found 73 equation(s).
Evaluating expressions...done
Computing static model derivatives:
 - order 1
Computing dynamic model derivatives:
 - order 1
Processing outputs ...
done
Preprocessing completed.





Residuals of the static equations:

Equation number 1 : 0 : Standardised shock to collateral value
Equation number 2 : 0 : Standardised omega_sb
Equation number 3 : 0 : Household budget constraint
Equation number 4 : 0 : Rebate back the transaction cost to Household
Equation number 5 : 0 : lambda_2 definition
Equation number 6 : 0 : Household FOC - consumption
Equation number 7 : 0 : Household FOC - loans
Equation number 8 : 0 : Household FOC - deposits
Equation number 9 : 0 : Household FOC - CBDC
Equation number 10 : 0 : Household FOC - labour supply
Equation number 11 : 0 : Return on cash
Equation number 12 : 0 : Production function
Equation number 13 : 0 : MPL=MPK
Equation number 14 : 0 : Marginal cost of production
Equation number 15 : 0 : Firm profits
Equation number 16 : 0 : Budget constraint - financial investor (FI)
Equation number 17 : 0 : Rebate back the transaction cost to FI
Equation number 18 : 0 : Risk premium
Equation number 19 : 0 : FI FOC - deposits
Equation number 20 : 0 : FI FOC - consumption
Equation number 21 : 0 : FI FOC - labour supply
Equation number 22 : 0 : FI FOC -Domestic bonds
Equation number 23 : 0 : FI FOC -Foreign bonds
Equation number 24 : 0 : Bank balance sheet
Equation number 25 : 0 : Bank ex ante zero profit condition on loans and collateral
Equation number 26 : 0 : Bank loan optimality condition
Equation number 27 : 0 : Bank net worth
Equation number 28 : 0 : Bank loss
Equation number 29 : 0 : Consumer loan loss
Equation number 30 : 0 : Bank monitoring cost on penalties
Equation number 31 : 0 : Monitoring costs
Equation number 32 : 0 : Transaction costs
Equation number 33 : 0 : Collateral
Equation number 34 : 0 : Loan return threshold
Equation number 35 : 0 : Equating gross return on loans to return on collateral assets 
Equation number 36 : 0 : Bank share in the value of collateral
Equation number 37 : 0 : G determines the proportion of collateral spend on monitoring costs
Equation number 38 : 0 : First order derivative of gamma_B 
Equation number 39 : 0 : First order derivative of G
Equation number 40 : 0 : Bank net worth and costs
Equation number 41 : 0 : Government budget constraint
Equation number 42 : 0 : Government spending rule  
Equation number 43 : 0 : Debt to GDP ratio 
Equation number 44 : 0 : Deficit GDP ratio  
Equation number 45 : 0 : Total loan
Equation number 46 : 0 : Aggregate deposits
Equation number 47 : 0 : Goods market clearing
Equation number 48 : 0 : Aggregate consumption
Equation number 49 : 0 : GDP identity
Equation number 50 : 0 : Bond market clearing
Equation number 51 : 0 : CBDC market clearing
Equation number 52 : 0 : Balance of payment
Equation number 53 : 0 : Factor price and import price
Equation number 54 : 0 : NKPC
Equation number 55 : 0 : lambda_total
Equation number 56 : 0 : Fisher rule 
Equation number 57 : 0 : Interest rate rule
Equation number 58 : 0 : Price rule/quantity rule for CBDC 
Equation number 59 : 0 : Real CBDC interest rate 
Equation number 60 : 0 : Households monetary transaction costs
Equation number 61 : 0 : Velocity
Equation number 62 : 0 : Liquidity generating function
Equation number 63 : 0 : First order deriative of s_c w.r.t. c_c  
Equation number 64 : 0 : First order deriative of s_c w.r.t. d_c  
Equation number 65 : 0 : First order deriative of s_c w.r.t. m_c  
Equation number 66 : 0 : First order deriative of f_c w.r.t. d_c  
Equation number 67 : 0 : First order deriative of f_c w.r.t. m_c  
Equation number 68 : 0 : Shock to marginal utility of consumption
Equation number 69 : 0 : Shock to demand for liquidity
Equation number 70 : 0 : Shock to standard deviation of log(omega_c)
Equation number 71 : 0 : Shock to standard deviation of log(pistar)
Equation number 72 : 0 : Shock to standard deviation of log(rstar)
Equation number 73 : 0 : Shock to standard deviation of log(cstar)



MODEL SUMMARY

  Number of variables:         73
  Number of stochastic shocks: 6
  Number of state variables:   28
  Number of jumpers:           9
  Number of static variables:  37

But there is no output from the check-command

Okay when I insert check after steady, I have the following results.

dynare Transition_closed

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.3).
Starting preprocessing of the model file …
Found 65 equation(s).
Evaluating expressions…done
Computing static model derivatives:

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

Residuals of the static equations:

Equation number 1 : 0 : Standardised shock to collateral value
Equation number 2 : 0 : Standardised omega_sb
Equation number 3 : 0 : Household budget constraint
Equation number 4 : 0 : Rebate back the transaction cost to Household
Equation number 5 : 0 : lambda_2 definition
Equation number 6 : 0 : Household FOC - consumption
Equation number 7 : 0 : Household FOC - loans
Equation number 8 : 0 : Household FOC - deposits
Equation number 9 : 0 : Household FOC - CBDC
Equation number 10 : 0 : Household FOC - labour supply
Equation number 11 : 0 : Return on cash
Equation number 12 : 0 : Production function
Equation number 13 : 0 : Marginal cost of production
Equation number 14 : 0 : Firm profits
Equation number 15 : 0 : Budget constraint - financial investor (FI)
Equation number 16 : 0 : Rebate back the transaction cost to FI
Equation number 17 : 0 : FI FOC - deposits
Equation number 18 : 0 : FI FOC - consumption
Equation number 19 : 0 : FI FOC - labour supply
Equation number 20 : 0 : FI FOC - bonds
Equation number 21 : 0 : Bank balance sheet
Equation number 22 : 0 : Bank ex ante zero profit condition on loans and collateral
Equation number 23 : 0 : Bank loan optimality condition
Equation number 24 : 0 : Bank net worth
Equation number 25 : 0 : Bank loss
Equation number 26 : 0 : Consumer loan loss
Equation number 27 : 0 : Bank monitoring cost on penalties
Equation number 28 : 0 : Monitoring costs
Equation number 29 : 0 : Transaction costs
Equation number 30 : 0 : Collateral
Equation number 31 : 0 : Loan return threshold
Equation number 32 : 0 : Equating gross return on loans to return on collateral assets
Equation number 33 : 0 : Bank share in the value of collateral
Equation number 34 : 0 : G determines the proportion of collateral spend on monitoring costs
Equation number 35 : 0 : First order derivative of gamma_B
Equation number 36 : 0 : First order derivative of G
Equation number 37 : 0 : Bank net worth and costs
Equation number 38 : 0 : Government budget constraint
Equation number 39 : 0 : Government spending rule
Equation number 40 : 0 : Debt to GDP ratio
Equation number 41 : 0 : Deficit GDP ratio
Equation number 42 : 0 : Total loan
Equation number 43 : 0 : Aggregate deposits
Equation number 44 : 0 : Goods market clearing
Equation number 45 : 0 : Aggregate consumption
Equation number 46 : 0 : GDP identity
Equation number 47 : 0 : Bond market clearing
Equation number 48 : 0 : CBDC market clearing
Equation number 49 : 0 : NKPC
Equation number 50 : 0 : lambda_total
Equation number 51 : 0 : Fisher rule
Equation number 52 : 0 : Interest rate rule
Equation number 53 : 0 : Price rule/quantity rule for CBDC
Equation number 54 : 0 : Real CBDC interest rate
Equation number 55 : 0 : Households monetary transaction costs
Equation number 56 : 0 : Velocity
Equation number 57 : 0 : Liquidity generating function
Equation number 58 : 0 : First order deriative of s_c w.r.t. c_c
Equation number 59 : 0 : First order deriative of s_c w.r.t. d_c
Equation number 60 : 0 : First order deriative of s_c w.r.t. m_c
Equation number 61 : 0 : First order deriative of f_c w.r.t. d_c
Equation number 62 : 0 : First order deriative of f_c w.r.t. m_c
Equation number 63 : 0 : Shock to marginal utility of consumption
Equation number 64 : 0 : Shock to demand for liquidity
Equation number 65 : 0 : Shock to standard deviation of log(omega_c)

STEADY-STATE RESULTS:

b 18.0535
b_u 361.07
brat 360.52
Col 3.31224
con 1.02656
con_c 0.81611
con_u 5.0252
d 0.957284
d_c 0.162754
d_u 16.0534
f_c 1.94758
f_cdprime 1.04027
f_cmprime 1.06294
g 0.225343
G 0.0679958
G_prime 0.353659
gamma_B 0.323506
gamma_B_prime 0.688246
gdp 1.25191
mrat 30
h 1.32893
h_c 1.28746
h_u 0.218411
int 1.0142
int_m 1.01308
l 0.979583
l_c 1.03114
lambda_1 1.0458
lambda_2 1.03099
lambda_3 0.180906
lambda_tot 1.22532
Lb 2.58077e-38
Lc 2.7166e-38
mc 1
mon 0.0237578
mon_b 0.0112413
nb 0.0222989
omega_B 0.0330008
omega_c 0.371248
omega_sb 1.02699
pi_p 1
prof -5.99836e-44
psi_c 0
psi_u 0
r 1.0142
r_d 1.01393
r_n 1
r_r 1.19253
rc_l 1.02639
r_m 1.01308
s_c 0.0217389
s_c_prime 0.0941661
s_cdprime -0.0410483
s_cmprime -0.0419429
Sc 1
sigma_c 1
Smd 1
T 0.0185397
v_c 0.460942
w_hh 1
y 1.32893
z_b 2.07094
z_c -0.490885
m_c 1.58136
m 1.50229

EIGENVALUES:
Modulus Real Imaginary

1.394e-16 1.394e-16 0
2.109e-16 -2.109e-16 0
2.302e-16 -2.302e-16 0
4.571e-16 -4.571e-16 0
5.39e-16 -5.39e-16 0
5.835e-16 5.835e-16 0
7.922e-16 -7.922e-16 0
7.134e-14 -2.399e-15 7.13e-14
7.134e-14 -2.399e-15 -7.13e-14
8.353e-14 8.353e-14 0
0.003358 -0.003358 0
0.007469 -0.007469 0
0.01677 0.01677 0
0.6043 0.5983 0.08468
0.6043 0.5983 -0.08468
0.719 0.719 0
0.7481 0.7481 0
0.8378 0.8378 0
0.9692 0.9692 0
0.985 0.985 0
0.99 0.99 0
0.995 0.995 0
1.033 1.033 0
1.098 1.098 0
1.16 1.16 0
1.656 1.656 0
1590 1590 0
2.987e+15 2.987e+15 0
1.881e+16 1.881e+16 0
1.024e+17 -1.024e+17 0
3.673e+18 3.673e+18 0
3.82e+20 3.82e+20 0

There are 10 eigenvalue(s) larger than 1 in modulus
for 10 forward-looking variable(s)

The rank condition is verified.

MODEL SUMMARY

Number of variables: 65
Number of stochastic shocks: 3
Number of state variables: 22
Number of jumpers: 10
Number of static variables: 36

MATRIX OF COVARIANCE OF EXOGENOUS SHOCKS
Variables e_c e_md e_sigma_c
e_c 0.000005 0.000000 0.000000
e_md 0.000000 0.000000 0.000000
e_sigma_c 0.000000 0.000000 0.000000

Hi Prof Pfeifer,

Please find attached the mod file and the respective data files for init and end val

Transition_closed.mod (31.3 KB)

ss.mat (5.7 KB)
ss_CBDC.mat (5.9 KB)

Looking forward to your reply.

Many Thanks
Ammu
.

I have trouble with your mat-files as they seem to contain problematic symbolic math contents that may not be compatible with my Matlab version.

Hi Prof Pfeifer,

The attached mod file has values given inside, instead of calling from mat file. Hope this helps.

Best,
Ammu
Transition_closed.mod (31.8 KB)

For some reason, b is exploding. Have you tried what happens if you start slightly off the steady state? As the model is locally stable, that should work. If yes, then start increasing the deviation from the steady state and see what happens.