simulate_data is a generic function for simulating data based on
approximate inverse CDF sampling. CDFs are derived from the model's PDFs and
data is drawn by mapping samples from a uniform distribution
(in \([0, 1]\)) to the values of the CDF. Note that sampled response times
will correspond to the values of the time space (i.e., they will correspond
to seq(0, t_max, dt), see drift_dm).
For drift_dm objects, the behavior of simulate_data depends on k. If
k = 1 and no lower/upper or df_prms arguments are supplied, then the
parameters currently set to the model are used to generate
the synthetic data. If k > 1, then k parameter combinations are either
randomly drawn via simulate_values or gathered from the provided
data.frame df_prms, and then data is simulated for each parameter
combination.
When specifying lower/upper, parameter combinations are simulated via
simulate_values. This comes in handy for simple parameter recovery
exercises. If df_prms is specified, then the parameter combinations from
this data.frame is used. Note that the column names in df_prms must match
with the (unique) parameter combinations of the model
(see print(coef(object)))
Details on how to specify lower/upper.
When users want to simulate data with k > 1 and lower/upper, then
parameter values have to be drawn. One great aspect about the
flex_prms object within each drift_dm model, is that
users can easily allow certain parameters to vary freely across conditions.
Consequently, the actual number of parameters varies with the settings of
the flex_prms object. In many cases, however, the simulation space
for a parameter is the same across conditions. For instance, in a model, the
parameter "mu" may vary across the conditions "easy", "medium", or "hard",
but the lower/upper limits are the same across conditions.
To avoid that users always have to re-specify the simulation space via the
lower/upper arguments, the lower and upper arguments refer to the
parameter labels, and dRiftDM figures out how to map these to all
parameters that vary across conditions.
Here is an example: Assume you have the model with parameters
"A" and "B", and the conditions "foo" and "bar". Now assume that "A" is
allowed to vary for "foo" and "bar". Thus, there are actually three
parameters; "A~foo", "A~bar", and "B". dRiftDM, however, can help with
this. If we provide lower = c(A = 1, B = 2), upper = c(A = 3, B = 4),
simulate_data checks the model, and creates the vectors
temp_lower = c(1,1,2) and temp_upper = c(3,3,4) as a basis to simulate
the parameters.
Users have three options to specify the simulation space:
Plain numeric vectors (not very much recommended). In this case,
lower/upper must be sorted in accordance with the free parameters in the
flex_prms_obj object (call print(<model>) and have a look at the
Parameter Settings output)
Named numeric vectors. In this case lower/upper have to provide labels
in accordance with the parameters that are considered "free" at least once
across conditions.
The most flexible way is when lower/upper are lists. In this case, the
list requires an entry called "default_values" which specifies the named or
plain numeric vectors as above. If the list only contains this entry, then
the behavior is as if lower/upper were already numeric vectors. However,
the lower/upper lists can also provide entries labeled as specific
conditions, which contain named (!) numeric vectors with parameter labels.
This will modify the value for the upper/lower parameter space with respect
to the specified parameters in the respective condition.