
Aggregate long-format Remember/Know data for sdt_cdp()
Source: R/model_sdt_cdp.R
aggregate_sdt_cdp_data.RdReshapes long-format Remember/Know recognition data – one row
per trial, or one row per response category with a count column – into
the aggregated wide format sdt_cdp() is fit to: one row per cell and
one count column per response category, named new1 ... new<n_new>,
know<k> / remember<k> (and guess<k> when the data contain "guess"
judgments), with k on the unified confidence scale
n_new + 1 ... n_new + n_old.
Arguments
- data
A data frame in long format. Cells are defined by all columns other than
judgment,confidence, andcount(e.g. participant, stimulus class, and any condition variables), which are carried over to the output unchanged.- judgment
The name of the column coding the memory judgment, with values
"new","remember","know", and optionally"guess".- confidence
The name of the column coding confidence on the unified old/new scale (integer, 1 = most confident "new" to K = most confident "old"; "new" judgments occupy the low levels, "old" judgments the high levels).
- count
Optional name of a column of response counts. If
NULL(default), each row is treated as a single trial. Non-integer counts are rounded with a warning;NAcounts andNAconfidences are refused.- response
Optional common prefix for the generated count columns (default
""). Pass the same value to theresponseargument ofsdt_cdp().
Value
A data frame with one row per cell: the cell-defining columns
followed by the response count columns, ready to pass to bmm() with an
sdt_cdp() model. The numbers of "new" and "old" confidence levels are
inferred from the data.
Examples
dat <- data.frame(
stimulus = c(1L, 1L, 1L, 0L, 0L, 0L),
judgment = c("remember", "know", "new", "new", "know", "new"),
confidence = c(3L, 2L, 1L, 1L, 3L, 1L),
count = c(40L, 25L, 15L, 55L, 10L, 20L)
)
aggregate_sdt_cdp_data(dat, "judgment", "confidence", "count")
#> stimulus new1 know2 know3 remember2 remember3
#> 1 1 15 25 0 0 40
#> 2 0 75 0 10 0 0