Error in dyntable

Excuse me, I encountered an error while running the following program in Dynare. Could you please help me identify the reason?

Dot indexing is not supported for variables of this type.

Error in dyntable (line 35)
if options_.noprint

Error in rbc5.driver (line 249)
dyntable(‘standard deviations in %’,strvcat(‘VARIABLE’,‘REL. S.D.’),M_.endo_names(1:10,:),statistic1,10,8,2);

Error in dynare (line 281)
*** evalin(‘base’,[fname ‘.driver’]);***

The codes are as follows. Thank you very much.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% Basic RBC Model

%(Approximation in logs)

%Compute Solutions for different values of habit parameter

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%----------------------------------------------------------------

% 0. Housekeeping (close all graphic windows)

%----------------------------------------------------------------

%clear all;

close all;

%clear all;

%----------------------------------------------------------------

% 1. Defining variables

%----------------------------------------------------------------

var ly lc lk li lh ly_l lw Rk Rs Rf z lambda;

varexo e;

parameters beta chi delta alpha rho sigma b;

%----------------------------------------------------------------

% 2. Calibration

%----------------------------------------------------------------

%

% U(c,n) = log(c-b*c_(-1)) -chi*log(1-n)

%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

load parameterfile

set_param_value('b',b)

[param,ss] = calibration3(b);

alpha = param(1);

beta = param(2);

delta = param(3);

chi = param(4);

rho = 0.99;

sigma = 0.0089;

%----------------------------------------------------------------

% 3. Model

%----------------------------------------------------------------

model;

//Consumption Euler equation

exp(lambda) = beta*(exp(lambda(+1)))*(alpha*(exp(lk)^(alpha-1))*exp(z(+1))*exp(lh(+1))^(1-alpha)+1-delta);

// Labor supply

chi/(1-exp(lh))/exp(lambda) = exp(lw);

//Labor demand

exp(lw) = exp(z)*(1-alpha)*exp(lk(-1))^alpha*exp(lh)^(-alpha);

//Resource constraint

exp(lc)+exp(li) = exp(ly);

//Production function

exp(ly) = exp(z)*(exp(lk(-1))^alpha)*(exp(lh))^(1-alpha);

//Capital accumulation equation

exp(li) = exp(lk)-(1-delta)*exp(lk(-1));

//Labor productivity

exp(ly_l) = exp(ly)/exp(lh);

//Stock return

exp(Rs) = alpha*exp(ly)/exp(lk(-1))+1-delta;

//Capital rental rate

exp(Rk) = alpha*exp(ly)/exp(lk(-1));

//Riskfree rate

exp(lambda) = beta*exp(lambda(+1))*exp(Rf);

//TFP shock

z = rho*z(-1)+e;

//Marginal utility of consumption

exp(lambda) = 1/(exp(lc)-b*exp(lc(-1)))-beta*b/(exp(lc(+1))-b*exp(lc));

end;

%----------------------------------------------------------------

% 4. Computation

%----------------------------------------------------------------

initval;

lk = log(ss(1));

lc = log(ss(2));

lh = log(ss(3));

li = log(ss(4));

ly = log(ss(5));

lw=log(ss(6));

Rk=log(ss(7));

Rs=log(ss(8));

Rf=log(ss(9));

ly_l = ly-lh;

z = 0;

lambda=log(ss(10));

end;

shocks;

var e = sigma^2;

end;

steady;

check;

stoch_simul(hp_filter = 1600, order = 1);

%----------------------------------------------------------------

% 5. Some Results

%----------------------------------------------------------------

statistic1 = 100*sqrt(diag(oo_.var(1:10,1:10)));

dyntable('standard deviations in %',strvcat('VARIABLE','REL. S.D.'),M_.endo_names(1:10,:),statistic1,10,8,2);

statistic2 = sqrt(diag(oo_.var(1:10,1:10)))/sqrt(diag(oo_.var(1,1)));

dyntable('Relative standard deviations in %',strvcat('VARIABLE','REL. S.D.'),M_.endo_names(1:10,:),statistic2,10,8,2);

You did not provide the parameterfile you are loading. Also, which Dynare version are you using?

I really appreciate your help. I am a beginner in Dynare and My Dynare version is 5.5. Here is the parameterfile. But this file seems to be generated by Dynare.
parameterfile.mat (171 Bytes)

Now calibration3 is missing.

Here is calibration3

function [param,SS] = calibration3(x)

b=x;

alpha=0.33;

beta=0.99;

delta =0.025;

N=0.33;

KoverN = (alpha/(1/beta-1+delta))^(1/(1-alpha));

N=1/3;

Y = (KoverN)^alpha*N;

I = delta*KoverN*N;

K = KoverN*N;

C = Y-I;

lambda = (1-beta*b)/((1-b)*C);

w = (1-alpha)*K^alpha*N^(-alpha);

chi = w*(1-N)*lambda; %for KPR4

Rk = alpha*Y/K;

Rs = Rk+1-delta

Rf = 1/beta;

param = [alpha, beta, delta, chi];

SS = [K,C,N,I,Y,w, Rk,Rs,Rf,lambda];

Use

statistic1 = 100*sqrt(diag(oo_.var(1:10,1:10)));

dyntable(options_,'standard deviations in %',{'VARIABLE';'REL. S.D.'},M_.endo_names(1:10,:),statistic1,10,8,2);

statistic2 = sqrt(diag(oo_.var(1:10,1:10)))/sqrt(diag(oo_.var(1,1)));

dyntable(options_,'Relative standard deviations in %',{'VARIABLE';'REL. S.D.'},M_.endo_names(1:10,:),statistic2,10,8,2);


Thank you very much, the code is now running! You are truly talented and enthusiastic.

By the way, would you mind telling me how to find the solution by myself? I tried to search “dyntable” in the manual, but I cannot find the word.

It’s not a user-facing function. You have to open the .m-file and check the syntax.

Many thanks! :smile: