| mptdist | R Documentation |
Density and random generation functions for multinomial
processing tree models specified with mpt(). Please note that these
functions are currently not vectorized.
dmpt(x, pars, mpt_model, tree = NULL, log = TRUE, covariates = NULL, ...)
rmpt(
n,
size,
pars,
mpt_model,
tree = NULL,
unpack = FALSE,
covariates = NULL,
...
)
x |
Integer vector of length |
pars |
A named vector or list with the values of at least the latent
parameters appearing in the branch expressions of the selected tree, on
the probability scale and strictly between 0 and 1, as for fixed
parameters in |
mpt_model |
A |
tree |
Character. For models with multiple trees, the name of the tree to compute probabilities for. Can be omitted for single-tree models. |
log |
Logical; if |
covariates |
A named vector or list with the values of all covariates declared in the model that appear in the branch expressions of the selected tree. |
... |
can be used to pass additional values used in the branch
expressions, as an alternative to the |
n |
Integer. Number of observations to generate data for. |
size |
The total number of observations across all response categories. |
unpack |
Logical; if |
dmpt gives the multinomial density of a vector of response counts,
and rmpt generates random response counts for the response categories.
Unlike the densities of the circular models in this package (dsdm(),
dmixture2p(), dmixture3p(), dimm()) and unlike stats::dmultinom(),
dmpt() returns the log density by default, matching dm3().
Batchelder, W. H., & Riefer, D. M. (1999). Theoretical and empirical review of multinomial process tree modeling. Psychonomic Bulletin & Review, 6(1), 57-86. https://doi.org/10.3758/BF03210812
tree_target <- mpt_tree("target", list(
old = "D + (1 - D) * g",
new = "(1 - D) * (1 - g)"
))
tree_lure <- mpt_tree("lure", list(
old = "(1 - D) * g",
new = "D + (1 - D) * (1 - g)"
))
model <- mpt(list(tree_target, tree_lure), tree_id = "item_type")
dmpt(
x = c(35, 15), pars = c(D = 0.7, g = 0.5),
mpt_model = model, tree = "target"
)
rmpt(
n = 10, size = 50, pars = c(D = 0.7, g = 0.5),
mpt_model = model, tree = "lure"
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.