[R] BRugs crash, question

Jack Tanner ihok at hotmail.com
Wed Apr 4 19:33:21 CEST 2012


Bob O'Hara <rni.boh <at> gmail.com> writes:

> 
> On 4 April 2012 05:35, Jack Tanner <ihok <at> hotmail.com> wrote:
> 
> > samplesBgr("beta") # crash
> > samplesBgr("beta", plot=FALSE) # also crash
> >
> > Have you plotted your histories? I haven't used samplesBgr() much, so I
> don't know how stable it is (although I do know it's slow).

Yes, plotting histories, densities works fine. Above, beta was an array of
parameters; plotBgr of a singleton parameter also crashes.

> samplesStats() calls internal OpenBUGS functions (not R functions), so
> that would mean saving the whole BUGS run (like externalise in OpenBUGS
> itself. From you code fit$Stats should give you the same as
> sampleStats('*'): if you want more use BRugsFit(..., coda=T) and work with
> the coda object it produces (check the documentation for BRugsFit and coda).

I thought about that, but that's not good either. fit$Stats doesn't have
parameter names attached. Is there a way to figure out where in
fit$Stats[,"mean"], say, beta ends and theta begins? They seem to be in
arbitrary order, as below.

The downside to BrugsFit(..., coda=TRUE) is that you don't get DIC (even if you
also pass DIC=TRUE).

> str(fit)
List of 3
 $ Stats:'data.frame':  194 obs. of  8 variables:
  ..$ mean     : num [1:194] 0.536 0.552 0.037 0.33 0.327 ...
  ..$ sd       : num [1:194] 0.4505 0.214 0.1398 0.0789 0.3183 ...
  ..$ MC_error : num [1:194] 0.02775 0.011 0.00696 0.00346 0.02071 ...
  ..$ val2.5pc : num [1:194] -0.341 0.16 -0.215 0.179 -0.291 ...
  ..$ median   : num [1:194] 0.5238 0.5409 0.0331 0.3279 0.3227 ...
  ..$ val97.5pc: num [1:194] 1.429 1.043 0.327 0.488 0.974 ...
  ..$ start    : int [1:194] 1001 1001 1001 1001 1001 1001 1001 1001 1001 1001 ...
  ..$ sample   : int [1:194] 750 750 750 750 750 750 750 750 750 750 ...
 $ DIC  :'data.frame':  3 obs. of  4 variables:
  ..$ Dbar: num [1:3] 8.94 1661 1670
  ..$ Dhat: num [1:3] 17.2 1556 1573
  ..$ DIC : num [1:3] 0.686 1766 1767
  ..$ pD  : num [1:3] -8.26 105.3 97.01



More information about the R-help mailing list