diff options
author | Ken Kellner <ken@kenkellner.com> | 2018-10-30 15:20:32 -0400 |
---|---|---|
committer | Ken Kellner <ken@kenkellner.com> | 2018-10-30 15:20:32 -0400 |
commit | ef9990691bf8df56d8c68f6cccb172f07e268250 (patch) | |
tree | 600cc3383d7c0a5e60f773b0055c951d7d3620b8 | |
parent | 5b74135547b523f1bca75f3affa21f4aa0193121 (diff) |
Fix crash when DIC was requested but JAGS couldn't calculate it
-rw-r--r-- | DESCRIPTION | 2 | ||||
-rw-r--r-- | NEWS | 3 | ||||
-rw-r--r-- | R/print.R | 2 | ||||
-rw-r--r-- | R/processoutput.R | 2 |
4 files changed, 5 insertions, 4 deletions
diff --git a/DESCRIPTION b/DESCRIPTION index fb6b2f8..1ddf697 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: jagsUI Version: 1.5.0 -Date: 2017-08-16 +Date: 2018-09-12 Title: A Wrapper Around 'rjags' to Streamline 'JAGS' Analyses Author: Ken Kellner <contact@kenkellner.com> Maintainer: Ken Kellner <contact@kenkellner.com> @@ -1,10 +1,11 @@ -# Changes from Version 1.4.9 to 1.5.0 [16 August 2018] # +# Changes from Version 1.4.9 to 1.5.0 [9 September 2018] # Fix issues with NAs in parameters. Fix missing arguments in autojags(). Handle errors in output processing so that samples are not lost completely. Make sure a specified random seed is used for initial value functions. Fix error where summary stats were printed in the wrong order for some parameters. +Don't collapse 1 row/1col matrices into vectors automatically. # Changes from Version 1.4.8 to 1.4.9 [8 December 2017] # @@ -63,7 +63,7 @@ print.jagsUI <- function(x,digits=3,...){ } #Print DIC info - if(x$calc.DIC){ + if(x$calc.DIC & !is.null(x$pD)){ if(!x$bugs.format){ cat('\nDIC info: (pD = var(deviance)/2)','\npD =',round(x$pD,1),'and DIC =',round(x$DIC,digits),'\n') cat('DIC is an estimate of expected predictive error (lower is better).\n') diff --git a/R/processoutput.R b/R/processoutput.R index f905df5..1cf8ca8 100644 --- a/R/processoutput.R +++ b/R/processoutput.R @@ -146,7 +146,7 @@ if(NA%in%rhat.sub&&verbose){ } #Do DIC/pD calculations if requested by user -if(DIC){ +if(DIC & 'deviance' %in% params){ dev <- matrix(data=mat[,'deviance'],ncol=m,nrow=n) pd <- numeric(m) dic <- numeric(m) |