[R] R and WinBUGS (via R2WinBUGS) error

Lindsay Stirton Lindsay.Stirton at manchester.ac.uk
Tue Jan 20 11:04:58 CET 2009


Dear UseRs,

Apologies, I tried to post to the list yeasterday, but (for some  
reason) part of my message got missed off. Here's a second attempt.

I am having some problems using R with WinBUGS using the R2WinBUGS
package. Specifically, when I try to run bugs() I get the following
message.

Error in FUN(X[[1L]], ...) :
   .C(..): 'type' must be "real" for this format

To give a little more context, my bugs() command (for a multilevel
ordinal logit  similar to Gelman and Hill, Data Analysis Using
Regression and Multilevel/Hierarchical Models p. 383 is:

> Wednesbury.data <- list ("n.judge", "n", "n.cut", "y", "judge", "ct",
+ "ra", "lg")
> Wednesbury.inits <- function(){
+     list(C=matrix(0,39,2))
+      }
> Wednesbury.parameters <- c("C", "b1", "b2", "b3")
> Wednesbury.sim <- bugs(data="Wednesbury.data",  
> inits="Wednesbury.inits", parameters="Wednesbury.parameters",  
> model.file="p:/Wednesbury09/Wednesbury.bug", n.chains=1,  
> n.burnin=1000, n.sims=10000, bugs.directory="c:/Program  
> Files/WinBUGS14/", program="WinBUGS",  debug=TRUE)
Error in FUN(X[[1L]], ...) :
   .C(..): 'type' must be "real" for this format
>

This problem was discussed before  
(https://stat.ethz.ch/pipermail/r-help/2008-August/171726.html), but  
the discussion didn't seem to help me. As suggested on that post,  
traceback() gives the following:

> traceback()
6: .C("str_signif", x = x, n = n, mode = as.character(mode), width =  
as.integer(width),
        digits = as.integer(digits), format = as.character(format),
        flag = as.character(flag), result = blank.chars(i.strlen),
        PACKAGE = "base")
5: FUN(X[[1L]], ...)
4: lapply(data.list, formatC, digits = digits, format = "E")
3: write.datafile(lapply(data.list, formatC, digits = digits, format = "E"),
        file.path(dir, data.file))
2: bugs.data(data, dir = getwd(), digits)
1: bugs(data = "Wednesbury.data", inits = "Wednesbury.inits",  
parameters = "Wednesbury.parameters",
        model.file = "p:/Wednesbury09/Wednesbury.bug", n.chains = 1,
        n.burnin = 1000, n.sims = 10000, bugs.directory = "c:/Program  
Files/WinBUGS14/",
        program = "WinBUGS", debug = TRUE)
>

Any help greatly appreciated.

Lindsay Stirton
School of Law, University of Manchester




More information about the R-help mailing list