I have successfully run my model with 7 shocks: productivity shocks, three tax rate shocks, two government spending shocks and monetary policy rate shock (interest rate shock in Taylor rule).

The data sample available is very scanty. I have annual data for 18 years on GDP, government spending (consumption and capital expenditure), interest rate, debt … as many as I have shocks or exogenous variables in my model. I would like to know whether it is possible to perform the parameter estimation using a very small sample with annual data.

# Performing an estimation of parameters using real data

**DJINKPO**#1

**jpfeifer**#2

That is not ideal, but doable. The prior distribution will msot probably play an important role in this case, i.e. the data will not be very informative.

**DJINKPO**#3

Hi Professor,

Given that the sample size is very short, is it possible to apply filtering method to detrend some observable variables such as GDP and government spending in other to perform the estimation?

**jpfeifer**#4

Why do you want to use a filter? First differences would be a filter you can use or a deterministic linear of quadratic trend.

**DJINKPO**#5

Hi!

I did try to perform the estimation of the parameter using the very short sample of data I have on the observables in first difference. I saved the data set and run the code but it can’t read the name of the variable as stated in the code. Here is the error message I got:

Error using load_mat_file_data_legacy (line 30)

makedataset: The variable(s) y, pi, gc, gi, s, d, r listed in varobs are not contained in the dataset

I don’t understand how come the code can read the variables’ names though I ave written them in the excel sheet and save as Matlab file for the code to read the variable names.

Could you provide me with a hint on how I could solve that issue?

**jpfeifer**#8

The `data12.mat`

contains a bunch of Dynare structures, but no data. Load it into Matlab to see this.

**DJINKPO**#9

Hi!

Perhaps I did not save it on Matlab in appropriate way. I tried to use the spreadsheet format (Excel) but not successful. could you assist me in that? How to specify the excel data file.

**DJINKPO**#11

I entered the code as follows:

*estimation(datafile=‘data1.xls’, xls_sheet=data, xls_range=A2:G18)*

Here is the error message I got

*You did not declare endogenous variables after the estimation/calib_smoother command.*

*Error using dseries/extract (line 61)*

*dseries::extract: Variable y is not a member of A!*

*Error in dseries/subsref (line 236)*

**_ B = extract(A,S(1).subs{:});_**

And other error message

It looks like the code cannot read the data from the data set I declare.

**DJINKPO**#13

Hi professor,

I can’t attach Excel file to the post. Therefore, compressed the file in order to attach it the messagedata1.zip (7.5 KB)

Something wrong with forecasting

**DJINKPO**#15

Hello Professor,

I included the variable naùes as recommended. However, the code could not perform the estimation and the following message does appear when I run the code.

*Error using initial_estimation_checks (line 143)*

*initial_estimation_checks:: The forecast error variance in the multivariate Kalman filter became*

*singular.*

*Error in initial_estimation_checks (line 143)*

**_ error('initial_estimation_checks:: The forecast error variance in the multivariate Kalman_**

**_ filter became singular.’)_**

I don’t really know why.

**jpfeifer**#16

That means that your model implies an exact linear combination between at least two of the observables. That is a fundamental problem. My guess is that

`s=d/y;`

causes the problem as you observe all three and this restriction will not hold in the data.

**DJINKPO**#17

Hi professor,

After deleting this variable (s) from the observables and using only y, pi, d and r as observables, I still encounter the same issue of error message. The code can only generate the prior distribution but cannot go further to generate the posterior distribution and parameters means. I am really confused and can’t find a solution for that. Though it is more interesting to take my model to the data and find out how best it maps the real data. That is the main challenge I have for my paper. See the error message below:

Error using checkArgsForHandleToPrint

Handle input argument contains nonhandle values.

Error in checkArgsForHandleToPrint

Error in print>LocalCreatePrintJob (line 97)

handles = checkArgsForHandleToPrint(0, varargin{:});

Error in print (line 38)

[pj, inputargs] = LocalCreatePrintJob(varargin{:});

Error in dyn_saveas (line 42)

print(h,’-depsc2’,[fname,’.eps’])

Error in plot_priors (line 73)

dyn_saveas(hplt,[M_.fname '*Priors’ int2str(plt)],options*.nodisplay,options_.graph_format);

Error in dynare_estimation_init (line 323)

plot_priors(bayestopt_,M_,estim_params_,options_)

Error in dynare_estimation_1 (line 116)

dynare_estimation_init(var_list_, dname, [], M_, options_, oo_, estim_params_, bayestopt_);

Error in dynare_estimation (line 105)

dynare_estimation_1(var_list,dname);

Error in Med902e (line 343)

oo_recursive_=dynare_estimation(var_list_);

Error in dynare (line 223)

evalin(‘base’,fname) ;

**DJINKPO**#19

HI Professor,

Following your hint, I tried to perform the estimation using only GDP (y) as observable. I observed that it works somewhat. But it could not show the posterior distribution graph because of some error message. I got an output from the estimate which I retrieved in a file to share it with you. I think this might provide more insight on the challenge I am facing.output1.zip (2.6 KB)

The prior graph are plotted but nothing appears on the screen regarding the posterior distribution.

Thanks

**jpfeifer**#20

There is still something wrong.

Initial value of the log posterior (or likelihood): -99440891490.6431

indicates that there is a problem for the initial parameter values. The big number is due to an error code. Are you using Dynare 4.5?