[R] WinBUGS with R

Uwe Ligges ligges at statistik.tu-dortmund.de
Tue Jan 20 15:10:04 CET 2009



Uwe Ligges wrote:
> 
> 
> Richard.Cotton at hsl.gov.uk wrote:
>>> 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))
>>>        }
> 
> 
> Untested, but I think it needs to be
> 
>  Wednesbury.inits <- function(){
>        matrix(0,39,2)
>  }


No, in fact I was wrong...

Uwe

> and a function is of interest if some randomness should be in the inits...
> 
> 
> 
> 
>>> 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.
> 
> Yes.
> 
> 
> 
>> Also, I'm not sure if WinBUGS understands matrix data types (though I 
>> may be wrong).
> 
> It does.
> 
> 
> Uwe
> 
>>
>> Regards,
>> Richie.
>>
>> Mathematical Sciences Unit
>> HSL
>>
>>
>> ------------------------------------------------------------------------
>> ATTENTION:
>>
>> This message contains privileged and confidential inform...{{dropped:20}}
>>
>> ______________________________________________
>> R-help at r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide 
>> http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
> 
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide 
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.




More information about the R-help mailing list