BayesianTools icon indicating copy to clipboard operation
BayesianTools copied to clipboard

summary() should return a list with useful values

Open florianhartig opened this issue 5 years ago • 4 comments

currently, summary() returns the correlation matrix of the parameters, would be more sensible to return a list with all summary statistics calculated

florianhartig avatar Nov 09 '18 15:11 florianhartig

As far as i can see, the summary.mcmc ( https://github.com/florianhartig/BayesianTools/blob/7a310be799925a5985f5671ea1b213f7f6802cef/BayesianTools/R/classMcmcSampler.R#L118 ) prints : Type of MCMC sampler, Nr. Chains, Iterations per chain ,Rejection rate, Effective sample size, Runtime, Parameters( MAP 2.5% median 97.5% ), DIC, Gelman Rubin multivariate psrf and the corrleation matrix.

Should i turn this into a List?

JohannesOberpriller avatar Jan 23 '19 16:01 JohannesOberpriller

yes, I think this would be good, returning all essential parameters as a list. You could additionally return things that are not printed. Have a look at how other important classes handle this, for example summary.lm for an lm

florianhartig avatar Jan 23 '19 16:01 florianhartig

Johannes, did you do this?

florianhartig avatar Feb 22 '19 13:02 florianhartig

Actually, working on https://github.com/florianhartig/BayesianTools/issues/166, I just saw that this looks more complicated as I thought.

The summary() function is not very well structured, in particular that it has very similar code for mcmc and mcmc.list, which would have better called the same code.

I wonder if it would be better to rewrite this function, in a way what we

  1. first extract the neccessary info into a standardized list
  2. then print this
  3. return this list

In this way, it would also be easier to re-use summary for the SMC samplers, which currently don't have a proper summary function

florianhartig avatar Feb 22 '19 14:02 florianhartig