Saturday, May 14, 2011

BUGS

I've recently been working with multiple models on different parts of a large data set, described within one BUGS file.  They have to be described in one file because they describe inter-dependent processes, for example growth and survival.  Both are described in BUGS as:

${A[i] \sim \text{dbern}(\ldots + q\times B[i])}$
${B[i] \sim \text{dbern}(\ldots)}$
The interesting part is in the parameter calculation for process B, we accidentally used a parameter I intended to use for process A.  The parameter was already used in process A.  Unlike most coding bugs in BUGS (rather than conceptual errors) this causes no complaints.

In our code this was an especially nasty bug because the shared parameter
is one of a half-dozen which capture how a spline affects A.  I'm certain our results would have been affected, maybe at a later time.  Tracking the bias to the bug (if we even noticed) would have been a nightmare.

The moral is: read your code, carefully.  Even better, beg somebody else read your code (carefully).




No comments:

Post a Comment