Search code examples
regexrggplot2bayesianinference

modifying the family parameter in ggmcmc plots


I am using BUGS software through R for doing bayesian analysis and i utilize ggmcmc package for bayesian inference.

In my recent example i have a whole matrix b of parameters under monitor, with dimensions 5x8. Now if i use straight ahead a plot from the ggmcmc package, the parameters are so many that i cant see a thing in the output posterior plot.

e.g. ggs_histogram

enter image description here

Now plot functions in ggmcmc have a parameter called family and you use this to select a subset of parameters to include in the plot. In the official package page it says that you have to set family equal to a regular expression that matches the parameters you want and its quite easy if you have let's say parameters a,b and you want to plot b(family='b').

Now i want from the b matrix that i mentioned to plot only one column elements , for example b[1,1],b[2,1],b[3,1],...,b[8,1]

So i tried to subset this the usual way ,like family='b[,1]'.

Error in seq.default(mn, mx, by = bw) :

'from' cannot be NA, NaN or infinite

In addition: Warning messages:

1: In min(x) : no non-missing arguments to min; returning Inf

2: In max(x) : no non-missing arguments to max; returning -Inf

Any ideas? Maybe a correct regexp or a ggplot facet_grid dribble?


Solution

  • Eventually, the ggmcmc package official pdf document had all the info i was looking for. I was right about the need of a regular expression and the tutorial of the package was pretty informative about the form the regular expression is expected to have.

    So if i wanted let's say to infer about the elements of the first column of the parameters matrix,

    family='b\\[.,1\\]'
    

    would do the job just fine. This works on any of the inference functions of ggmcmc package.