simulate_lba | R Documentation |
Simulate response times and choices from a Linear Ballistic Accumulation
(LBA) model with a model specification (typically from
ggdmcModel::BuildModel
).
## S4 method for signature 'lba'
simulate(
object,
nsim = 4L,
seed = NULL,
n_subject = 3L,
parameter_vector = NULL,
use_inverse_method = FALSE,
debug = FALSE
)
object |
An object of class |
nsim |
Integer. Number of trials to simulate per subject. Defaults
to |
seed |
Optional integer. Sets the random seed for reproducibility.
Defaults to |
n_subject |
Integer. Number of subjects to simulate. Defaults to
|
parameter_vector |
A named vector or list of parameters (e.g., |
use_inverse_method |
Logical. If |
debug |
Logical. If |
This method simulates data from a design-based LBA model. You
can simulate multiple subjects, override default parameters,
and choose between standard and inverse sampling methods.
Turn on debugging mode by entering TRUE
to the
option, debug
.
A data frame with:
s
(lowercase): subject identifiers (factor)
R
(uppercase): choices (integer/character)
RT
: response times (numeric)
Plus user-defined condition columns derived from the model
The internal mechanism is case sensitive. The choice of
using upper- or lowercase letters to denote variables is
a convention (originated from DMC
), rather than a strict
requirement.
simulate_lba_trials
(low-level C++ back end),
theoretical_dlba
, plba
, dlba
Other LBA simulation:
validate_lba_parameters()
if (requireNamespace("ggdmcModel", quietly = TRUE)) {
BuildModel <- getFromNamespace("BuildModel", "ggdmcModel")
model <- BuildModel(
p_map = list(
A = "1", B = "1", t0 = "1", mean_v = "M", sd_v = "1",
st0 = "1"
),
match_map = list(M = list("s1" = "r1", "s2" = "r2")),
factors = list(S = c("s1", "s2")),
constants = c(sd_v = 1, st0 = 0),
accumulators = c("r1", "r2"),
type = "lba"
)
}
p_vector <- c(
A = .75, B = 1.25, mean_v.false = 1.5, mean_v.true = 2.5,
t0 = 0.15
)
sub_model <- setLBA(model)
sim_dat <- simulate(sub_model,
nsim = 256, parameter_vector = p_vector,
n_subject = 1
)
head(sim_dat)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.