xfim / ggmcmc

Graphical tools for analyzing Markov Chain Monte Carlo simulations from Bayesian inference
111 stars 31 forks source link

ggs() do not recognize objects of class greta_mcmc_list #75

Closed johnaponte closed 2 years ago

johnaponte commented 2 years ago

Hi, I'm trying to use ggmcmc to plot the chains fitted using Greta, but the ggs function does not recognize objects of the class greta_mcmc_list.

> class(latent_sim)
[1] "greta_mcmc_list" "mcmc.list"      
> ggs(latent_sim)
Error in ggs(latent_sim) : 
  ggs is not able to transform the input object into a ggs object suitable for ggmcmc.

if the class of the object is changed to mcmc.list alone ggs works fine. Thanks

xfim commented 2 years ago

Thank you for reporting this, @johnaponte . Let me see what is the best way to solve it.

xfim commented 2 years ago

@johnaponte , could you please check if commit 61c1a65 has solved the issue? Remember that you need to try with the development version:

devtools::install_github("xfim/ggmcmc")

It is only a very simple fix, simply assuming that "greta_mcmc_list" is indeed just as another simple "mcmc.list" object, which is something I can't test myself, for I need a working version of Greta myself, which I don't have working at the moment.

If it is fixed, you can close the issue yourself.

Thank you.

johnaponte commented 2 years ago

@xfim Hi, the modification works but it produces a lot of warnings every time a class(S)== is executed as the S object in this case have more than one class. I proposed a change to inherits(S,...) instead. Please review the proposed fork. I only have installed rjags and Greta so I can't test the other classes. Thanks JJ

xfim commented 2 years ago

Thanks to @johnaponte , PR #77 solves the issue.