Error: structure has no member 'var'

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?

it means that structure oo_ doesn’t have a field named var

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? :slight_smile:

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

corr_matrix = zeros(no_lines, no_cols);