[R] R2WinBUGS question from beginner

michael curran michcurran at yahoo.com
Sat Sep 5 08:14:45 CEST 2009


Hi R Users, 

I have--what I think--is a very basic question. I'm trying to use R2WinBUGS and am having difficulty setting up the data properly for repeated measures data in a hierarchical model. 

First, I know that it is me...not the package, as I sucessfully used R2WinBUGS to run a basic regression. 

Second, I know that it's not my hierarchical model as I've run it successfully in WinBUGS by using data in rectangular format. Despite this, I would like to figure out how to use R2WinBUGS so that I could examine the data more thoroughly subsequent to the WinBUGS run.

1) Is there literally a step-by-step guide somewhere online that shows how to do this? Some claim to be step by step (Gelman & Hill's book, for instance) but gloss over this part of the process.

2) If no online resource, is there a "trick" that I'm missing to appropriately structure the data.

Here are the specific details:

I have 100 repeated measures on 655 people. The dataset is initially in long format. From my perusal of online examples/WinBUGS website, I believe data must be in wide format. I have copied the R2WinBUGS code from Gelman and Hill's book website, have tried using "dput", have tried using "matrix," "structure," and "dim" commands to get things structured correctly. Having tried all these things, each time the data looks good in R, but is rejected by R2WinBUGS usually with the error message "expected collection operator c". Despite this, when I look at the datafile in WinBUGS there is a c right there! 

I've been slowly going crazy trying to figure this out for the last week. 

Anyway, I'm sure that I am doing something goofy here. Was just hoping for some advice. Sorry, I can't share the data as it is proprietary. Thanks in advance, Mike




More information about the R-help mailing list