run RStan's R-hat and n_eff on R2jags (coda) fit?

47 views
Skip to first unread message

Bob Carpenter

unread,
May 20, 2015, 11:03:25 AM5/20/15
to stan-...@googlegroups.com
I'm trying to do some evaluations vs. JAGS and would
like to take the R2jags fit object (which can be converted
to coda format) and apply RStan's R-hat and n_eff routines.

I didn't see a way to do that from the doc or vignette,
but I thought it was possible.

- Bob

Ben Goodrich

unread,
May 20, 2015, 11:55:50 AM5/20/15
to stan-...@googlegroups.com, ca...@alias-i.com
With a single chain that is a mcmc object defined in the coda package,

arr <- as.matrix(mcmcobject)
dim
(arr) <- c(nrow(arr), 1L, ncol(arr))
library
(rstan)
monitor
(arr, warmup = 0)

With a mcmc.list object (perhaps produced by as.mcmc), it is conceptually the same thing but the dimensions have to be permuted.

arr <- as.array(mcmclistobject)
arr
<- aperm(arr, c(1,3,2))
monitor
(arr, warmup = 0)

Ben

Bob Carpenter

unread,
May 20, 2015, 2:28:42 PM5/20/15
to stan-...@googlegroups.com
Thanks!

- Bob
> --
> You received this message because you are subscribed to the Google Groups "Stan users mailing list" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to stan-users+...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages