Generic advice for Bugs bugs

Peter Park writes,

I am a civil engineer in Ontario, Canada. Currently, I am mimicking your radon work in Data Analysis Using Regression and Multilevel/Hierarchical Models (page 350-354).

I used different dataset (I will explain it later), but followed your code (I attached three files including dataset, R code, and Winbugs code in this email for your information). Since I used the exactly same R and Winbugs code in your textbook, I expect that I can see the results. However, the Winbug program doesnÂ’t work and gives me an error message that I cannot understand. Would you be able to help me to overcome this hurdle? I will greatly appreciate your help.

I collected speed dataset at 12 different highway sections (a highway section includes a tangent and a curve section). My dataset contains:
x1: vehicleÂ’s running speed (km/h) at a tangent section of a highway (within level or individual level variable)
x2: the curvature (1/degree) at a curve section of a highway (between level or group level variable)
c: class variable represents different highway section (1 through 12)
y: vehiclesÂ’ running speed difference (km/h) between the tangent and the curve section of a highway (response variable)

My reply: I don’t know what went wrong with the Bugs code, but one thing that sometimes happens is that, when you read data in from R, it converts it into factors or characters or some other format. So one thing you should do is take a look at your variables (just type “x1” etc. in the R console) and check that they are what they are supposed to be. Beyond this, you can strip down the model until nothing remains and it runs ok, then add pieces back until you find the problem.

One annoying feature of Bugs is that it won’t work if you supply data and parameters that aren’t used by the model, so as you strip down the model and build it back up, you need to alter the data, inits, and parameters at the same time. The upside is that Bugs is very flexible, and it works pretty well for small data sets.

1 thought on “Generic advice for Bugs bugs

  1. Or type in str(my.data.frame) to see exactly what your data frame is made up of – just printing the data.frame can be frustrating if you have a lot of data.

Comments are closed.