Skip to content

Add gamma, Fréchet and lognormal drift distributions to the LBA - #565

Open
GidonFrischkorn wants to merge 8 commits into
race-lbafrom
race-lba-drifts
Open

GidonFrischkorn wants to merge 8 commits into
race-lbafrom
race-lba-drifts

Conversation

@GidonFrischkorn

Copy link
Copy Markdown
Collaborator

Adds the gamma, Fréchet and lognormal trial-to-trial drift distributions to the LBA from #500, which keeps only the normal drift. They come back through lba(distribution = ) and the distribution argument of dlba(), plba(), qlba() and rlba(): one spec entry, one Stan chunk and one set of R kernels per distribution, plus their tests, benchmark fits, the two "Numerical notes" in ?lba and the NEWS wording. The commit is the exact revert of the cut in #500, so the tree here is the LBA as it was before the split.

Base and CI. The base is race-lba (#500). No CI runs until #500 is merged and this PR is retargeted to dev-1.6.0.

Validation, per distribution

  • All three, R functions against rtdists (run on 2c05f70): dlba() agrees with rtdists::dLBA() to 3.1e-15 (gamma), 8.0e-15 (Fréchet) and 1.2e-15 (lognormal), and to 1.8e-6 or better with sp near 0. Only the density is compared; plba() and rlba() are not checked against rtdists for these three.
  • All three, Stan against R: the test suite compiles each Stan kernel and compares it with its R twin on a grid of decision times, start-point ranges and thresholds (gamma and lognormal within 1e-6 nats; Fréchet within 1e-6 nats for sp / gap <= 6 and within 5 nats above, as documented).
  • Gamma, parameter recovery (run on 052ecf9, data from rtdists::rLBA(), 2,000 trials, K = 2): every parameter inside its 95% interval, Rhat at most 1.0052, no divergences.
  • Lognormal, parameter recovery (same run): every interval covers the true value, but this is not a recovery; see the gaps.

Gaps

  1. No Fréchet recovery. Its numerics are checked only against rtdists and the R twin.
  2. The lognormal drift is not identified with s fixed. Its sdlog is scale-free, so shifting both meanlogs by log c and multiplying gap and sp by c leaves the likelihood unchanged (log-density change at most 1.8e-15 for c = 0.5, 2, 5). In the recovery run the posterior SD along that direction was 0.494, against 0.5 for the prior alone. So the "Identifiability of s" section of ?lba is wrong for the lognormal, and check_model() does not warn. A lognormal fit currently needs gap or sp fixed in the formula.
  3. Gamma gradient. Stan Math's gamma CDF has an approximate shape partial (Incomplete gamma gradient roots and log-space cdfs for six distributions stan-dev/math#3408). This is documented in ?lba and cannot be fixed in bmm.

Restores the gamma, Fréchet and lognormal trial-to-trial drift
distributions on top of the normal-drift LBA: their entries in the spec
table, R kernels and Stan chunks, their tests and benchmark fits, and
their text in ?lba, ?lba_dist and NEWS. lba(distribution = ) and the
d/p/q/rlba() functions accept them again.
# Conflicts:
#	R/model_lba.R
#	man/lba.Rd
# Conflicts:
#	R/model_lba.R
#	man/lba.Rd
…ifts

posterior_epred() now returns Inf where a race decays like t^-1.5 or
slower, which is exact for the normal drift: there it means a single
accumulator and an infinite mean. A gamma race decays like t^-k with k
the sum of its shapes, so its mean is finite for k between 1 and 1.5.
Until the threshold for the gamma, Frechet and lognormal drifts is
settled, they keep the mean of the race truncated at 1e7 s and a warning
with the number of observations affected.
# Conflicts:
#	R/model_lba.R
#	tests/testthat/test-model_lba.R

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant