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.
 A: This is not a complete answer. It is just an attempt to give a pointer.  I know nothing about LBA, I just like R code, so your millage may vary.
The key to finding the appropriate section of code was knowing that the value Ter was simply added to the end result of the model calculations (and backtracking from the obj function which is in the optim and parameterization wrapper 'fitter').  That lead me to pqlba and lbameans.  In lbameans, Ter is added as at the end of tmp$mean, in turn derived from the n1mean function which accepts as parameters x0max, chi, drift, and sdI which seemed like reasonable matches for your X1:X4 names.  But, nothing calls lbameans, leading me back to pqlba.  Digging through that I can see that pqlba (prior to adding Ter) bounces through a couple functions - and ends up at fptpdf.  At this point I am stymied.   
The nice part is that, if I am right, fptpdf has all of the major players present.  The bad part is that, 1) it would take more time to see whether the parameters are doing other things and need to be controlled prior to fptpdf (probably), and 2) Eliminating X1 (aka x0max) is problematic because the function is divided by x0max.  Setting it to 0 then causes obvious problems (dividing by 0 is bad mkay?). Thus a greater understanding of how the model is working is probably needed before you can achieve your aims.
Good luck.
