welcome: please sign in
location: CategoryBugComputational / VectorArgumentsOfCustomFunctions

Brief Description

Vector arguments of custom functions based on the GraphVectortemp1 template are not passed correctly.

*Operating System: Windows XP
*OpenBUGS version: User-compiled from revision 397

I attempted to develop BUGS functions (logical nodes) with vector arguments based on the GraphVectortemp1 template. When I attempt to use such functions in a BUGS model I find that the vector arguments are often passed incorrectly. This happens when the vector argument has the following properties:

When those conditions are true the entire BUGS vector gets passed to the function instead of the specified subvector. On the other hand if the vector argument is say x[m:n] where m > 1, the correct subvector is passed. In other words a vector of length n - m + 1 is passed.


Source code, BUGS model and script to produce bug

The behavior described above is illustrated with the attached files:

If you run the script in its current form you will see that "test[2]" should represent the length of the second vector argument "x2[1:6]" and that it incorrectly indicates it has length = 12. In the script if you uncomment the line "#samplesSet(test2)" and you rerun it, you get an "index out of range" trap and the trap window shows that the argument has an incorrect length.


CategoryBugComputational/VectorArgumentsOfCustomFunctions (last edited 2010-03-11 16:07:23 by BillGillespie)