Created
April 16, 2020 20:42
-
-
Save djnavarro/075f71586d9886ecfd99ff6740768a49 to your computer and use it in GitHub Desktop.
toy example with leaky accumulator models
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# illustrate that the temporally-accrued evidence in an Ornstein- | |
# Uhlenbeck model of perceptual decision-making is bounded | |
t <- 500 # length of time to run the process | |
drift <- .2 # drift rate measures the perceptual signal strength | |
leak <- .9 # evidence leakage rate | |
# momentary samples are presumed to generate normally distributed | |
# evidence with mean corresponding to drift rate, and (for reasons | |
# known but to Roger) standard deviation .1 | |
samples <- rnorm(t, mean = drift, sd = .1) | |
# discrete-time approximation to the Ornstein-Uhlenbeck model | |
evidence <- purrr::accumulate( | |
.x = samples, # <-- my idiot brain REALLY wants this to be .y = samples | |
.f = ~ (leak * .x) + .y | |
) | |
# plot | |
plot(1:t, evidence, type = "l", xlab = "time") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment