[R] WinBUGS with R

Richard.Cotton at hsl.gov.uk Richard.Cotton at hsl.gov.uk
Tue Jan 20 11:15:02 CET 2009


> 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")

Debugging your BUGS model or dataset via R is a bit of a pain.  I find 
that the best way (or maybe least worst way) to weed out the problems when 
you get an error like this is to find the files (model/data/inits) that 
R2WinBUGS has created and open them in WinBUGS itself.  Run the Model 
Specification tool and you can more easily determine which part of the 
file the problem lies in.

Just looking at your Wednesbury.inits variable, you don't need to define 
it as a function
Wednesbury.inits <- list(list(C=matrix(0,39,2)))
will do.

Also, I'm not sure if WinBUGS understands matrix data types (though I may 
be wrong).

Regards,
Richie.

Mathematical Sciences Unit
HSL


------------------------------------------------------------------------
ATTENTION:

This message contains privileged and confidential inform...{{dropped:20}}




More information about the R-help mailing list