| plot.cafs | R Documentation |
Visualizes conditional accuracy functions (CAFs) for observed and/or predicted data. This is useful for assessing model fit or exploring response patterns across conditions or participants.
## S3 method for class 'cafs'
plot(
x,
...,
id = NULL,
conds = NULL,
col = NULL,
xlim = NULL,
ylim = c(0, 1),
xlab = "Bins",
ylab = NULL,
interval_obs = TRUE,
interval_pred = TRUE
)
x |
an object of |
... |
additional graphical arguments passed to plotting functions.
See |
id |
a numeric or character, specifying the ID of a single participant
to plot. If |
conds |
a character vector specifying the conditions to plot. Defaults to all available conditions. |
col |
a character vector specifying colors for each condition. If a single color is provided, it is repeated for all conditions. |
xlim |
a numeric vector of length 2, specifying the x-axis limits. |
ylim |
a numeric vector of length 2, specifying the y-axis limits. |
xlab, ylab |
character strings for the x- and y-axis labels. |
interval_obs, interval_pred |
logicals; if |
If x contains multiple IDs and no specific id is provided, the
function aggregates across participants before plotting.
Observed CAFs are shown as points, and predicted CAFs as lines. When
interval = TRUE and the input includes interval estimates (i.e., the
column Estimate exists), the plot includes error bars for observed data
and shaded contours for model predictions.
Colors, symbols, and line styles can be customized via ....
Returns NULL invisibly. The function is called for its side effect of
generating a plot.
# Example 1: Model predictions only ---------------------------------------
a_model <- dmc_dm()
cafs <- calc_stats(a_model, type = "cafs")
plot(cafs)
plot(cafs, col = c("green", "red"), ylim = c(0.5, 1))
# Example 2: Observed and predicted data ----------------------------------
obs_data(a_model) <- dmc_synth_data
cafs <- calc_stats(a_model, type = "cafs")
plot(cafs)
# Example 3: Observed data only -------------------------------------------
cafs <- calc_stats(dmc_synth_data, type = "cafs")
plot(cafs)
# Example 4: Observed data with interval ----------------------------------
cafs <- calc_stats(dmc_synth_data, type = "cafs", resample = TRUE)
plot(cafs)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.