This function generates plots for all components of a drift diffusion model (DDM), such as drift rate, boundary, and starting condition. Each component is plotted against the time or evidence space, allowing for visual inspection of the model's behavior across different conditions.
Usage
# S3 method for class 'drift_dm'
plot(
x,
...,
conds = NULL,
col = NULL,
xlim = NULL,
legend = NULL,
legend_pos = "topright"
)
Arguments
- x
an object of class drift_dm
- ...
additional arguments passed forward.
- conds
character vector, specifying conditions to plot. Defaults to all conditions in
x
.- col
character vector, specifying colors for each condition. If a single color is provided, it will be repeated for each condition.
- xlim
numeric vector of length 2, specifying the x-axis limits for components related to the time space.
- legend
character vector, specifying legend labels corresponding to the conditions.
- legend_pos
character, specifying the position of the legend on the plot (e.g.,
"topright"
).
Details
The plot.drift_dm
function provides an overview of key DDM components,
which include:
mu_fun
: Drift rate over time.mu_int_fun
: Integrated drift rate over time.x_fun
: Starting condition as a density across evidence values.b_fun
: Boundary values over time.dt_b_fun
: Derivative of the boundary function over time.nt_fun
: Non-decision time as a density over time.
For each component, if multiple conditions are specified, they will be
plotted using different colors as specified in color
.
When the evaluation of a model component fails, the respective component will not be plotted, but no warning is ushered.
Examples
# plot the component functions of the Ratcliff DDM
plot(ratcliff_dm())
plot(ratcliff_dm(var_non_dec = TRUE))
# Note: the variability in the drift rate for the Ratcliff DDM
# is not plotted! This is because it is not actually stored as a component
# function.
# plot the component functions of the DMC model
plot(dmc_dm(), col = c("green", "red"))