
Distribution functions for Continuous Dual-Process SDT (CDP)
Source:R/distributions.R
sdt_cdp_dist.RdDensity and random generation for the continuous dual-process
signal detection theory model (Wixted & Mickes, 2010). Two correlated
continuous dimensions, Familiarity (F) and Recollection (R), generate the
aggregate strength S = F + R that drives old/new confidence; Remember/Know
judgments split "old" responses on R, and an optional Know/Guess split uses
F. The response is a vector of counts across the response categories
(multinomial likelihood), in the same format sdt_cdp() is fit to. See
sdt_cdp() for the model and sdt_rating() when no R/K split is
available.
Usage
dsdt_cdp(
counts,
stimulus,
dfam,
drec,
thresholds,
rcrit,
kcrit = NULL,
sigmar = 0,
rho = 0,
n_new = NULL,
dist = "normal",
log = FALSE
)
rsdt_cdp(
n,
n_trials,
stimulus,
dfam,
drec,
thresholds,
rcrit,
kcrit = NULL,
sigmar = 0,
rho = 0,
n_new = NULL,
dist = "normal"
)Arguments
- counts
Integer matrix with one row per observation and one column per response category in the canonical order
new,[guess],know,remember(each block ordered by confidence; seesdt_cdp()), or a vector for a single observation. A data frame is read as the matrix of its rows.n_new + 2 * n_oldcolumns (R/K) orn_new + 3 * n_old(R/K/G).- stimulus
Integer vector (0/1). Stimulus type: 0 = new/lure, 1 = old/target.
- dfam, drec
Numeric vectors. Familiarity and recollection sensitivities: the target means on the F and R axes, each in units of the corresponding lure SD (both lure SDs are 1). They are component means of a bivariate latent space, not the balanced \(d_a\) that the other SDT models report as
d– the old/new decision here is read off the aggregate strength S = F + R, so the model's discriminability is a derived quantity rather than either of these.- thresholds
Numeric vector of
n_new + n_old - 1ordered confidence thresholds on the aggregate F+R axis, or a matrix with one row per observation.- rcrit
Numeric vector. Remember criterion on the recollection axis.
- kcrit
Know criterion on the familiarity axis.
NULL(default), or a non-finite value for every observation, gives the R/K model; finite values for every observation give the R/K/G model. Akcritwith any non-finite element gives the R/K model for the whole call, also for the observations whosekcritis finite, and warns when there are such observations. Every element counts, also one past the last observation: with one draw,kcrit = c(0.2, Inf)gives R/K and a warning. The length ofkcritsets the number of observations only when every element is finite (the R/K/G model): with one row ofcounts,kcrit = c(0.2, 0.3)gives two values andkcrit = c(0.2, Inf)one.- sigmar
Numeric vector. Log SD of the recollection target distribution (0 = SD 1).
- rho
Numeric vector. F-R correlation on the unconstrained scale;
tanh(rho)is the correlation. 0 (default) = independent processes (classic CDP).- n_new
Integer number of "new" confidence levels. Defaults to half the number of confidence levels, rounded down (so 3 of 7); the number of "old" levels follows as
length(thresholds) + 1 - n_new.- dist
Noise distribution. Only
"normal"is currently supported.- log
Logical; if
TRUEreturn the log-density (defaultFALSE).- n
Integer. Number of observations to generate.
n_trials,stimulus,thresholds, and the model parameters are recycled to this length.- n_trials
Integer vector. Number of trials per observation.
Value
dsdt_cdp returns the (log-)density (multinomial probability).
rsdt_cdp returns an integer matrix with one row per observation and the
canonical response count columns (new1, ..., remember<K>) that
sdt_cdp() expects – cbind() it to a design data frame for a
ready-to-fit data set.
Vector arguments
r*(n, ...)returns exactlyndraws: a vector, or a data frame or matrix withnrows. Every per-observation argument (a parameter, a stimulus, a number of trials) is recycled to lengthnwithrep_len(), as instats::rnorm(): drawiuses elementi, and a matrix is read element by element; only a set of values per draw, such asthresholds, takes rowiof a matrix (see below). A shorter vector is repeated, also whennis not a multiple of its length. Until bmm 1.6.0 at the earliest,rddm()withn = 1and parameter vectors still returns one draw per element, with a deprecation warning.nis a single number of at least 0. A fraction is truncated, as instats::rnorm(), andn = 0gives an empty vector, or a matrix or data frame with zero rows and the usual columns. Unlikestats::rnorm(), which takes the length of a vectorn, these functions stop on one;rddm()still takes its length, with a deprecation warning.d*(x, ...)returns one value per observation: as many as the longest ofx(its rows, when the observations are rows of counts) and the per-observation arguments, the others recycled to that length. Valueiis what the call on thei-th elements alone returns. A matrix in an argument that takes one number per observation, such asxord, holds one observation per element, as instats::dnorm(). Whenxor any per-observation argument is empty, the result is empty, as instats::dnorm(). ANULLargument, such as a misspelt column of a data frame, counts as empty, except where the default isNULL, as forcriterionorkcrit: there it means that the argument is not given. Where an observation is a vector of counts (dsdt_rating(),dsdt_dpsdt(),dsdt_metad(),dsdt_ranking()anddsdt_cdp()), or the pair ofmean_rtorvar_rtvalues ofdezdm(version = "4par"), a vector is always one observation: pass a matrix with zero rows for none, as an empty vector stops. An emptykcritofdsdt_cdp()andrsdt_cdp()stops as well;kcrit = NULLgives the R/K model. Counts in a data frame, a tibble included, are read as the matrix of its rows, and so aremean_rtandvar_rtofdezdm(version = "4par").dsdm()with a data framexis the exception: it returns a data frame of the same shape, one density per cell, and cuts longer parameters to the number of cells.A set of values that describes one observation, such as the
thresholdsof the rating models or the item locationsmu(anddist) ofdmixture3p()anddimm(), is a vector when every observation shares it and a matrix with one row per observation otherwise: rowibelongs to observationi, or to drawi. Item locations are padded withNApast each row's set size, and a data frame of them is read as the matrix of its rows. As for counts, an empty vector of them stops: pass a matrix with zero rows for no observations.Configuration arguments such as
version,distof the ranking models,log,parametrizationandn_neware single values and are never recycled. An argument that a version does not use, such aszrofdezdm(version = "3par"), is ignored.
References
Wixted, J. T., & Mickes, L. (2010). A continuous dual-process model of remember/know judgments. Psychological Review, 117(4), 1025–1054. doi:10.1037/a0020874
Examples
# CDP density (R/K, 1 new + 3 old levels: 3 thresholds, 7 count columns)
dsdt_cdp(
counts = c(40, 5, 12, 30, 10, 18, 60), stimulus = 1,
dfam = 0.8, drec = 1.0,
thresholds = c(-0.5, 0.3, 1.0),
rcrit = 0.7, n_new = 1
)
#> [1] 1.870555e-27
# Generate CDP count data (R/K, 3 new + 3 old levels) for 10 subjects
dat <- expand.grid(id = 1:10, stimulus = c(0L, 1L))
dat <- cbind(dat, rsdt_cdp(nrow(dat), 100, dat$stimulus,
dfam = 0.8, drec = 1.0,
thresholds = c(-1.1, -0.5, 0, 0.6, 1.3),
rcrit = 0.5, n_new = 3))
head(dat)
#> id stimulus new1 new2 new3 know4 know5 know6 remember4 remember5 remember6
#> 1 1 0 17 13 15 12 8 7 5 12 11
#> 2 2 0 29 20 12 9 3 5 2 9 11
#> 3 3 0 31 18 10 11 5 5 1 9 10
#> 4 4 0 19 12 15 15 9 0 4 9 17
#> 5 5 0 21 12 14 15 5 4 7 6 16
#> 6 6 0 23 18 9 16 11 5 2 7 9