I have found some distributions for which BUGS and R have different parameterizations: Normal, log-Normal, and Weibull.
For each of these, I gather that the second parameter used by R needs to be inverse transformed (1/parameter) before being used in BUGS (or JAGS in my case).
Does anyone know of a comprehensive list of these transformations that currently exists?
The closest I can find would be comparing the distributions in table 7 of the JAGS 2.2.0 user manual with the results of ?rnorm
etc. and perhaps a few probability texts. This approach appears to require that the transformations will need to be deduced from the pdfs separately.
I would prefer to avoid this task (and possible errors) if it has already been done, or else start the list here.
Update
Based on Ben's suggestions, I have written the following function to transform a dataframe of parameters from R to BUGS parameterizations.
##' convert R parameterizations to BUGS paramaterizations
##'
##' R and BUGS have different parameterizations for some distributions.
##' This function transforms the distributions from R defaults to BUGS
##' defaults. BUGS is an implementation of the BUGS language, and these
##' transformations are expected to work for bugs.
##' @param priors data.frame with colnames c('distn', 'parama', 'paramb')
##' @return priors with jags parameterizations
##' @author David LeBauer
r2bugs.distributions <- function(priors) {
norm <- priors$distn %in% 'norm'
lnorm <- priors$distn %in% 'lnorm'
weib <- priors$distn %in% 'weibull'
bin <- priors$distn %in% 'binom'
## Convert sd to precision for norm & lnorm
priors$paramb[norm | lnorm] <- 1/priors$paramb[norm | lnorm]^2
## Convert R parameter b to JAGS parameter lambda by l = (1/b)^a
priors$paramb[weib] <- 1 / priors$paramb[weib]^priors$parama[weib]
## Reverse parameter order for binomial
priors[bin, c('parama', 'paramb')] <- priors[bin, c('parama', 'paramb')]
## Translate distribution names
priors$distn <- gsub('weibull', 'weib',
gsub('binom', 'bin',
gsub('chisq', 'chisqr',
gsub('nbinom', 'negbin',
as.vector(priors$distn)))))
return(priors)
}
##' @examples
##' priors <- data.frame(distn = c('weibull', 'lnorm', 'norm', 'gamma'),
##' parama = c(1, 1, 1, 1),
##' paramb = c(2, 2, 2, 2))
##' r2bugs.distributions(priors)