Modifying linear ballistic accumulator (LBA) simulation in R

The "Linear Ballistic Accumulator" model (LBA) is a rather successful model for human behaviour in speeded simple decision tasks. Donkin et al (2009, PDF) provide code that permits estimating the parameters of the model given human behavioural data, and I've copied this code (with some minor formatting changes) to a gist here. However, I'd like to make a seemingly minor modification to the model but I'm not sure how to achieve this modification in the code.

To start with the canonical model, LBA represents each response alternative as a competitor in a rather strange race such that the competitors can differ in the following characteristics:

• Starting position: this varies from race to race according to a uniform distribution bounded by U(0,X1).
• Speed: this is kept constant within a given race (no acceleration) but varies from race to race according to a Gaussian distribution defined by N(X2,X3)
• Finish line position (X4)

Thus, each competitor has its own set of values for X1, X2, X3 and X4.

The race is repeated many times, with the winner and their time recorded after each race. A constant of X5 is added to every winning time.

Now, the modification I want to make is to swap the variability in the starting point to the finish line. That is, I want the start point to be zero for all competitors and all races, thereby eliminating X1, but I want to add a parameter, X6, that specifies the size of the range of a uniform distribution centered on X4 from which each competitor's finish line is sampled for each race. In this model, then, each competitor will have values for X2, X3, X4, and X6, and we still have the across-competitor value for X5.

I'd be very grateful if anyone is willing to help with this.

Oh, and to provide a mapping from the "X" named parameters described above to the variable names used by the LBA code I linked: X1 = x0max; X2 = driftrate; X3 = sddrift; X4 = chi; X5 = Ter.

-
There are errors in the code as provided. Throughout you put a space in the middle of logical operators, e.g. <=, >=, ==, and !=. –  rpierce Jul 19 '11 at 15:19
The modification you suggest sounds trivial, the problem is that it is /very/ buried in the code. To create fits, it calls fitter. Fitter apparently gives the models its' parameters and then wraps the actual fit function in optim. The function being optimized is obj. –  rpierce Jul 19 '11 at 15:37