Error "Index exceeds matrix dimensions."

Dear Forum and Pfeifer,

I’m replicating the results in AER2016 “Sticky Leverage.” The codes are attached.

I want to replicate Table 2, When I run the “SLMRdynareGEE_AER.m”, as indicated by the author. I encountered below errors.

> Index exceeds matrix dimensions.
> 
> Error in SLMRdynareGEE_AER (line 323)
> disp([M_.endo_names(4,:) num2str(sdout(4),3)     '   '  num2str(oo_.gamma_y{1,2}(4,2),2) ])

I need to fix it in order to replicate further results. Pls help!

Many Thanks in advance!
Amydataset_StickyLeverage.zip (402.0 KB)

I can run the code. Did you put Dynare 4.4.3 in c:\dynare\4.4.3\matlab?

Dear Jpfeifer,

My dynare is installed at another dictory(F), but I actually had change the code:

addpath F:\dynare\4.5.1\matlab.

Still, the error occurred. Would it be sth wrong about my matlab or ?

I will appreciate any of your futher help.

Amy

Dear Jpfeifer,

I just read the code and see the result file carefully.

I figure out that there must be sth different between the results that I run out using Dynare 4.5.1 and your result. In my case, the result in oo_.gamma_y is a 2*1 array, so the code num2str(oo_.gamma_y**{1,2}**(4,2),2) ] wont run nomally. If i change it into num2str(oo_.gamma_y**{1,1}**(4,2),2) ], it runs normally.

Why would this happen? How can I fully replicate their results by using my current dynare?
I attached the result file I generated here.SLMR_results.mat (44.5 KB)

In Dynare 4.5, oo_.gamma_y became a column vector instead of a row vector. Simply use linear indexing, i.e. delete the first redundant dimension. So when it says

oo_.gamma_y{1,2}

use

oo_.gamma_y{2}

Yeah, Thank You so much!