jmaih / RISE_toolbox

Solution and estimation of Markov Switching Rational Expectations / DSGE Models
BSD 3-Clause "New" or "Revised" License
103 stars 76 forks source link

Error in ploting posterior results #145

Closed eleonoraoliveira closed 4 years ago

eleonoraoliveira commented 4 years ago

Hi, Junior! I hope you are doing well

I'm having a problem to plot the posterior results simulations. I've already tried the solutions discussed on issues #104 and #105.

In fact, my script is very similar with the one in issue #104, as I also used the example of Tao Zha to elaborate my script (attached).

When I try to plot, the same error message appears:

plot_posteriors(estim_models{imod},Results{imod}) Error using ksdensity>parse_args (line 186) Invalid parameter name: NumPoints.

Error in ksdensity (line 114) [axarg,yData,n,ymin,ymax,xispecified,xi,u,m,kernelname,...

Error in C:\Users\Eleonora\Documents\GitHub\RISE_toolbox\m+distributions\kernel_density.p>kernel_density (line 65)

Error in C:\Users\Eleonora\Documents\GitHub\RISE_toolbox\classes\models\@generic\plot_posteriors.p>plot_posteriors/do_one_post (line 286)

Error in C:\Users\Eleonora\Documents\GitHub\RISE_toolbox\classes\models\@generic\plot_posteriors.p>plot_posteriors (line 243)

I've already tried various alternatives ways, like: >> plot_posteriors(estim_models{imod},Results{imod}.pop.x), but then the following error appears:

plot_posteriors(estim_models{imod},Results{imod}.pop.x) Cell contents reference from a non-cell array object.

Error in C:\Users\Eleonora\Documents\GitHub\RISE_toolbox\classes\utils\@mcmc\reload_draws.p>reload_draws/load_from_self (line 78)

Error in C:\Users\Eleonora\Documents\GitHub\RISE_toolbox\classes\utils\@mcmc\reload_draws.p>reload_draws (line 35)

Error in C:\Users\Eleonora\Documents\GitHub\RISE_toolbox\classes\models\@generic\plot_posteriors.p>plot_posteriors (line 171)

But when I call Results{1,1}.pop.x, I get my values corresponding with my draws.. My guess is that Results{1, 1}.pop <1x10000 struct> needed to be n_parameters x n_draws, rigth?

Do you know how could I corrected with?

Best regards,

Eleonora.

Eleonora.zip

jmaih commented 4 years ago

Hi Eleonora,

If you type which ksdensity you will see which ksdensity function is used. I suspect on your matlab search path there is a function with the same name and that is not the function that RISE expects to use.

RISE uses the ksdensity function from Matlab.

Cheers,

J.