xfim / ggmcmc

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

Error using ggs() #46

Closed brianstock closed 9 years ago

brianstock commented 9 years ago

Hi Xavier,

I'm writing an R package that uses your ggmcmc routine to create MCMC output plots from JAGS. It's been working very nicely until today, when I made some changes. Now when I call ggs() on my mcmc.list object, I get the following error:

> ggmcmc(ggs(jags1.mcmc),file="diagnostics.pdf")
Error in eval(expr, envir, enclos) : object 'Parameter' not found

I've tried supplying ggs() with par_labels from varnames(jags1.mcmc), but that didn't help. Any idea what the problem could be? I can send my R workspace if that would help.

Thanks, Brian

xfim commented 9 years ago

Brian Stock vas escriure el dia dl, 26 oct 2015:

Hi Xavier,

I'm writing an R package that uses your ggmcmc routine to create MCMC output plots from JAGS. It's been working very nicely until today, when I made some changes. Now when I call ggs() on my mcmc.list object, I get the following error:

> ggmcmc(ggs(jags1.mcmc),file="diagnostics.pdf")
Error in eval(expr, envir, enclos) : object 'Parameter' not found

I've tried supplying ggs() with par_labels from varnames(jags1.mcmc), but that didn't help. Any idea what the problem could be? I can send my R workspace if that would help.

Dear Brian,

Many thanks to use ggmcmc and to report any issue.

First of all, have you updated ggmcmc (or dplyr, or tidyr) between the last time that it worked and today?

Second, it would be really nice to have either your workspace or at least the "jags1.mcmc" object to debug it.

brianstock commented 9 years ago

No, I haven't updated ggmcmc, dplyr, or tidyr since it worked last. I have updated JAGS (from 3.4 to 4.0) and rjags (to 4-3) recently.

I can send you the workspace with jags1.mcmc object. What's your email?

Here is the output of sessionInfo():

> sessionInfo()
R version 3.2.2 (2015-08-14)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 14.04.3 LTS

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C              
 [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8    
 [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8   
 [7] LC_PAPER=en_US.UTF-8       LC_NAME=C                 
 [9] LC_ADDRESS=C               LC_TELEPHONE=C            
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
 [1] splancs_2.01-37     sp_1.1-0            ggmcmc_0.7.2       
 [4] GGally_0.5.0        tidyr_0.2.0         dplyr_0.4.3        
 [7] compositions_1.40-1 bayesm_2.2-5        energy_1.6.2       
[10] robustbase_0.92-3   tensorA_0.36        lattice_0.20-33    
[13] reshape_0.8.5       RColorBrewer_1.1-2  MASS_7.3-44        
[16] R2jags_0.5-7        rjags_4-3           coda_0.18-1        
[19] ggplot2_1.0.1      

loaded via a namespace (and not attached):
 [1] Rcpp_0.11.6      DEoptimR_1.0-2   plyr_1.8.2       tools_3.2.2     
 [5] boot_1.3-17      digest_0.6.8     gtable_0.1.2     DBI_0.3.1       
 [9] parallel_3.2.2   proto_0.3-10     stringr_1.0.0    grid_3.2.2      
[13] R6_2.1.1         reshape2_1.4.1   magrittr_1.5     scales_0.2.4    
[17] R2WinBUGS_2.1-19 abind_1.4-3      assertthat_0.1   colorspace_1.2-6
[21] labeling_0.3     stringi_0.4-1    lazyeval_0.1.10  munsell_0.4.2 
xfim commented 9 years ago

Brian Stock vas escriure el dia dt, 27 oct 2015:

No, I haven't updated ggmcmc, dplyr, or tidyr since it worked last. I have updated JAGS (from 3.4 to 4.0) and rjags (to 4-3) recently.

OK, this is a clue.

I can send you the workspace with jags1.mcmc object. What's your email?

Check my profile: https://github.com/xfim

brianstock commented 9 years ago

Hi again Xavier,

I just checked again before emailing you my workspace, and I found that the error does NOT occur if I run:

require(ggmcmc)
ggmcmc(ggs(jags1.mcmc))

It DOES occur when I load all the other packages my code depends on first, loading ggmcmc last:

require(ggplot2)
require(R2jags)
require(MASS)
require(RColorBrewer)
require(reshape)
require(lattice)
require(compositions)
require(ggmcmc)
ggmcmc(ggs(jags1.mcmc))
xfim commented 9 years ago

I am not able to reproduce the problem using the two examples that you provide. Both run fine for me. However, from your sessionInfo() I can see that we are using two different versions of tidyr (I am using tidyr_0.3.1).

So if after updating to tidyr_0.3.1 you still have the problem, please send me the workspace so that I can take a look at the concrete object that is causing trouble. If it solves the problem, then I will update the requirements to use a tidyr version greater than 0.2.

In any case, thank you for your patience.

brianstock commented 9 years ago

Ah, thanks for catching that! I updated all my packages and no longer get an error calling ggs(). I do get the warning message you've already posted (https://github.com/xfim/ggmcmc/issues/45). Updated sessionInfo() output:

R version 3.2.2 (2015-08-14)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 14.04.3 LTS

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C              
 [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8    
 [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8   
 [7] LC_PAPER=en_US.UTF-8       LC_NAME=C                 
 [9] LC_ADDRESS=C               LC_TELEPHONE=C            
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
 [1] splancs_2.01-38     sp_1.2-1            ggmcmc_0.7.2       
 [4] GGally_0.5.0        tidyr_0.3.1         dplyr_0.4.3        
 [7] compositions_1.40-1 bayesm_3.0-2        energy_1.6.2       
[10] robustbase_0.92-5   tensorA_0.36        lattice_0.20-33    
[13] reshape_0.8.5       RColorBrewer_1.1-2  MASS_7.3-44        
[16] R2jags_0.5-7        rjags_4-4           coda_0.18-1        
[19] ggplot2_1.0.1      

loaded via a namespace (and not attached):
 [1] Rcpp_0.12.1      DEoptimR_1.0-4   plyr_1.8.3       tools_3.2.2     
 [5] boot_1.3-17      digest_0.6.8     gtable_0.1.2     DBI_0.3.1       
 [9] parallel_3.2.2   proto_0.3-10     stringr_1.0.0    grid_3.2.2      
[13] R6_2.1.1         reshape2_1.4.1   magrittr_1.5     scales_0.3.0    
[17] R2WinBUGS_2.1-21 abind_1.4-3      assertthat_0.1   colorspace_1.2-6
[21] labeling_0.3     stringi_1.0-1    lazyeval_0.1.10  munsell_0.4.2   
xfim commented 9 years ago

Perfect. I've updated the dependencies to add tidyr's specific version (75269333fc6). As for the warning, it is something related to ggplot2. I am planning to look at it when doing a major revision. Thank you again for reporting the problem and your patience.