error: structure has no member 'var'

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.

error: structure has no member 'var'

Postby suw » Wed Jun 16, 2010 11:24 pm

Dynare 4.1.1, RBC with stochastic proces:

i use this code:


for ii=1:10000 //10k simulations

stoch_simul(hp_filter=400, order = 1, periods = 157, drop = 100, nofunctions, nomoments, noprint);


D=oo_.var;
for i=1:6
D(i)=D(i)/(sqrt(oo_.var(i,i))*sqrt(oo_.var(1,1)));
corr_matrix(ii,i)=D(i);
end;


and there is a problem in processing model:


error: structure has no member 'var'


Can you explain me what does it mean? what is wrong?
suw
 
Posts: 2
Joined: Wed Jun 16, 2010 11:17 pm

Re: error: structure has no member 'var'

Postby coot » Thu Jun 17, 2010 3:33 am

it means that structure oo_ doesn't have a field named var
coot
 
Posts: 24
Joined: Tue Apr 20, 2010 10:54 am

Re: error: structure has no member 'var'

Postby suw » Thu Jun 17, 2010 11:57 pm

thanks for help. i've solved this problem, but now i have another one:

error 'corr_matrix' undefined

here is actual version of my code:



%----------------------------------------------------------------
% RBC with stochastic process
%----------------------------------------------------------------

%----------------------------------------------------------------
% 1. Defining variables
%----------------------------------------------------------------

var y c k i l z w r y_l;
varexo e;

parameters alpha rho sigma delta beta psi;




%----------------------------------------------------------------
% 2. Calibration
%----------------------------------------------------------------


alpha = 0.34;
rho = 0.525582752;
sigma = 0.017142889;
delta = 0.06;
beta = 0.96;
psi = 0.666667;



%----------------------------------------------------------------
% 3. Model
%----------------------------------------------------------------

model;

(1/c) = beta*(1/c(+1))*(1+r(+1)-delta);
psi*c/(1-l) = w;
c+i = y;
w = (1-alpha)*(k(-1)^alpha)*((exp(z)*l)^(-alpha));
r = (alpha*k(-1)^(alpha-1))*(exp(z)*l)^(1-alpha);
y = (k(-1)^alpha)*(exp(z)*l)^(1-alpha);
i = k-(1-delta)*k(-1);
z = rho*z(-1)+e;

y_l = y/l;


end;

%----------------------------------------------------------------
% 4. Computation
%----------------------------------------------------------------



initval;

k = 10.625; //było 9
c = 0.53;
l = 0.47;
z = 0;
e = 0;
w = 0.67; // ze wzoru na w od c wychdzi 7200
r = 0;
end;



steady;

check;

shocks;
var e = sigma^2;
end;

stoch_simul (order = 1, periods = 157);
if(0)
for ii=1:10000

stoch_simul(hp_filter=400, order = 1, periods = 157, drop = 100, nofunctions, nomoments);
end;



if(0)
D=oo_.var;
for i=1:8
D(i)=D(i)/(sqrt(oo_.var(i,i))*sqrt(oo_.var(1,1)));
corr_matrix(ii,i)=D(i);
end;
end;

output(ii,1) = std(y)/mean(y);
output(ii,2) = std(c)/mean(c);
output(ii,3) = std(i)/mean(i);
output(ii,4) = std(l)/mean(l);
output(ii,5) = std(k)/mean(k);

end;

disp('correlations: ');
corr_matrix(1,:)'
disp('deviations: ');
100*mean(output)'



anyone know how to solve it? :)
suw
 
Posts: 2
Joined: Wed Jun 16, 2010 11:17 pm

Re: error: structure has no member 'var'

Postby SébastienVillemot » Tue Jun 22, 2010 10:38 am

You need to define corr_matrix before filling its elements, using something like:

Code: Select all
corr_matrix = zeros(no_lines, no_cols);
Sébastien Villemot
Economist at OFCE – Sciences Po
SébastienVillemot
 
Posts: 706
Joined: Fri Dec 07, 2007 2:29 pm
Location: Paris, France


Return to Dynare help

Who is online

Users browsing this forum: No registered users and 9 guests