Computes empirical (observed) ROC points from the response-count data used to
fit a sdt_rating() or sdt_yn() model. Rating models pool counts
across observations within each stimulus type (and optional condition) to
produce cumulative hit/false-alarm rates at each confidence threshold; binary
models produce one operating point per criterion level (the empirical
counterpart of the model-implied points from roc_sdt()).
Value
A data frame of class "bmm_sdt_roc_observed" with columns FA,
Hit, and any condition columns. Rating models additionally include the
(0,0) and (1,1) endpoints. The attribute model_type is "rating" or
"binary"; rating results also carry n_ratings.
Examples
if (FALSE) { # \dontrun{
# Three base-rate conditions shift the criterion, which identifies sdratio
dat <- expand.grid(id = 1:20, stimulus = c(0L, 1L),
condition = c("liberal", "neutral", "strict"))
dat$n_trials <- 100L
# simulated as bias, measured from the midpoint between the means (0 = boundary at the midpoint)
criteria <- c(liberal = -0.5, neutral = 0, strict = 0.5)
dat$n_old <- rsdt_yn(nrow(dat), dat$n_trials, dat$stimulus, d = 1.5,
bias = criteria[as.character(dat$condition)],
sdratio = 1.3)
fit <- bmm(
formula = bmf(d ~ 1, criterion ~ 0 + condition, sdratio ~ 1),
data = dat,
model = sdt_yn(response = "n_old", stimulus = "stimulus",
n_trials = "n_trials"),
cores = 4,
backend = "cmdstanr"
)
# One point per base-rate condition, from the response counts
obs <- roc_observed(fit)
obs
plot(roc_sdt(fit), observed = obs)
} # }
