SVD problem
Posted: Tue Sep 01, 2009 7:18 am
Please, I need help with the following error message:
??? Error using ==> svd
Input to SVD must not contain NaN or Inf.
Error in ==> cond at 40
s = svd(A);
Error in ==> solve1 at 117
elseif cond(fjac) > 1/sqrt(eps)
Error in ==> dynare_solve at 110
[x,info]=solve1(func,x,j1(r(i):r(i+1)-1),j2(r(i):r(i+1)-1),jacobian_flag,varargin{:});
Error in ==> steady_ at 69
[oo_.steady_state,check] = dynare_solve([M_.fname '_static'],...
Error in ==> steady at 52
steady_;
Error in ==> r_h at 193
steady;
Error in ==> dynare at 102
evalin('base',fname) ;
Here is my code:
// stochastic model
//endogenous variables
var k1 k2 k c h h1 h2 alpha_k alpha_h Delta eta y i r w lambda z1 z2 B1 pp
k1_k h1_h k_h;
//exogenous variables
varexo e1, e2;
//model´s parameters
parameters beta delta theta phi omega Bh rho1 rho2 gamma sigma1 sigma2;
beta = 0.991;
delta = 0.025;
theta = 0.360;
phi = 0.975;
omega = 0.0015;
Bh = 2.860;
rho1 = 0.950;
rho2 = 0.950;
gamma = 0.000;
sigma1 = 0.00712;
sigma2 = 0.00712;
// model equations:
model;
h = h1+h2;
k = k1+k2;
alpha_k = k1/k;
alpha_h = h1/h;
pp = omega*(lambda^2)/4;
eta = alpha_k*omega*(lambda/2);
Delta = z1*alpha_k^theta*alpha_h^(1-theta)*(1-theta*pp)
+ z2*(1-alpha_k)^(theta)*(1-alpha_h)^(1-theta)*phi;
y = k^theta*h^(1-theta)*Delta - k*eta;
i= k-(1-delta)*k(-1);
c+i = y;
c = w*h+r*k-i;
w = Bh*c;
(1/c) = beta*(1/c(+1))*(r(+1)+1-delta);
B1 = omega/(2-lambda*(1+omega));
B1*(1-lambda/2) = omega*((1+lambda*B1)/2);
r = B1*(1 - (lambda^2)*(omega/4)) - lambda*(omega/2) + theta*phi*k2^(theta-1)*h2^(1-theta);
lambda = 2*sqrt(((phi*z2)/((1+omega)*z1))*(h2/h1)^(1-theta));
w = (1-theta)*z2*k2^theta*h2^(-theta);
k1 = ((omega/((2-lambda*(1+omega))*theta*z1))^(1/(theta-1)))*h1;
z1 = rho1*z1(-1)+e1;
z2 = rho2*z2(-1)+e2;
k1_k = k1/k;
k_h = k/h;
end;
// initial values or guesses/
initval;
y = 1.1;
B1 = 1;
k = 11.487;
k1 = 5.6;
k2 = 5.6;
k1_k = 0.4895;
h1=0.1246;
h2=0.18;
h = 0.3046;
k_h =37.7;
c = 0.8155;
i = 0.2872;
w = 2;
r = 0.03;
lambda=1.5;
z1 = 1;
z2 = 1;
e1 = 0;
e2 = 0;
end;
/* adding steady will take initval as guesses, then
approximate steady s.s. and do simulations thereafter */
steady;
solve_algo = 0;
// performs check: # eigenvalues >1 = # exogenous variables
check;
/* introducing shocks: adds shock ´´e´´ with variance equals
to sigma^2 */
shocks;
var e1 = sigma1^2;
var e2 = sigma2^2;
end;
// simulation: stochastic
stoch_simul(periods=2100);
??? Error using ==> svd
Input to SVD must not contain NaN or Inf.
Error in ==> cond at 40
s = svd(A);
Error in ==> solve1 at 117
elseif cond(fjac) > 1/sqrt(eps)
Error in ==> dynare_solve at 110
[x,info]=solve1(func,x,j1(r(i):r(i+1)-1),j2(r(i):r(i+1)-1),jacobian_flag,varargin{:});
Error in ==> steady_ at 69
[oo_.steady_state,check] = dynare_solve([M_.fname '_static'],...
Error in ==> steady at 52
steady_;
Error in ==> r_h at 193
steady;
Error in ==> dynare at 102
evalin('base',fname) ;
Here is my code:
// stochastic model
//endogenous variables
var k1 k2 k c h h1 h2 alpha_k alpha_h Delta eta y i r w lambda z1 z2 B1 pp
k1_k h1_h k_h;
//exogenous variables
varexo e1, e2;
//model´s parameters
parameters beta delta theta phi omega Bh rho1 rho2 gamma sigma1 sigma2;
beta = 0.991;
delta = 0.025;
theta = 0.360;
phi = 0.975;
omega = 0.0015;
Bh = 2.860;
rho1 = 0.950;
rho2 = 0.950;
gamma = 0.000;
sigma1 = 0.00712;
sigma2 = 0.00712;
// model equations:
model;
h = h1+h2;
k = k1+k2;
alpha_k = k1/k;
alpha_h = h1/h;
pp = omega*(lambda^2)/4;
eta = alpha_k*omega*(lambda/2);
Delta = z1*alpha_k^theta*alpha_h^(1-theta)*(1-theta*pp)
+ z2*(1-alpha_k)^(theta)*(1-alpha_h)^(1-theta)*phi;
y = k^theta*h^(1-theta)*Delta - k*eta;
i= k-(1-delta)*k(-1);
c+i = y;
c = w*h+r*k-i;
w = Bh*c;
(1/c) = beta*(1/c(+1))*(r(+1)+1-delta);
B1 = omega/(2-lambda*(1+omega));
B1*(1-lambda/2) = omega*((1+lambda*B1)/2);
r = B1*(1 - (lambda^2)*(omega/4)) - lambda*(omega/2) + theta*phi*k2^(theta-1)*h2^(1-theta);
lambda = 2*sqrt(((phi*z2)/((1+omega)*z1))*(h2/h1)^(1-theta));
w = (1-theta)*z2*k2^theta*h2^(-theta);
k1 = ((omega/((2-lambda*(1+omega))*theta*z1))^(1/(theta-1)))*h1;
z1 = rho1*z1(-1)+e1;
z2 = rho2*z2(-1)+e2;
k1_k = k1/k;
k_h = k/h;
end;
// initial values or guesses/
initval;
y = 1.1;
B1 = 1;
k = 11.487;
k1 = 5.6;
k2 = 5.6;
k1_k = 0.4895;
h1=0.1246;
h2=0.18;
h = 0.3046;
k_h =37.7;
c = 0.8155;
i = 0.2872;
w = 2;
r = 0.03;
lambda=1.5;
z1 = 1;
z2 = 1;
e1 = 0;
e2 = 0;
end;
/* adding steady will take initval as guesses, then
approximate steady s.s. and do simulations thereafter */
steady;
solve_algo = 0;
// performs check: # eigenvalues >1 = # exogenous variables
check;
/* introducing shocks: adds shock ´´e´´ with variance equals
to sigma^2 */
shocks;
var e1 = sigma1^2;
var e2 = sigma2^2;
end;
// simulation: stochastic
stoch_simul(periods=2100);