| cswald_dist | R Documentation |
cswald)These functions provide the density, distribution, quantile, and random
generation functions for the censored shifted Wald model: cswald.
The random generation (rcswald) and distribution functions (pcswald,
qcswald) use rtdists::rdiffusion(), rtdists::pdiffusion(), and
rtdists::qdiffusion() internally for the "crisk" version, which is
theoretically consistent since the censored shifted Wald model is an
approximation to the Wiener diffusion model for tasks with high accuracy
(few errors).
dcswald(
rt,
response,
drift,
bound,
ndt,
zr = 0.5,
s = 1,
version = c("simple", "crisk"),
log = TRUE
)
rcswald(n, drift, bound, ndt, zr = 0.5, s = 1)
pcswald(
q,
response,
drift,
bound,
ndt,
zr = 0.5,
s = 1,
version = "simple",
lower.tail = TRUE,
log.p = FALSE
)
qcswald(
p,
response,
drift,
bound,
ndt,
zr = 0.5,
s = 1,
version = "simple",
lower.tail = TRUE,
log.p = FALSE
)
rt |
A vector of response times in seconds for which the likelihood should be evaluated |
response |
A vector of responses coded numerically: 0 = lower response, 1 = upper response |
drift |
The drift rate |
bound |
The boundary separation |
ndt |
The non-decision time |
zr |
The relative starting point (proportion of boundary separation).
Default is |
s |
The diffusion constant - the standard deviation of the noise in the
evidence accumulation process. Default is |
version |
A character string specifying the version of the |
log |
A single logical value indicating if log-likelihoods should be
returned, the default is |
n |
The number of random samples that should be generated |
q |
A vector of quantiles (response times) at which to evaluate the CDF |
lower.tail |
Logical; if |
log.p |
Logical; if |
p |
A vector of probabilities for which to compute quantiles |
Cumulative Distribution Function (pcswald)
For the "simple" version, the CDF is only defined for response = 1
(correct responses), as errors are treated as censored observations. The
CDF returns the probability that a correct response occurs by time q.
For response = 0, NA is returned with a warning.
For the "crisk" version (competing risks), the CDF computes the defective
cumulative distribution P(RT <= q, response = r), which is the probability
of responding with the specified response by time q. This uses
rtdists::pdiffusion() internally for accurate computation.
Quantile Function (qcswald)
The quantile function returns the response time q such that
P(RT <= q) = p. Similar to the CDF, for the "simple" version this is only
defined for response = 1. For the "crisk" version, this uses
rtdists::qdiffusion() internally.
dcswald() returns a numeric vector of (log-)likelihoods.
rcswald() returns a data.frame with columns rt (response times) and
response (1 = upper, 0 = lower).
pcswald() returns a numeric vector of (log-)probabilities.
qcswald() returns a numeric vector of quantiles (response times).
rtdists::rdiffusion(), rtdists::pdiffusion(),
rtdists::qdiffusion() for the underlying functions
dat <- rcswald(n = 1000, drift = 2, bound = 1, ndt = 0.3)
head(dat)
hist(dat$rt)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.