Creates a basic plot showing simulated traces (simulated evidence accumulation processes) from a drift diffusion model. Such plots are useful for exploring and testing model behavior, allowing users to visualize the traces.
Usage
# S3 method for class 'traces_dm_list'
plot(
x,
...,
col = NULL,
col_b = NULL,
xlim = NULL,
ylim = NULL,
xlab = "Time",
ylab = "Evidence",
lty = 1,
type = "l",
legend = NULL,
legend_pos = "topright"
)
# S3 method for class 'traces_dm'
plot(
x,
...,
col = NULL,
col_b = NULL,
xlim = NULL,
ylim = NULL,
xlab = "Time",
ylab = "Evidence",
lty = 1,
type = "l"
)
Arguments
- x
an object of type
traces_dm_list
ortraces_dm
, containing the traces to be plotted, resulting from a call to simulate_traces.- ...
additional arguments passed to the plot, graphics::points, and graphics::legend functions. Oftentimes, this will (unfortunately) lead to an error due to a clash of arguments.
- col
character, vector of colors for the evidence accumulation traces, one per condition. Defaults to a rainbow palette if not specified.
- col_b
character, a vector of colors for the boundary lines. Defaults to black for all conditions.
- xlim, ylim
numeric vectors of length 2, specifying the x and y axis limits.
- xlab, ylab
character, labels for the x and y axes.
- lty
integer, line type for both the traces and boundary lines.
- type
character, type of plot to use for traces and boundaries.
- legend
character vector, specifying legend labels, corresponding to the conditions in the traces. Defaults to the condition names.
- legend_pos
character, specifying the position of the legend on the plot.
Details
plot.traces_dm_list()
iterates over all conditions and plots the traces.
It includes a legend with condition labels.
plot_traces_dm
only plots the traces provided (i.e., traces for one
condition)
Boundaries and traces are color-coded according to col
and col_b
. The
function automatically generates the upper and lower boundaries based on
the information stored within x
.
Examples
# get a couple of traces for demonstration purpose
a_model <- dmc_dm()
some_traces <- simulate_traces(a_model, k = 3)
# Plots for traces_dm_list objects ----------------------------------------
# basic plot
plot(some_traces)
# a slightly more beautiful plot :)
plot(some_traces,
col = c("green", "red"),
xlim = c(0, 0.35),
xlab = "Time [s]",
ylab = bquote(Realizations ~ of ~ X[t]),
legend_pos = "bottomright"
)
# Plots for traces_dm objects ---------------------------------------------
# we can also extract a single set of traces and plot them
one_set_traces <- some_traces$comp
plot(one_set_traces)
# modifications to the plot generally work in the same way
plot(one_set_traces,
col = "green",
xlim = c(0, 0.35),
xlab = "Time [s]",
ylab = bquote(Realizations ~ of ~ X[t])
)