xfim / ggmcmc

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

problem with ggs() #66

Closed KT0710 closed 5 years ago

KT0710 commented 5 years ago

Hi, I'm having problems trying to make the ggs() function select a "family", with ggs() returning "Error in S[[1]] : this S4 class is not subsettable". This error does not occur when family=NA, and also does not occur for mcmc.list objects (confirmed using the radon dataset). I'm using R 3.5.3, the newest ggmcmc and rstan package (downloaded today) under a windows 10 64 bit environment.

Below is a reproducible example using the 8school example from the Rstan "getting started" page.

// saved as test.stan data { int J; // number of schools real y[J]; // estimated treatment effects real sigma[J]; // standard error of effect estimates } parameters { real mu; // population treatment effect real tau; // standard deviation in treatment effects vector[J] eta; // unscaled deviation from mu by school } transformed parameters { vector[J] theta = mu + tau * eta; // school treatment effects } model { target += normal_lpdf(eta | 0, 1); // prior log-density target += normal_lpdf(y | theta, sigma); // log-likelihood }

// data schools_dat <- list(J = 8, y = c(28, 8, -3, 7, -1, 1, 18, 12), sigma = c(15, 10, 16, 11, 9, 11, 10, 18))

// stan and ggmcmc code library(rstan) fit <- stan(file = 'test.stan', data = schools_dat)

library(ggmcmc) ggs(fit, family="mu")

xfim commented 5 years ago

Dear @KT0710 ,

Thank you very much for your input.

I have solved the issue with commit 6c81d22177c5b43654bf0ebc1827ec80af84cf06, and now it should work again. It was related to the management of families using stan objects.

Thank you very much again for reporting it.

KT0710 commented 5 years ago

Dear Mr. Marin,

Thank you! I'm in the field right now, but I'll check the patch and report back as soon as possible.

Kohsuke Tanigawa

2019年6月10日(月) 18:17 Xavier Fernández i Marín notifications@github.com:

Dear @KT0710 https://github.com/KT0710 ,

Thank you very much for your input.

I have solved the issue with commit 6c81d22 https://github.com/xfim/ggmcmc/commit/6c81d22177c5b43654bf0ebc1827ec80af84cf06, and now it should work again. It was related to the management of families using stan objects.

Thank you very much again for reporting it.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/xfim/ggmcmc/issues/66?email_source=notifications&email_token=AMHAWYAP3HPOTB4VXN2O7G3PZYL3DA5CNFSM4HR7NVL2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODXJLUYI#issuecomment-500349537, or mute the thread https://github.com/notifications/unsubscribe-auth/AMHAWYCOKEHO4H4JV4ZBDJDPZYL3DANCNFSM4HR7NVLQ .