aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKen Kellner <ken@kenkellner.com>2021-06-18 09:06:32 -0400
committerKen Kellner <ken@kenkellner.com>2021-06-18 09:06:32 -0400
commitdf187ba07d52531ad61eb791eddeb637c4ab9d47 (patch)
treef9e8c300faf36803e2890ff6fae98e199c1d609c
parentd3de26f380b58fce639c5514629ae76e6216fa27 (diff)
Bump version
-rw-r--r--DESCRIPTION4
-rw-r--r--NEWS7
-rw-r--r--R/processinput.R56
3 files changed, 37 insertions, 30 deletions
diff --git a/DESCRIPTION b/DESCRIPTION
index 17ed108..74bced6 100644
--- a/DESCRIPTION
+++ b/DESCRIPTION
@@ -1,6 +1,6 @@
Package: jagsUI
-Version: 1.5.1.9106
-Date: 2021-06-17
+Version: 1.5.2
+Date: 2021-06-18
Title: A Wrapper Around 'rjags' to Streamline 'JAGS' Analyses
Authors@R: c(
person("Ken", "Kellner", email="contact@kenkellner.com", role=c("cre","aut")),
diff --git a/NEWS b/NEWS
index 7d99733..ba5d221 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,10 @@
+# Changes from Version 1.5.1 to 1.5.2 [18 June 2021] #
+
+Remove View function due to problematic interactions with RStudio
+Improvements to traceplot and densityplot
+Make sure output is reproducible when parallel=FALSE
+Minor bugfixes
+
# Changes from Version 1.5.0 to 1.5.1 [30 July 2019] #
Fix issue when chains adapted for different numbers of iterations
diff --git a/R/processinput.R b/R/processinput.R
index 4eeeb23..c208b07 100644
--- a/R/processinput.R
+++ b/R/processinput.R
@@ -2,12 +2,12 @@
process.input = function(x,y,inits,n.chains,n.iter,n.burnin,n.thin,n.cores,DIC=FALSE,autojags=FALSE,max.iter=NULL,
verbose=TRUE,parallel=FALSE,seed=NULL){
if(verbose){cat('\nProcessing function input.......','\n')}
-
+
#Quality control
if(n.iter<=n.burnin){
stop('Number of iterations must be larger than burn-in.\n')
}
-
+
if(parallel){
#Set number of clusters
p <- detectCores()
@@ -32,79 +32,79 @@ process.input = function(x,y,inits,n.chains,n.iter,n.burnin,n.thin,n.cores,DIC=F
}
}
}
-
+
if(autojags){
if(n.chains<2){stop('Number of chains must be >1 to calculate Rhat.')}
if(max.iter<n.burnin&verbose){
options(warn=1)
warning('Maximum iterations includes burn-in and should be larger than burn-in.')
- options(warn=0,error=NULL)
- }
+ options(warn=0,error=NULL)
+ }
}
-
+
if(n.thin>1&&(n.iter-n.burnin)<10&&verbose){
options(warn=1)
warning('The number of iterations is very low; jagsUI may crash. Recommend reducing n.thin to 1 and/or increasing n.iter.')
- options(warn=0,error=NULL)
+ options(warn=0,error=NULL)
}
-
+
final.chain.length <- (n.iter - n.burnin) / n.thin
even.length <- floor(final.chain.length) == final.chain.length
if(!even.length&verbose){
options(warn=1)
warning('Number of iterations saved after thinning is not an integer; JAGS will round it up.')
- options(warn=0,error=NULL)
+ options(warn=0,error=NULL)
}
-
+
#Check if supplied parameter vector is the right format
if((is.character(y)&is.vector(y))){
} else{stop('The parameters to save must be a vector containing only character strings.\n')}
-
+
#If DIC requested, add deviance to parameters (if not already there)
if(DIC&&(!'deviance'%in%y)){
params <- c(y,"deviance")
- } else {params <- y}
-
+ } else {params <- y}
+
#Check if supplied data object is the proper format
if(is.list(x)||(is.character(x)&is.vector(x))){
} else{stop('Input data must be a list of data objects OR a vector of data object names (as strings)\n')}
-
+
if(is.list(x)&&all(sapply(x,is.character))){
- warning("Suppling a list of character strings to the data argument will be deprecated in the next version")
+ warning("Suppling a list of character strings to the data argument will be deprecated in the future")
x = unlist(x)
}
-
+
if((is.list(x)&&is.null(names(x)))||(is.list(x)&&any(names(x)==""))){
stop('At least one of the elements in your data list does not have a name\n')
}
-
+
#Convert a supplied vector of characters to a list of data objects
- if((is.character(x)&is.vector(x))){
- warning("Suppling a character vector to the data argument will be deprecated in the next version")
+ if((is.character(x)&is.vector(x))){
+ warning("Suppling a character vector to the data argument will be deprecated in the future")
temp = lapply(x,get,envir = parent.frame(2))
names(temp) = x
- x = temp
+ x = temp
}
-
+
#Check each component of data object for issues and fix if possible
for (i in 1:length(x)){
-
+
if(is.factor(x[[i]])){
-
+
stop('\nElement \'',names(x[i]) ,'\' in the data list is a factor.','\n','Convert it to a series of dummy/indicator variables or a numeric vector as appropriate.\n')
-
+
}
-
+
process <- data.check(x[[i]],name = names(x[i]),verbose=verbose)
if(!is.na(process[1])&&process[1]=="error"){stop('\nElement \'',names(x[i]) ,'\' in the data list cannot be coerced to one of the','\n','allowed formats (numeric scalar, vector, matrix, or array)\n')
} else{x[[i]] <- process}
}
-
+
#Get initial values
init.vals <- gen.inits(inits,n.chains,seed,parallel)
-
+
if(verbose){cat('\nDone.','\n','\n')}
return(list(data=x,params=params,inits=init.vals,n.cores=n.cores))
-
+
}