maxit ignored

This forum is closed. You can read the posts but cannot write. We have migrated the forum to a new location where you will have to reset your password.
Forum rules
This forum is closed. You can read the posts but cannot write. We have migrated the forum to a new location (https://forum.dynare.org) where you will have to reset your password.

maxit ignored

Postby nmark » Wed Sep 14, 2016 12:43 am

Can someone tell me how to set the maximum number of iterations in solving for the steady state?
I cannot seem to change the maximum number of iterations. I can set

steady(solve_algo=0,maxit=20), or steady(solve_algo=0,maxit=200000);

Either way, it cuts out saying maxit is set at 2000.

Solver stopped prematurely.
fsolve stopped because it exceeded the iteration limit,
options.MaxIter = 2000 (the selected value).

Same thing happens with dynare 4.4.3 and 4.4.2.
nmark
 
Posts: 7
Joined: Fri Aug 19, 2016 5:31 pm

Re: maxit ignored

Postby jpfeifer » Wed Sep 14, 2016 8:14 am

Please provide me with the file. Have you tried the unstable version?
------------
Johannes Pfeifer
University of Cologne
https://sites.google.com/site/pfeiferecon/
jpfeifer
 
Posts: 6940
Joined: Sun Feb 21, 2010 4:02 pm
Location: Cologne, Germany

Re: maxit ignored

Postby nmark » Thu Sep 15, 2016 4:24 pm

The file is quite long and may annoy you, but here it is.

% 2016 August 27
% CM01_A3_Second.mod Complete Markets, Two Country New Keynesian Model with Recursive Preferences
% Long-Run Risk Style Technology Process with correlated shocks
% Adapted from NK2_Complete_Recursive_Growth_SV_nolog.mod written by Kimberly Berg
% Output growth in the Taylor Rule


% DEFINE VARIABLES
% M_.endo_names(oo_.dr.order_var,:)

% MODEL SUMMARY
% Number of variables: 70
% Number of stochastic shocks: 8
% Number of state variables: 24
% Number of jumpers: 22
% Number of static variables: 26

var exr12 de12 cg1 cg2 yg1 yg2 rSDF1 rSDF2 nSDF1 nSDF2 w1 w2 mc1 mc2 c11
c12 c21 c22 p11P11 p12P12 p21P21 p22P22 P11P12 P21P22 PI1 PI2 G1 G2
Coint12 y1 y2 A1 A2 i1 i2 P11P1 P12P1 P21P2 P22P2 vp11 vp22 vp12 vp21
SV1 SV2 U1 U2 q12 c1 c2 Lam1 Lam2 n1 n2 V1 V2 X11 Z11 X21 Z21 X12 Z12
X22 Z22 piP1 piP2 piP11 piP12 piP21 piP22 x1 x2
ZZ;

varexo ea1 ea2 eg1 eg2 eSV1 eSV2 ei1 ei2 ex1 ex2 ;

parameters beta d11 d12 d21 d22 a mu sigma gamma nu psi theta rhoA1 rhoA2
siga1 siga2 alpha11 alpha12 alpha21 alpha22 delta1 delta2 xi1
xi2 zeta1 zeta2 omega1 omega2 sigi1 sigi2 A1bar A2bar i1bar
i2bar w1bar w2bar mc1bar mc2bar n1bar n2bar c1bar c2bar y1bar
y2bar V1bar V2bar U1bar U2bar c11bar c12bar c21bar c22bar q12bar
X11bar Z11bar X21bar Z21bar X12bar Z12bar X22bar Z22bar piP11bar
piP12bar piP21bar piP22bar piP1bar piP2bar vp11bar vp12bar
vp21bar vp22bar exr12bar i1i2bar de12bar p11P11bar p12P12bar
p21P21bar p22P22bar P11P1bar P12P1bar P21P2bar P22P2bar
P11P12bar P21P22bar muSV1 muSV2 rhoSV1 rhoSV2 eta1 eta2 rhox1
rhox2 lambdaDrift1 lambdaDrift2 psi1 psi2 theta1 theta2 ;

load SecondPars
%%%%%%%%%%%%%%%
% Preferences %
%%%%%%%%%%%%%%%
gamma = 38; % CRRA
nu = 0.357 ; % Consumption Weight
psi = 2 ; % psi is IES
theta = (1 - gamma) / (1 - (1/psi)) ;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Size, Bias, Discount Factor %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
beta = 0.99 ;
a = 1/2 ;
d11 = 2/3 ; % Home Bias
d12 = 1 - d11 ;
d22 = 2/3 ;
d21 = 1 - d22 ;
%%%%%%%%%%%%%%%%%
% Price Indices %
%%%%%%%%%%%%%%%%%
mu = 1.5 ; % Substitutes
sigma = 10 ; % 11 percent mark-up
%%%%%%%%%%%%%%%%%%%%
% Price Rigidities %
%%%%%%%%%%%%%%%%%%%%
alpha11 = 0.7 ;
alpha12 = 0.7 ;
alpha21 = 0.7 ;
alpha22 = 0.7 ;
%%%%%%%%%%%%%%%%%%%%
% Price Indexation %
%%%%%%%%%%%%%%%%%%%%
omega1 = 1 ;
omega2 = 1 ;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Transitory Technology Shock %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
rhoA1 = 0.0 ;
rhoA2 = 0.0 ;
siga1 = 0.0 ;
siga2 = 0.0 ;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Permanent Technology Shock %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
rhox1 = 0.779;
rhox2 = 0.7277;
lambdaDrift1 = 0.0;
lambdaDrift2 =0.0;
psi2 =0.0925;
psi1 = -0.1171;
theta1 =2.4252;
theta2 =2.1395;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Stochastic Volatility Shock %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
rhoSV1=0.7987;
rhoSV2 =0.8061;
eta1 =-4.2596;
eta2 =-4.6006;
muSV1 =-5.7259;
muSV2 =-5.9321;
%%%%%%%%%%%%%%%%%%%
% Monetary Policy %
%%%%%%%%%%%%%%%%%%%
delta1 = 0.8;
delta2 = 0.8;
xi1 = 1.5;
xi2 = 1.5;
zeta1 = 0.5;
zeta2 = 0.5;
sigi1 = 0.005;
sigi2 = 0.005;
%%%%%%%%%%%%%%%%%
% Steady States %
%%%%%%%%%%%%%%%%%
piP11bar = 0 ;
piP12bar = 0 ;
piP21bar = 0 ;
piP22bar = 0 ;
piP1bar = piP11bar ;
piP2bar = piP22bar ;

p11P11bar = 1 ;
p12P12bar = 1 ;
p21P21bar = 1 ;
p22P22bar = 1 ;

vp11bar = 1 ;
vp12bar = 1 ;
vp21bar = 1 ;
vp22bar = 1 ;

P11P1bar = 1 ;
P12P1bar = 1 ;
P21P2bar = 1 ;
P22P2bar = 1 ;
P11P12bar = 1 ;
P21P22bar = 1 ;
q12bar = 1 ;
de12bar = (1 + piP1bar)/(1 + piP2bar) ;

A1bar = 1 ;
A2bar = 1 ;
i1bar = 1/(beta * exp(lambdaDrift1 * (((nu*(1 - gamma))/theta) - 1))) - 1 ;
i2bar = 1/(beta * exp(lambdaDrift2 * (((nu*(1 - gamma))/theta) - 1))) - 1 ;
i1i2bar = i1bar - i2bar ;
exr12bar = (1 + i1bar) / ( (de12bar) ) - (1 + i2bar) ;
mc1bar = ( (sigma - 1) / sigma ) ;
mc2bar = ( (sigma - 1) / sigma ) ;
w1bar = mc1bar * A1bar * exp(lambdaDrift1) ;
w2bar = mc1bar * A2bar * exp(lambdaDrift2) ;

n1bar = ( (sigma - 1) / sigma ) * ( ((1 - nu)/(nu)) + ( (sigma - 1) / sigma ) )^(-1) ;
n2bar = ( (sigma - 1) / sigma ) * ( ((1 - nu)/(nu)) + ( (sigma - 1) / sigma ) )^(-1) ;
c1bar = w1bar * (1 - n1bar) * ( nu / (1 - nu) ) ;
c2bar = w2bar * (1 - n2bar) * ( nu / (1 - nu) ) ;
c11bar = d11 * c1bar ;
c12bar = d12 * c1bar ;
c21bar = d21 * c2bar ;
c22bar = d22 * c2bar ;
y1bar = c11 + c21 ;
y2bar = c22 + c12 ;

V1bar = c1bar^(nu) * (1 - n1bar)^(1 - nu) * (1 - beta)^(theta/(1 - gamma)) * (1 - beta * exp((lambdaDrift1 * nu * (1 - gamma))/theta))^(-theta/(1 - gamma)) ;
V2bar = c2bar^(nu) * (1 - n2bar)^(1 - nu) * (1 - beta)^(theta/(1 - gamma)) * (1 - beta * exp((lambdaDrift1 * nu * (1 - gamma))/theta))^(-theta/(1 - gamma)) ;
U1bar = V1bar^(1 - gamma) ;
U2bar = V2bar^(1 - gamma) ;

X11bar = ( 1/( 1 - alpha11 * beta * exp(lambdaDrift1 * ((nu * (1 - gamma))/theta - 1)) ) ) * c1bar^(nu * (1 - gamma)/theta - 1) * (1 - n1bar)^((1 - nu) * (1 - gamma)/theta) * mc1bar * c1bar ;
Z11bar = ( 1/( 1 - alpha11 * beta * exp(lambdaDrift1 * ((nu * (1 - gamma))/theta - 1)) ) ) * c1bar^(nu * (1 - gamma)/theta - 1) * (1 - n1bar)^((1 - nu) * (1 - gamma)/theta) * c1bar ;
X21bar = ( 1/( 1 - alpha21 * beta * exp(lambdaDrift1 * ((nu * (1 - gamma))/theta - 1)) ) ) * c1bar^(nu * (1 - gamma)/theta - 1) * (1 - n1bar)^((1 - nu) * (1 - gamma)/theta) * mc1bar * c2bar ;
Z21bar = ( 1/( 1 - alpha21 * beta * exp(lambdaDrift1 * ((nu * (1 - gamma))/theta - 1)) ) ) * c1bar^(nu * (1 - gamma)/theta - 1) * (1 - n1bar)^((1 - nu) * (1 - gamma)/theta) * c2bar ;

X12bar = ( 1/( 1 - alpha12 * beta * exp(lambdaDrift2 * ((nu * (1 - gamma))/theta - 1)) ) ) * c2bar^(nu * (1 - gamma)/theta - 1) * (1 - n2bar)^((1 - nu) * (1 - gamma)/theta) * mc2bar * c1bar ;
Z12bar = ( 1/( 1 - alpha12 * beta * exp(lambdaDrift2 * ((nu * (1 - gamma))/theta - 1)) ) ) * c2bar^(nu * (1 - gamma)/theta - 1) * (1 - n2bar)^((1 - nu) * (1 - gamma)/theta) * c1bar ;
X22bar = ( 1/( 1 - alpha22 * beta * exp(lambdaDrift2 * ((nu * (1 - gamma))/theta - 1)) ) ) * c2bar^(nu * (1 - gamma)/theta - 1) * (1 - n2bar)^((1 - nu) * (1 - gamma)/theta) * mc2bar * c2bar ;
Z22bar = ( 1/( 1 - alpha22 * beta * exp(lambdaDrift2 * ((nu * (1 - gamma))/theta - 1)) ) ) * c2bar^(nu * (1 - gamma)/theta - 1) * (1 - n2bar)^((1 - nu) * (1 - gamma)/theta) * c2bar ;


model;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Transitory Technology Shocks %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
log(A1) = rhoA1 * log(A1(-1)) + siga1 * ea1 ;
log(A2) = rhoA2 * log(A2(-1)) + siga2 * ea2 ;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Technology Growth Shocks with Stochastic Volatility %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
log(G1) = lambdaDrift1 + x1(-1) + theta1 * SV1(-1) * eg1 + psi1 * log(ZZ(-1));
log(G2) = lambdaDrift2 + x2(-1) + theta2 * SV2(-1) * eg2 + psi2 * log(ZZ(-1));

log(ZZ) = log(ZZ(-1)) + log(G1) - 0.66 * log(G2);
x1 = rhox1 * x1(-1) + SV1(-1) * ex1;
x2 = rhox2 * x2(-1) + SV2(-1) * ex2;
log(Coint12) = log(Coint12(-1)) + log(G1) - log(G2) ;

log(SV1) = (1 - rhoSV1) * muSV1 + rhoSV1 * log(SV1(-1)) + exp(eta1) * eSV1 ;
log(SV2) = (1 - rhoSV2) * muSV2 + rhoSV2 * log(SV2(-1)) + exp(eta2) * eSV2 ;

%%%%%%%%%%%%%%%%%%%
% Monetary Policy %
%%%%%%%%%%%%%%%%%%%
% Flexible Exchange Rate
i1 = (1 - delta1) * i1bar + delta1 * i1(-1) + (1 - delta1) * ( xi1 * (piP1 - piP1bar) + zeta1 * (log(y1) - log(y1(-1))) ) + sigi1*ei1 ;
i2 = (1 - delta2) * i2bar + delta2 * i2(-1) + (1 - delta2) * ( xi2 * (piP2 - piP2bar) + zeta2 * (log(y2) - log(y2(-1))) ) + sigi2*ei2 ;
%%%%%%%%%%%%%%%%
% Labor Supply %
%%%%%%%%%%%%%%%%
(w1) = ((1 - nu)/nu) * ((c1)/(1 - (n1))) ;
(w2) = ((1 - nu)/nu) * ((c2)/(1 - (n2))) ;

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Consumption Euler Equations %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
(1/(1+i1)) = beta * ( (c1(+1))/(c1) )^( ((nu * (1 - gamma))/theta) - 1 ) * ( (1 - (n1(+1)))/(1 - (n1)) )^( ((1 - nu) * (1 - gamma))/theta ) * ( (V1(+1))^(1 - gamma)/(U1) )^(1 - (1/theta)) * (1 / (1 + piP1(+1))) * G1^( ((nu * (1 - gamma))/theta) - 1 ) ;
(1/(1+i2)) = beta * ( (c2(+1))/(c2) )^( ((nu * (1 - gamma))/theta) - 1 ) * ( (1 - (n2(+1)))/(1 - (n2)) )^( ((1 - nu) * (1 - gamma))/theta ) * ( (V2(+1))^(1 - gamma)/(U2) )^(1 - (1/theta)) * (1 / (1 + piP2(+1))) * G2^( ((nu * (1 - gamma))/theta) - 1 ) ;

%%%%%%%%%%%%%%%%%%
% Value Function %
%%%%%%%%%%%%%%%%%%
(V1) = ((1 - beta) * ((c1)^nu * (1 - (n1))^(1 - nu))^((1 - gamma)/theta) + beta * (U1 * G1^(nu * (1 - gamma)))^(1/theta) )^(theta/(1 - gamma)) ;
(V2) = ((1 - beta) * ((c2)^nu * (1 - (n2))^(1 - nu))^((1 - gamma)/theta) + beta * (U2 * G2^(nu * (1 - gamma)))^(1/theta) )^(theta/(1 - gamma)) ;

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Auxilary Variable for the Value Function E_t[V(+1)^(1 - gamma)] %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
(U1) = (V1(+1))^(1 - gamma) ;
(U2) = (V2(+1))^(1 - gamma) ;

%%%%%%%%%%%%%%%%%
% Marginal Cost %
%%%%%%%%%%%%%%%%%
(mc1) = (w1/A1) * (1/G1) ;
(mc2) = (w2/A2) * (1/G2) ;

%%%%%%%%%%%
% Profits %
%%%%%%%%%%%
(PI1) = P11P1 * c11 + P21P2 * q12 * c21 * (1/Coint12(-1)) - w1 * n1 ;
(PI2) = P22P2 * c22 + P12P1 * (1/q12) * c12 * Coint12(-1) - w2 * n2 ;

%%%%%%%%%%%%%%%%%%%%
% Demand Functions %
%%%%%%%%%%%%%%%%%%%%
(c11) = ((P11P1)^(- mu)) * d11 * (c1) ;
(c12) = ((P12P1)^(- mu)) * d12 * (c1) ;

(c21) = ((P21P2)^(- mu)) * d21 * (c2) ;
(c22) = ((P22P2)^(- mu)) * d22 * (c2) ;

%%%%%%%%%%%%%%%%%%%%%%%%%%
% Equilibrium Conditions %
%%%%%%%%%%%%%%%%%%%%%%%%%%
(y1) = (c11) + (c21) * (1/Coint12(-1)) ;
(y2) = (c12) * (Coint12(-1)) + (c22) ;

(A1) * (G1) * (n1) = (c11) * (vp11) + (c21) * (1/Coint12(-1)) * (vp21) ;
(A2) * (G2) * (n2) = (c12) * (Coint12(-1)) * (vp12) + (c22) * (vp22) ;

(vp11) = (1 - alpha11) * (p11P11)^(- sigma) + (1/(1 + piP11))^(- sigma) * alpha11 * (vp11(-1)) ;
(vp21) = (1 - alpha21) * (p21P21)^(- sigma) + (1/(1 + piP21))^(- sigma) * alpha21 * (vp21(-1)) ;
(vp12) = (1 - alpha12) * (p12P12)^(- sigma) + (1/(1 + piP12))^(- sigma) * alpha12 * (vp12(-1)) ;
(vp22) = (1 - alpha22) * (p22P22)^(- sigma) + (1/(1 + piP22))^(- sigma) * alpha22 * (vp22(-1)) ;

%%%%%%%%%%%%%%%%%%%%%%%
% Evolution of Prices %
%%%%%%%%%%%%%%%%%%%%%%%
1 = alpha11 * (1/(1 + piP11))^(1-(sigma)) + (1 - alpha11) * (p11P11)^(1-(sigma)) ;
1 = alpha12 * (1/(1 + piP12))^(1-(sigma)) + (1 - alpha12) * (p12P12)^(1-(sigma)) ;

1 = alpha21 * (1/(1 + piP21))^(1-(sigma)) + (1 - alpha21) * (p21P21)^(1-(sigma)) ;
1 = alpha22 * (1/(1 + piP22))^(1-(sigma)) + (1 - alpha22) * (p22P22)^(1-(sigma)) ;

%%%%%%%%%%%%%%%%%
% Price Indices %
%%%%%%%%%%%%%%%%%
% 1 = ( d11 * P11P1^(1 - mu) + d12 * P12P1^(1 - mu) )^(1/(1 - mu)) ;
% 1 = ( d22 * P22P2^(1 - mu) + d21 * P21P2^(1 - mu) )^(1/(1 - mu)) ;

1/(P12P1) = ( d11 * (P11P12)^(1 - mu) + d12 )^(1/(1 - mu)) ;
1/(P11P1) = ( d11 + d12 * (1/(P11P12))^(1 - mu))^(1/(1 - mu)) ;

1/(P22P2) = ( d21 * (P21P22)^(1 - mu) + d22 )^(1/(1 - mu)) ;
1/(P21P2) = (d21 + d22 * (1/(P21P22))^(1 - mu))^(1/(1 - mu)) ;

(1 + piP11) / (1 + piP1) = (P11P1) / (P11P1(-1)) ;
(1 + piP12) / (1 + piP1) = (P12P1) / (P12P1(-1)) ;

(1 + piP21) / (1 + piP2) = (P21P2) / (P21P2(-1)) ;
(1 + piP22) / (1 + piP2) = (P22P2) / (P22P2(-1)) ;

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Nominal Exhange Rate Depreciation and Nominal Currency Excess Return %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Nominal Exchange Rate Depreciation
% ( (e12) / (e12(-1)) ) * (1 + piP2) / (1 + piP1) = (q12) / (q12(-1)) ;
( (de12) ) * (1 + piP2) / (1 + piP1) = (q12) / (q12(-1)) ;

% Nominal Exchange Rate
// (e12) = (de12) * (e12(-1)) ;

% Nominal Currency Excess Return
% exr12 = i1(-1) - i2(-1) - log(de12) ;
(exr12) = (1 + i1(-1)) / ( (de12) ) - (1 + i2(-1)) ;

%%%%%%%%%%%%%%%%%%%%%%
% Real Exchange Rate %
%%%%%%%%%%%%%%%%%%%%%%
q12 = ( (c2)/(c1) )^( ((nu * (1 - gamma))/theta) - 1 ) * ( (1 - (n2))/(1 - (n1)) )^( ((1 - nu) * (1 - gamma))/theta ) * ( (V2)^(1 - gamma)/(U2(-1)) )^(1 - (1/theta)) * ( (V1)^(1 - gamma)/(U1(-1)) )^(-1 + (1/theta)) * Coint12(-1)^( 1 - ((nu * (1 - gamma))/theta) ) ;

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Discount Term in Price Setting Equations %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Lam1 = ( (V1)^(1 - gamma)/(U1(-1)) )^(1 - (1/theta)) ;
Lam2 = ( (V2)^(1 - gamma)/(U2(-1)) )^(1 - (1/theta)) ;

%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Price Setting Equations %
%%%%%%%%%%%%%%%%%%%%%%%%%%%
% home price set by home
(p11P11) * (P11P1) = (sigma / (sigma-1)) * ((X11) / (Z11)) ;
(X11) = ( (c1) )^( ((nu * (1 - gamma))/theta) - 1 ) * ( (1 - (n1)) )^( ((1 - nu) * (1 - gamma))/theta ) * ( (mc1) * (P11P1)^(-mu) * (c1) ) + (1 / (1 + piP11(+1)))^(-sigma) * alpha11 * beta * Lam1(+1) * G1^( ((nu * (1 - gamma))/theta) - 1 ) * (X11(+1)) ;
(Z11) = ( (c1) )^( ((nu * (1 - gamma))/theta) - 1 ) * ( (1 - (n1)) )^( ((1 - nu) * (1 - gamma))/theta ) * ( (P11P1)^(-mu) * (c1) ) + (1 / (1 + piP1(+1))) * (1 / (1 + piP11(+1)))^(-sigma) * alpha11 * beta * Lam1(+1) * G1^( ((nu * (1 - gamma))/theta) - 1 ) * (Z11(+1)) ;

% foreign "home good" set by home
(p21P21) * (P21P2) = (sigma / (sigma-1)) * ((X21) / (Z21)) ;
(X21) = ( (c1) )^( ((nu * (1 - gamma))/theta) - 1 ) * ( (1 - (n1)) )^( ((1 - nu) * (1 - gamma))/theta ) * ( (mc1) * (P21P2)^(-mu) * (c2) * (1/Coint12(-1)) ) + (1 / (1 + piP21(+1)))^(-sigma) * alpha21 * beta * Lam1(+1) * G1^( ((nu * (1 - gamma))/theta) - 1 ) * (X21(+1)) ;
(Z21) = ( (c1) )^( ((nu * (1 - gamma))/theta) - 1 ) * ( (1 - (n1)) )^( ((1 - nu) * (1 - gamma))/theta ) * ( (P21P2)^(-mu) * (c2) * (1/Coint12(-1)) * (q12) ) + (1 / (1 + piP2(+1))) * (1 / (1 + piP21(+1)))^(-sigma) * alpha21 * beta * Lam1(+1) * G1^( ((nu * (1 - gamma))/theta) - 1 ) * (Z21(+1)) ;

% home "foreign good" set by foreign
(p12P12) * (P12P1) = (sigma / (sigma-1)) * ((X12) / (Z12)) ;
(X12) = ( (c2) )^( ((nu * (1 - gamma))/theta) - 1 ) * ( (1 - (n2)) )^( ((1 - nu) * (1 - gamma))/theta ) * ( (mc2) * (P12P1)^(-mu) * (c1) * (Coint12(-1)) ) + (1 / (1 + piP12(+1)))^(-sigma) * alpha12 * beta * Lam2(+1) * G2^( ((nu * (1 - gamma))/theta) - 1 ) * (X12(+1)) ;
(Z12) = ( (c2) )^( ((nu * (1 - gamma))/theta) - 1 ) * ( (1 - (n2)) )^( ((1 - nu) * (1 - gamma))/theta ) * ( (P12P1)^(-mu) * (c1) * (Coint12(-1)) * (1/(q12)) ) + (1 / (1 + piP1(+1))) * (1 / (1 + piP12(+1)))^(-sigma) * alpha12 * beta * Lam2(+1) * G2^( ((nu * (1 - gamma))/theta) - 1 ) * (Z12(+1)) ;

% foreign price set by foreign
(p22P22) * (P22P2) = (sigma / (sigma-1)) * ((X22) / (Z22)) ;
(X22) = ( (c2) )^( ((nu * (1 - gamma))/theta) - 1 ) * ( (1 - (n2)) )^( ((1 - nu) * (1 - gamma))/theta ) * ( (mc2) * (P22P2)^(-mu) * (c2) ) + (1 / (1 + piP22(+1)))^(-sigma) * alpha22 * beta * Lam2(+1) * G2^( ((nu * (1 - gamma))/theta) - 1 ) * (X22(+1)) ;
(Z22) = ( (c2) )^( ((nu * (1 - gamma))/theta) - 1 ) * ( (1 - (n2)) )^( ((1 - nu) * (1 - gamma))/theta ) * ( (P22P2)^(-mu) * (c2) ) + (1 / (1 + piP2(+1))) * (1 / (1 + piP22(+1)))^(-sigma) * alpha22 * beta * Lam2(+1) * G2^( ((nu * (1 - gamma))/theta) - 1 ) * (Z22(+1)) ;

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Consumption Growth - Not Normalized %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
cg1 = (c1 / c1(-1)) * G1(-1) ;
cg2 = (c2 / c2(-1)) * G2(-1) ;

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% GDP Growth - Not Normalized %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
yg1 = (y1 / y1(-1)) * G1(-1) ;
yg2 = (y2 / y2(-1)) * G2(-1) ;

%%%%%%%%%%%%
% Real SDF %
%%%%%%%%%%%%
rSDF1 = beta * ( ( (c1)/(c1(-1)) )^( ((nu * (1 - gamma))/theta) - 1 ) * ( (1 - (n1))/(1 - (n1(-1))) )^( ((1 - nu) * (1 - gamma))/theta ) * ( (V1)^(1 - gamma)/(U1(-1)) )^(1 - (1/theta)) * G1(-1)^( ((nu * (1 - gamma))/theta) - 1 ) ) ;
rSDF2 = beta * ( ( (c2)/(c2(-1)) )^( ((nu * (1 - gamma))/theta) - 1 ) * ( (1 - (n2))/(1 - (n2(-1))) )^( ((1 - nu) * (1 - gamma))/theta ) * ( (V2)^(1 - gamma)/(U2(-1)) )^(1 - (1/theta)) * G2(-1)^( ((nu * (1 - gamma))/theta) - 1 ) ) ;

%%%%%%%%%%%%%%%
% Nominal SDF %
%%%%%%%%%%%%%%%
nSDF1 = beta * ( ( (c1)/(c1(-1)) )^( ((nu * (1 - gamma))/theta) - 1 ) * ( (1 - (n1))/(1 - (n1(-1))) )^( ((1 - nu) * (1 - gamma))/theta ) * ( (V1)^(1 - gamma)/(U1(-1)) )^(1 - (1/theta)) * (1/(1 + piP1)) * G1(-1)^( ((nu * (1 - gamma))/theta) - 1 ) ) ;
nSDF2 = beta * ( ( (c2)/(c2(-1)) )^( ((nu * (1 - gamma))/theta) - 1 ) * ( (1 - (n2))/(1 - (n2(-1))) )^( ((1 - nu) * (1 - gamma))/theta ) * ( (V2)^(1 - gamma)/(U2(-1)) )^(1 - (1/theta)) * (1/(1 + piP2)) * G2(-1)^( ((nu * (1 - gamma))/theta) - 1 ) ) ;

end;

initval ;
exr12 =-3.51794194240601e-07;
de12 =0.999999281904542;
cg1 =1;
cg2 =1;
yg1 =1;
yg2 =1;
rSDF1 =0.989944939692778;
rSDF2 =0.990001494187049;
nSDF1 =0.990001303943164;
nSDF2 =0.990000248234804;
w1 =0.900116289595580;
w2 =0.899883668034194;
mc1 =0.900116289595580;
mc2 =0.899883668034194;
c11 =0.222121896280940;
c12 =0.111125568601143;
c21 =0.111004500149344;
c22 =0.222138175465771;
p11P11 =0.999997930470773;
p12P12 =0.999997930470773;
p21P21 =0.999999606016582;
p22P22 =0.999999606016582;
P11P12 =1.00038786028155;
P21P22 =1.00038786007415;
PI1 =0.0333219588506626;
PI2 =0.0333170767640656;
G1 =1;
G2 =1;
Coint12 =0.999549974609961;
y1 =0.333176373764959;
y2 =0.333213734740919;
A1 =1;
A2 =1;
i1 =0.0100996796831112;
i2 =0.0101007568260277;
P11P1 =1.00012927840499;
P12P1 =0.999741518373529;
P21P2 =1.00025856502725;
P22P2 =0.999870755079713;
vp11 =1.00000000001035;
vp22 =0.999999999999881;
vp12 =1.00000000001035;
vp21 =0.999999999999880;
SV1 =-0.000447134387214084;
SV2 =-0.000391385991876135;
U1 =12255600.3877917;
U2 =12301043.1591682;
q12 =0.999870691988907;
c1 =0.333247456529612;
c2 =0.333142667266718;
Lam1 =0.999944383528059;
Lam2 =1.00000150927985;
n1 =0.333176373767244;
n2 =0.333213734742042;
V1 =0.627301252285333;
V2 =0.627234922064560;
X11 =2.11468761806717;
Z11 =2.34935405090063;
X21 =2.11459868482122;
Z21 =2.34894766390574;
X12 =2.11520025647625;
Z12 =2.35083501862477;
X22 =2.11511130400904;
Z22 =2.35042837791576;
piP1 =-8.86945265971758e-07;
piP2 =-1.68849988279269e-07;
piP11 =-8.86945266143883e-07;
piP12 =-8.86945266110353e-07;
piP21 =-1.68849988155449e-07;
piP22 =-1.68849988234747e-07;
x1 =-1.67180571247534e-38;
x2 =-1.74819864088064e-37;
ZZ =1;

end ;

shocks;

var ea1 = 1 ;
var ea2 = 1 ;
var eg1 = 1 ;
var eg2 = 1 ;
var eSV1 = 1 ;
var eSV2 = 1 ;
var ei1 = 0 ;
var ei2 = 0 ;
var ex1 = 1;
var ex2 = 1;

corr eg1, eg2 = 0.2037;
corr ex1, ex2 = .27;
corr eSV1, eSV2 = 0.0166;

end;
steady(solve_algo=0,maxit=2);
set_dynare_seed(72085);
stoch_simul(solve_algo=0,order = 3, periods = 1200, nograph) ;
nmark
 
Posts: 7
Joined: Fri Aug 19, 2016 5:31 pm

Re: maxit ignored

Postby jpfeifer » Thu Sep 15, 2016 4:32 pm

You did not provide the
Code: Select all
SecondPars

file you load. When commenting out that line, I cannot replicate your problem. maxit is correctly honored. But when I increase maxit, the solver will stop prematurely due to a different termination criterion.
------------
Johannes Pfeifer
University of Cologne
https://sites.google.com/site/pfeiferecon/
jpfeifer
 
Posts: 6940
Joined: Sun Feb 21, 2010 4:02 pm
Location: Cologne, Germany

Re: maxit ignored

Postby nmark » Fri Sep 16, 2016 1:19 pm

Thanks, but could you take a quick look at this one? This program is clean in that it doesn't load any files. I set maxit=20000, but it stops at the iteration limit of 2000.


Code: Select all
% DEFINE VARIABLES
% M_.endo_names(oo_.dr.order_var,:)

% MODEL SUMMARY
%   Number of variables:         70
%   Number of stochastic shocks: 8
%   Number of state variables:   24
%   Number of jumpers:           22
%   Number of static variables:  26 

var exr12 de12 cg1 cg2 yg1 yg2 rSDF1 rSDF2 nSDF1 nSDF2 w1 w2 mc1 mc2 c11
    c12 c21 c22 p11P11 p12P12 p21P21 p22P22 P11P12 P21P22 PI1 PI2 G1 G2
    Coint12 y1 y2 A1 A2 i1 i2 P11P1 P12P1 P21P2 P22P2 vp11 vp22 vp12 vp21
    SV1 SV2 U1 U2 q12 c1 c2 Lam1 Lam2 n1 n2 V1 V2 X11 Z11 X21 Z21 X12 Z12
    X22 Z22 piP1 piP2 piP11 piP12 piP21 piP22 x1 x2
    ZZ;
   
varexo ea1 ea2 eg1 eg2 eSV1 eSV2 ei1 ei2 ex1 ex2  ;

parameters beta d11 d12 d21 d22 a mu sigma gamma nu psi theta rhoA1 rhoA2
           siga1 siga2 alpha11 alpha12 alpha21 alpha22 delta1 delta2 xi1
           xi2 zeta1 zeta2 omega1 omega2 sigi1 sigi2 A1bar A2bar i1bar
           i2bar w1bar w2bar mc1bar mc2bar n1bar n2bar c1bar c2bar y1bar
           y2bar V1bar V2bar U1bar U2bar c11bar c12bar c21bar c22bar q12bar 
           X11bar Z11bar X21bar Z21bar X12bar Z12bar X22bar Z22bar piP11bar
           piP12bar piP21bar piP22bar piP1bar piP2bar vp11bar vp12bar
           vp21bar vp22bar exr12bar i1i2bar de12bar p11P11bar p12P12bar
           p21P21bar p22P22bar P11P1bar P12P1bar P21P2bar P22P2bar
           P11P12bar P21P22bar muSV1 muSV2 rhoSV1 rhoSV2 eta1 eta2 rhox1
           rhox2 lambdaDrift1 lambdaDrift2 psi1 psi2 theta1 theta2 ;

%%%%%%%%%%%%%%%
% Preferences %
%%%%%%%%%%%%%%%
   gamma = 40;        % CRRA
   psi = 2;         % psi is IES
   nu = 0.357   ;    % Consumption Weight
   theta = (1 - gamma) / (1 - (1/psi)) ;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Size, Bias, Discount Factor %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   beta = 0.99 ;
   a = 1/2 ;
   d11 = 2/3 ;   % Home Bias
   d12 = 1 - d11 ;
   d22 = 2/3 ;
   d21 = 1 - d22 ;
%%%%%%%%%%%%%%%%%
% Price Indices %
%%%%%%%%%%%%%%%%%
   mu = 1.5 ;   % Substitutes
   sigma = 10 ; % 11 percent mark-up
%%%%%%%%%%%%%%%%%%%%
% Price Rigidities %
%%%%%%%%%%%%%%%%%%%%
   alpha11 = 0.7 ;
   alpha12 = 0.7 ;
   alpha21 = 0.7 ;
   alpha22 = 0.7 ;
%%%%%%%%%%%%%%%%%%%%
% Price Indexation %
%%%%%%%%%%%%%%%%%%%%
   omega1 = 1 ;
   omega2 = 1 ;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Transitory Technology Shock %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   rhoA1 = 0.0 ;
   rhoA2 = 0.0 ;
   siga1 = 0.0 ;
   siga2 = 0.0 ;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Permanent Technology Shock %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   rhox1 = 0.779;
   rhox2 = 0.7277;
   lambdaDrift1 = 0.0;
   lambdaDrift2 =0.0;
   psi2 =0.0925;
   psi1 = -0.1171;
   theta1 =2.4252;
   theta2 =2.1395;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Stochastic Volatility Shock %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   rhoSV1=0.7987;
   rhoSV2 =0.8061;
   eta1 =-4.2596;
   eta2 =-4.6006;
   muSV1 =-5.7259;
   muSV2 =-5.9321;
%%%%%%%%%%%%%%%%%%%
% Monetary Policy %
%%%%%%%%%%%%%%%%%%%
    delta1 = 0.8;
    delta2 = 0.8;
    xi1    = 1.5;   
    xi2    = 1.5;
    zeta1  = 0.5;
    zeta2  = 0.5;
    sigi1 = 0.005;
    sigi2 = 0.005;
%%%%%%%%%%%%%%%%%
% Steady States %
%%%%%%%%%%%%%%%%%
piP11bar = 0 ;
piP12bar = 0 ;
piP21bar = 0 ;
piP22bar = 0 ;
piP1bar = piP11bar ;
piP2bar = piP22bar ;

p11P11bar = 1 ;
p12P12bar = 1 ;
p21P21bar = 1 ;
p22P22bar = 1 ;

vp11bar = 1 ;
vp12bar = 1 ;
vp21bar = 1 ;
vp22bar = 1 ;

P11P1bar = 1 ;
P12P1bar = 1 ;
P21P2bar = 1 ;
P22P2bar = 1 ;
P11P12bar = 1 ;
P21P22bar = 1 ;
q12bar = 1 ;
de12bar = (1 + piP1bar)/(1 + piP2bar) ;

A1bar = 1 ;
A2bar = 1 ;
i1bar = 1/(beta * exp(lambdaDrift1 * (((nu*(1 - gamma))/theta) - 1))) - 1 ;
i2bar = 1/(beta * exp(lambdaDrift2 * (((nu*(1 - gamma))/theta) - 1))) - 1 ;
i1i2bar = i1bar - i2bar ;
exr12bar = (1 + i1bar) / ( (de12bar) ) - (1 + i2bar) ;
mc1bar =  ( (sigma - 1) / sigma ) ;
mc2bar =  ( (sigma - 1) / sigma ) ;
w1bar = mc1bar * A1bar * exp(lambdaDrift1) ;
w2bar = mc1bar * A2bar * exp(lambdaDrift2) ;

n1bar = ( (sigma - 1) / sigma ) * ( ((1 - nu)/(nu)) + ( (sigma - 1) / sigma ) )^(-1) ;
n2bar = ( (sigma - 1) / sigma ) * ( ((1 - nu)/(nu)) + ( (sigma - 1) / sigma ) )^(-1) ;
c1bar = w1bar * (1 - n1bar) * ( nu / (1 - nu) ) ;
c2bar = w2bar * (1 - n2bar) * ( nu / (1 - nu) ) ;
c11bar = d11 * c1bar ;
c12bar = d12 * c1bar ;
c21bar = d21 * c2bar ;
c22bar = d22 * c2bar ;
y1bar = c11 + c21 ;
y2bar = c22 + c12 ;

V1bar = c1bar^(nu) * (1 - n1bar)^(1 - nu) * (1 - beta)^(theta/(1 - gamma)) * (1 - beta * exp((lambdaDrift1 * nu * (1 - gamma))/theta))^(-theta/(1 - gamma)) ;
V2bar = c2bar^(nu) * (1 - n2bar)^(1 - nu) * (1 - beta)^(theta/(1 - gamma)) * (1 - beta * exp((lambdaDrift1 * nu * (1 - gamma))/theta))^(-theta/(1 - gamma)) ;
U1bar = V1bar^(1 - gamma) ;
U2bar = V2bar^(1 - gamma) ;

X11bar = ( 1/( 1 - alpha11 * beta * exp(lambdaDrift1 * ((nu * (1 - gamma))/theta - 1)) ) ) * c1bar^(nu * (1 - gamma)/theta - 1) * (1 - n1bar)^((1 - nu) * (1 - gamma)/theta) * mc1bar * c1bar ;
Z11bar = ( 1/( 1 - alpha11 * beta * exp(lambdaDrift1 * ((nu * (1 - gamma))/theta - 1)) ) ) * c1bar^(nu * (1 - gamma)/theta - 1) * (1 - n1bar)^((1 - nu) * (1 - gamma)/theta) * c1bar ;
X21bar = ( 1/( 1 - alpha21 * beta * exp(lambdaDrift1 * ((nu * (1 - gamma))/theta - 1)) ) ) * c1bar^(nu * (1 - gamma)/theta - 1) * (1 - n1bar)^((1 - nu) * (1 - gamma)/theta) * mc1bar * c2bar ;
Z21bar = ( 1/( 1 - alpha21 * beta * exp(lambdaDrift1 * ((nu * (1 - gamma))/theta - 1)) ) ) * c1bar^(nu * (1 - gamma)/theta - 1) * (1 - n1bar)^((1 - nu) * (1 - gamma)/theta) * c2bar ;

X12bar = ( 1/( 1 - alpha12 * beta * exp(lambdaDrift2 * ((nu * (1 - gamma))/theta - 1)) ) ) * c2bar^(nu * (1 - gamma)/theta - 1) * (1 - n2bar)^((1 - nu) * (1 - gamma)/theta) * mc2bar * c1bar ;
Z12bar = ( 1/( 1 - alpha12 * beta * exp(lambdaDrift2 * ((nu * (1 - gamma))/theta - 1)) ) ) * c2bar^(nu * (1 - gamma)/theta - 1) * (1 - n2bar)^((1 - nu) * (1 - gamma)/theta) * c1bar ;
X22bar = ( 1/( 1 - alpha22 * beta * exp(lambdaDrift2 * ((nu * (1 - gamma))/theta - 1)) ) ) * c2bar^(nu * (1 - gamma)/theta - 1) * (1 - n2bar)^((1 - nu) * (1 - gamma)/theta) * mc2bar * c2bar ;
Z22bar = ( 1/( 1 - alpha22 * beta * exp(lambdaDrift2 * ((nu * (1 - gamma))/theta - 1)) ) ) * c2bar^(nu * (1 - gamma)/theta - 1) * (1 - n2bar)^((1 - nu) * (1 - gamma)/theta) * c2bar ;


model;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Transitory Technology Shocks %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
log(A1) = rhoA1 * log(A1(-1)) + siga1 * ea1 ;
log(A2) = rhoA2 * log(A2(-1)) + siga2 * ea2 ;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Technology Growth Shocks with Stochastic Volatility %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 log(G1) = lambdaDrift1 + x1(-1) + theta1 * SV1(-1) * eg1 + psi1 * log(ZZ(-1));
 log(G2) = lambdaDrift2 + x2(-1) + theta2 * SV2(-1) * eg2 + psi2 * log(ZZ(-1));

log(ZZ) = log(ZZ(-1)) + log(G1)  - 0.66 * log(G2);
x1 = rhox1 * x1(-1) +  SV1(-1) * ex1;
x2 = rhox2 * x2(-1) +  SV2(-1) * ex2;
log(Coint12) = log(Coint12(-1)) + log(G1) - log(G2) ;

log(SV1) = (1 - rhoSV1) * muSV1 + rhoSV1 * log(SV1(-1)) + exp(eta1) * eSV1 ;
log(SV2) = (1 - rhoSV2) * muSV2 + rhoSV2 * log(SV2(-1)) + exp(eta2) * eSV2 ;

%%%%%%%%%%%%%%%%%%%
% Monetary Policy %
%%%%%%%%%%%%%%%%%%%
% Flexible Exchange Rate
i1 = (1 - delta1) * i1bar + delta1 * i1(-1) + (1 - delta1) * ( xi1 * (piP1 - piP1bar) + zeta1 * (log(y1) - log(y1(-1))) ) + sigi1*ei1 ;
i2 = (1 - delta2) * i2bar + delta2 * i2(-1) + (1 - delta2) * ( xi2 * (piP2 - piP2bar) + zeta2 * (log(y2) - log(y2(-1))) ) + sigi2*ei2 ;
%%%%%%%%%%%%%%%%
% Labor Supply %
%%%%%%%%%%%%%%%%
(w1) = ((1 - nu)/nu) * ((c1)/(1 - (n1))) ;
(w2) = ((1 - nu)/nu) * ((c2)/(1 - (n2))) ;

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Consumption Euler Equations %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
(1/(1+i1)) = beta * ( (c1(+1))/(c1) )^( ((nu * (1 - gamma))/theta) - 1 ) * ( (1 - (n1(+1)))/(1 - (n1)) )^( ((1 - nu) * (1 - gamma))/theta ) * ( (V1(+1))^(1 - gamma)/(U1) )^(1 - (1/theta)) * (1 / (1 + piP1(+1))) * G1^( ((nu * (1 - gamma))/theta) - 1 ) ;
(1/(1+i2)) = beta * ( (c2(+1))/(c2) )^( ((nu * (1 - gamma))/theta) - 1 ) * ( (1 - (n2(+1)))/(1 - (n2)) )^( ((1 - nu) * (1 - gamma))/theta ) * ( (V2(+1))^(1 - gamma)/(U2) )^(1 - (1/theta)) * (1 / (1 + piP2(+1))) * G2^( ((nu * (1 - gamma))/theta) - 1 ) ;

%%%%%%%%%%%%%%%%%%
% Value Function %
%%%%%%%%%%%%%%%%%%
(V1) = ((1 - beta) * ((c1)^nu * (1 - (n1))^(1 - nu))^((1 - gamma)/theta) + beta * (U1 * G1^(nu * (1 - gamma)))^(1/theta) )^(theta/(1 - gamma)) ;
(V2) = ((1 - beta) * ((c2)^nu * (1 - (n2))^(1 - nu))^((1 - gamma)/theta) + beta * (U2 * G2^(nu * (1 - gamma)))^(1/theta) )^(theta/(1 - gamma)) ;

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Auxilary Variable for the Value Function E_t[V(+1)^(1 - gamma)] %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
(U1) = (V1(+1))^(1 - gamma) ;
(U2) = (V2(+1))^(1 - gamma) ;

%%%%%%%%%%%%%%%%%
% Marginal Cost %
%%%%%%%%%%%%%%%%%
(mc1) = (w1/A1) * (1/G1) ;
(mc2) = (w2/A2) * (1/G2) ;

%%%%%%%%%%%
% Profits %
%%%%%%%%%%%
(PI1) = P11P1 * c11 + P21P2 * q12 * c21 * (1/Coint12(-1)) - w1 * n1 ;
(PI2) = P22P2 * c22 + P12P1 * (1/q12) * c12 * Coint12(-1) - w2 * n2 ;

%%%%%%%%%%%%%%%%%%%%
% Demand Functions %
%%%%%%%%%%%%%%%%%%%%
(c11) = ((P11P1)^(- mu)) * d11 * (c1) ;
(c12) = ((P12P1)^(- mu)) * d12 * (c1) ;

(c21) = ((P21P2)^(- mu)) * d21 * (c2) ;
(c22) = ((P22P2)^(- mu)) * d22 * (c2) ;

%%%%%%%%%%%%%%%%%%%%%%%%%%
% Equilibrium Conditions %
%%%%%%%%%%%%%%%%%%%%%%%%%%
(y1) = (c11) + (c21) * (1/Coint12(-1)) ;
(y2) = (c12) * (Coint12(-1)) + (c22) ;

(A1) * (G1) * (n1) = (c11) * (vp11) + (c21) * (1/Coint12(-1)) * (vp21) ;
(A2) * (G2) * (n2) = (c12) * (Coint12(-1)) * (vp12) + (c22) * (vp22) ;

(vp11) = (1 - alpha11) * (p11P11)^(- sigma) + (1/(1 + piP11))^(- sigma) * alpha11 * (vp11(-1)) ;
(vp21) = (1 - alpha21) * (p21P21)^(- sigma) + (1/(1 + piP21))^(- sigma) * alpha21 * (vp21(-1)) ;
(vp12) = (1 - alpha12) * (p12P12)^(- sigma) + (1/(1 + piP12))^(- sigma) * alpha12 * (vp12(-1)) ;
(vp22) = (1 - alpha22) * (p22P22)^(- sigma) + (1/(1 + piP22))^(- sigma) * alpha22 * (vp22(-1)) ;

%%%%%%%%%%%%%%%%%%%%%%%
% Evolution of Prices %
%%%%%%%%%%%%%%%%%%%%%%%
1 = alpha11 * (1/(1 + piP11))^(1-(sigma)) + (1 - alpha11) * (p11P11)^(1-(sigma)) ;
1 = alpha12 * (1/(1 + piP12))^(1-(sigma)) + (1 - alpha12) * (p12P12)^(1-(sigma)) ;

1 = alpha21 * (1/(1 + piP21))^(1-(sigma)) + (1 - alpha21) * (p21P21)^(1-(sigma)) ;
1 = alpha22 * (1/(1 + piP22))^(1-(sigma)) + (1 - alpha22) * (p22P22)^(1-(sigma)) ;

%%%%%%%%%%%%%%%%%
% Price Indices %
%%%%%%%%%%%%%%%%%
% 1 = ( d11 * P11P1^(1 - mu) + d12 * P12P1^(1 - mu) )^(1/(1 - mu)) ;
% 1 = ( d22 * P22P2^(1 - mu) + d21 * P21P2^(1 - mu) )^(1/(1 - mu)) ;

1/(P12P1) = ( d11 * (P11P12)^(1 - mu) + d12 )^(1/(1 - mu)) ;
1/(P11P1) = ( d11 + d12 * (1/(P11P12))^(1 - mu))^(1/(1 - mu)) ;

1/(P22P2) = ( d21 * (P21P22)^(1 - mu) + d22 )^(1/(1 - mu)) ;
1/(P21P2) = (d21 + d22 * (1/(P21P22))^(1 - mu))^(1/(1 - mu)) ;

(1 + piP11) / (1 + piP1) = (P11P1) / (P11P1(-1)) ;
(1 + piP12) / (1 + piP1) = (P12P1) / (P12P1(-1)) ;

(1 + piP21) / (1 + piP2) = (P21P2) / (P21P2(-1)) ;
(1 + piP22) / (1 + piP2) = (P22P2) / (P22P2(-1)) ;

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Nominal Exhange Rate Depreciation and Nominal Currency Excess Return %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Nominal Exchange Rate Depreciation
% ( (e12) / (e12(-1)) ) * (1 + piP2) / (1 + piP1) = (q12) / (q12(-1)) ;
( (de12) ) * (1 + piP2) / (1 + piP1) = (q12) / (q12(-1)) ;

% Nominal Exchange Rate
//  (e12) = (de12) * (e12(-1)) ;

% Nominal Currency Excess Return
% exr12 = i1(-1) - i2(-1) - log(de12) ;
(exr12) = (1 + i1(-1)) / ( (de12) ) - (1 + i2(-1)) ;

%%%%%%%%%%%%%%%%%%%%%%
% Real Exchange Rate %
%%%%%%%%%%%%%%%%%%%%%%
q12 = ( (c2)/(c1) )^( ((nu * (1 - gamma))/theta) - 1 ) * ( (1 - (n2))/(1 - (n1)) )^( ((1 - nu) * (1 - gamma))/theta ) * ( (V2)^(1 - gamma)/(U2(-1)) )^(1 - (1/theta)) * ( (V1)^(1 - gamma)/(U1(-1)) )^(-1 + (1/theta)) * Coint12(-1)^( 1 - ((nu * (1 - gamma))/theta) ) ;

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Discount Term in Price Setting Equations %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Lam1 = ( (V1)^(1 - gamma)/(U1(-1)) )^(1 - (1/theta)) ;
Lam2 = ( (V2)^(1 - gamma)/(U2(-1)) )^(1 - (1/theta)) ;

%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Price Setting Equations %
%%%%%%%%%%%%%%%%%%%%%%%%%%%
% home price set by home
(p11P11) * (P11P1) = (sigma / (sigma-1)) * ((X11) / (Z11)) ;
(X11) = ( (c1) )^( ((nu * (1 - gamma))/theta) - 1 ) * ( (1 - (n1)) )^( ((1 - nu) * (1 - gamma))/theta ) * ( (mc1) * (P11P1)^(-mu) * (c1) ) + (1 / (1 + piP11(+1)))^(-sigma) * alpha11 * beta * Lam1(+1) * G1^( ((nu * (1 - gamma))/theta) - 1 ) * (X11(+1)) ;
(Z11) = ( (c1) )^( ((nu * (1 - gamma))/theta) - 1 ) * ( (1 - (n1)) )^( ((1 - nu) * (1 - gamma))/theta ) * ( (P11P1)^(-mu) * (c1) ) + (1 / (1 + piP1(+1))) * (1 / (1 + piP11(+1)))^(-sigma) * alpha11 * beta * Lam1(+1) * G1^( ((nu * (1 - gamma))/theta) - 1 ) * (Z11(+1)) ;

% foreign "home good" set by home
(p21P21) * (P21P2) = (sigma / (sigma-1)) * ((X21) / (Z21)) ;
(X21) = ( (c1) )^( ((nu * (1 - gamma))/theta) - 1 ) * ( (1 - (n1)) )^( ((1 - nu) * (1 - gamma))/theta ) * ( (mc1) * (P21P2)^(-mu) * (c2) * (1/Coint12(-1)) ) + (1 / (1 + piP21(+1)))^(-sigma) * alpha21 * beta * Lam1(+1) * G1^( ((nu * (1 - gamma))/theta) - 1 ) * (X21(+1)) ;
(Z21) = ( (c1) )^( ((nu * (1 - gamma))/theta) - 1 ) * ( (1 - (n1)) )^( ((1 - nu) * (1 - gamma))/theta ) * ( (P21P2)^(-mu) * (c2) * (1/Coint12(-1)) * (q12) ) + (1 / (1 + piP2(+1))) * (1 / (1 + piP21(+1)))^(-sigma) * alpha21 * beta * Lam1(+1) * G1^( ((nu * (1 - gamma))/theta) - 1 ) * (Z21(+1)) ;

% home "foreign good" set by foreign
(p12P12) * (P12P1) = (sigma / (sigma-1)) * ((X12) / (Z12)) ;
(X12) = ( (c2) )^( ((nu * (1 - gamma))/theta) - 1 ) * ( (1 - (n2)) )^( ((1 - nu) * (1 - gamma))/theta ) * ( (mc2) * (P12P1)^(-mu) * (c1) * (Coint12(-1)) ) + (1 / (1 + piP12(+1)))^(-sigma) * alpha12 * beta * Lam2(+1) * G2^( ((nu * (1 - gamma))/theta) - 1 ) * (X12(+1)) ;
(Z12) = ( (c2) )^( ((nu * (1 - gamma))/theta) - 1 ) * ( (1 - (n2)) )^( ((1 - nu) * (1 - gamma))/theta ) * ( (P12P1)^(-mu) * (c1) * (Coint12(-1)) * (1/(q12)) ) + (1 / (1 + piP1(+1))) * (1 / (1 + piP12(+1)))^(-sigma) * alpha12 * beta * Lam2(+1) * G2^( ((nu * (1 - gamma))/theta) - 1 ) * (Z12(+1)) ;

% foreign price set by foreign
(p22P22) * (P22P2) = (sigma / (sigma-1)) * ((X22) / (Z22)) ;
(X22) = ( (c2) )^( ((nu * (1 - gamma))/theta) - 1 ) * ( (1 - (n2)) )^( ((1 - nu) * (1 - gamma))/theta ) * ( (mc2) * (P22P2)^(-mu) * (c2) ) + (1 / (1 + piP22(+1)))^(-sigma) * alpha22 * beta * Lam2(+1) * G2^( ((nu * (1 - gamma))/theta) - 1 ) * (X22(+1)) ;
(Z22) = ( (c2) )^( ((nu * (1 - gamma))/theta) - 1 ) * ( (1 - (n2)) )^( ((1 - nu) * (1 - gamma))/theta ) * ( (P22P2)^(-mu) * (c2) ) + (1 / (1 + piP2(+1))) * (1 / (1 + piP22(+1)))^(-sigma) * alpha22 * beta * Lam2(+1) * G2^( ((nu * (1 - gamma))/theta) - 1 ) * (Z22(+1)) ;

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Consumption Growth - Not Normalized %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
cg1 = (c1 / c1(-1)) * G1(-1) ;
cg2 = (c2 / c2(-1)) * G2(-1) ;

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% GDP Growth - Not Normalized %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
yg1 = (y1 / y1(-1)) * G1(-1) ;
yg2 = (y2 / y2(-1)) * G2(-1) ;

%%%%%%%%%%%%
% Real SDF %
%%%%%%%%%%%%
rSDF1 = beta * ( ( (c1)/(c1(-1)) )^( ((nu * (1 - gamma))/theta) - 1 ) * ( (1 - (n1))/(1 - (n1(-1))) )^( ((1 - nu) * (1 - gamma))/theta ) * ( (V1)^(1 - gamma)/(U1(-1)) )^(1 - (1/theta)) * G1(-1)^( ((nu * (1 - gamma))/theta) - 1 ) ) ;
rSDF2 = beta * ( ( (c2)/(c2(-1)) )^( ((nu * (1 - gamma))/theta) - 1 ) * ( (1 - (n2))/(1 - (n2(-1))) )^( ((1 - nu) * (1 - gamma))/theta ) * ( (V2)^(1 - gamma)/(U2(-1)) )^(1 - (1/theta)) * G2(-1)^( ((nu * (1 - gamma))/theta) - 1 ) ) ;

%%%%%%%%%%%%%%%
% Nominal SDF %
%%%%%%%%%%%%%%%
nSDF1 = beta * ( ( (c1)/(c1(-1)) )^( ((nu * (1 - gamma))/theta) - 1 ) * ( (1 - (n1))/(1 - (n1(-1))) )^( ((1 - nu) * (1 - gamma))/theta ) * ( (V1)^(1 - gamma)/(U1(-1)) )^(1 - (1/theta)) * (1/(1 + piP1)) * G1(-1)^( ((nu * (1 - gamma))/theta) - 1 ) ) ;
nSDF2 = beta * ( ( (c2)/(c2(-1)) )^( ((nu * (1 - gamma))/theta) - 1 ) * ( (1 - (n2))/(1 - (n2(-1))) )^( ((1 - nu) * (1 - gamma))/theta ) * ( (V2)^(1 - gamma)/(U2(-1)) )^(1 - (1/theta)) * (1/(1 + piP2)) * G2(-1)^( ((nu * (1 - gamma))/theta) - 1 ) ) ;

end;

initval ;    % Steady State

%% From output_CM01_A3_38
exr12   =2.26458547842974e-07;
de12    =1.00000046225341;
cg1     =1;
cg2     =1;
yg1     =1;
yg2     =1;
rSDF1   =0.989944782595193;
rSDF2   =0.990001611718881;
nSDF1   =0.990000583065988;
nSDF2   =0.990001262650934;
w1      =0.900116426856900;
w2      =0.899883517242872;
mc1     =0.900116426856900;
mc2     =0.899883517242872;
c11     =0.222121892458387;
c12     =0.111125624182724;
c21     =0.111004443455164;
c22     =0.222138177106624;
p11P11  =0.999999074561055;
p12P12  =0.999999074561055;
p21P21  =0.999997996006089;
p22P22  =0.999997996006089;
P11P12  =1.00038820533446;
P21P22  =1.00038820562295;
PI1     =0.0333219612802296;
PI2     =0.0333170785381431;
G1      =1;
G2      =1;
Coint12 =0.999549446308293;
y1      =0.333176371919417;
y2      =0.333213733230736;
A1      =1;
A2      =1;
i1      =0.0101004151946507;
i2      =0.0100997218136729;
P11P1   =1.00012939340783;
P12P1   =0.999741288501017;
P21P2   =1.00025879537830;
P22P2   =0.999870639970869;
vp11    =0.999999999969095;
vp22    =1.00000000000916;
vp12    =0.999999999969094;
vp21    =1.00000000000916;
SV1     =-0.000447134387214084;
SV2     =-0.000391385991876135;
U1      =12255902.4755416;
U2      =12301225.2821731;
q12     =0.999870666928126;
c1      =0.333247508273845;
c2      =0.333142612198584;
Lam1    =0.999944224843629;
Lam2    =1.00000162799887;
n1      =0.333176371913569;
n2      =0.333213733229339;
V1      =0.643314144188539;
V2      =0.643249968663858;
X11     =2.11471028042303;
Z11     =2.34937627009119;
X21     =2.11456508942168;
Z21     =2.34891358619990;
X12     =2.11522410918018;
Z12     =2.35085937950984;
X22     =2.11507887634496;
Z22     =2.35039639731417;
piP1    =-3.96604239593469e-07;
piP2    =-8.58858224793406e-07;
piP11   =-3.96604239769262e-07;
piP12   =-3.96604239735732e-07;
piP21   =-8.58858224673227e-07;
piP22   =-8.58858224752525e-07;
x1      =-3.13859470434294e-38;
x2      =-1.85621847412206e-37;
ZZ      =1;


end ;


shocks;

var ea1 = 1 ;
var ea2 = 1 ;
var eg1 = 1 ;
var eg2 = 1 ;
var eSV1 = 1 ;
var eSV2 = 1 ;
var ei1 = 0 ;
var ei2 = 0 ;
var ex1 = 1;
var ex2 = 1;

 corr eg1, eg2 = 0.2037;
 corr ex1, ex2 = .27;
 corr eSV1, eSV2 = 0.0166;

end;


steady(solve_algo=0,maxit=20000);
set_dynare_seed(72085);

stoch_simul(solve_algo=0,order = 3, periods = 1200, nograph) ;
nmark
 
Posts: 7
Joined: Fri Aug 19, 2016 5:31 pm

Re: maxit ignored

Postby jpfeifer » Sun Sep 18, 2016 9:38 am

Which system are you using. I tried both 4.4.3 and the unstable version on Windows with Matlab 2016a and always get
Equation solved, inaccuracy possible.

The vector of function values is near zero, as measured by the selected value
of the function tolerance. However, the last step was ineffective.

<stopping criteria details>
------------
Johannes Pfeifer
University of Cologne
https://sites.google.com/site/pfeiferecon/
jpfeifer
 
Posts: 6940
Joined: Sun Feb 21, 2010 4:02 pm
Location: Cologne, Germany

Re: maxit ignored

Postby nmark » Thu Sep 22, 2016 3:39 pm

dynare 4.4.3 and Matlab R2015b, on MacOS. I will update the Matlab to 2016
nmark
 
Posts: 7
Joined: Fri Aug 19, 2016 5:31 pm


Return to Dynare help

Who is online

Users browsing this forum: Google [Bot] and 6 guests