[R] About: Error in FUN(X[[1]], ...) : symbol print-name too long

Uwe Ligges ligges at statistik.uni-dortmund.de
Sun Nov 13 15:21:07 CET 2005


gsmatos1 wrote:
> Hi, 
> 
> I´m trying to use the Win2BUGS package from R and I have a similar problem 
> that reurns with the message: 
> 
> Error in FUN(X[[1]], ...) : symbol print-name too long 


I took a first look. The above looks like a bug in package "rbugs" which 
does some really strange things by pasting huge strings. It is 
completely unrelated with R2WinBUGS.



> But, there is no stray ` character in the file ( Sugestions given by: Duncan 
> Temple Lang <duncan> 
> Date: Mon, 26 Sep 2005 07:31:08 -0700 ) 
> 
> The progam in R is: 
> 
> library(R2WinBUGS) 
> library(rbugs) 

Please omit the line above.


> dat <- 
> list(x=c(49,48,50,44,54,56,48,48,51,51,50,53,51,50,51,54,50,53,50,49,51,47,53,50,49,55,53,48,54,46), 
> y=c(50,49,57,52,47,52,58,45,55,54,51,54,56,53,52,47,51,54,50,47,46,44,54,55,52,57,52,48,48,51)) 
> 
> dat  <- format4Bugs(dat, digits = 0) 

Please omit the line above.


> parm <- c("lbda") 
> 
> bugs(dat, inits=list(NULL), parm, "d2.bug", 
> n.chains = 1, n.iter = 5000, n.burnin = floor(n.iter/2), 
> n.thin = max(1, floor(n.chains * (n.iter - n.burnin)/1000)), 
> bin = (n.iter - n.burnin) / n.thin, 
> debug = TRUE, DIC = TRUE, digits = 5, codaPkg = FALSE, 
> bugs.directory = "C:/WinBUGS14/", 
> working.directory = NULL, clearWD = FALSE) 

The above should simply read:

bugs(dat, NULL, parm, "d2.bug",
     n.chains = 1, n.iter = 5000, debug = TRUE,
     bugs.directory = "C:/WinBUGS14/")

which reveals a bug in the function bugs():
the first lines do not special case inits=NULL and should read

    if (!missing(inits) && !is.function(inits) && !is.null(inits) && 
(length(inits) != n.chains))

rather than

    if (!missing(inits) && !is.function(inits) && (length(inits) != 
n.chains))

Please change it simply by calling fix(bugs) for the meantime.
I will submit a patched version of R2WinBUGS to CRAN within next week.

Applying your model with fixed versions of your code and R2WinBUGS also 
shows that you get some errors in WinBUGS and you have to change your 
model file, but that's another issue...

Uwe Ligges



> 	The objective of the program is to compare means of two independent samples 
> that results 
> 	in Beherens-Fisher posterior and in the model.file of WinBUGS "d2.bug" 
> there is the following codes: 
> 
>   model 
> { 
>    for( i in 1 : 30 ) { 
>       x[i] ~ dnorm(mu1,sig1) 
>    } 
>    for( i in 1 : 30 ) { 
>       y[i] ~ dnorm(mu2,sig2) 
>    } 
>    mu1 ~ dnorm(50,1.0E-6) 
>    sig1 ~ dgamma(0.001,0.001) 
>    mu2 ~ dnorm(50,1.0E-6) 
>    sig2 ~ dgamma(0.001,0.001) 
>    lbda <- mu1 - mu2 
> } 
> 
>   I´m a new user of WinBUGS and if someone detect error in the model codes 
> too, I´m grateful. 
> 
> 	Thanks for help! 
> 	Gilberto Matos. 
> 
> 
> ------------------------------------------------------------------------
> 
> model
> {
>    for( i in 1 : 30 ) {
>       x[i] ~ dnorm(mu1,sig1)
>    }
>    for( i in 1 : 30 ) {
>       y[i] ~ dnorm(mu2,sig2)
>    }
>    mu1 ~ dnorm(50,1.0E-6)
>    sig1 ~ dgamma(0.001,0.001)
>    mu2 ~ dnorm(50,1.0E-6)
>    sig2 ~ dgamma(0.001,0.001)
>    lbda <- mu1 - mu2
> }
> 
> 
> ------------------------------------------------------------------------
> 
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html




More information about the R-help mailing list