Description Usage Arguments Details Value Author(s) See Also
generate.data
in MPTinR is a generic function that generates random data or predicted data for MPT models from given parameter values.
1 2 3 4 | ## S4 method for signature 'mpt.model'
generate.data(model, parameter.values, n.per.tree, n = 1, random = TRUE, ...)
## S4 method for signature 'mpt'
generate.data(model, n = 1, random = TRUE, ...)
|
model |
Either a MPT model (an object of class |
parameter.values |
named vector or matrix with the parameter estiamtes to be used for data generation. If a vector, |
n.per.tree |
vector or matrix with length/ number of columns corresponding to the number of categories in the model. Each value must correspond to the n per tree for that category. If a matrix, each row represents one set of ns. |
n |
numeric. Number of random samples to be drawn per set of parameter values (ignored if |
random |
logical. If |
... |
currently ignored. |
This function generates data from either a mutlinomial processing tree (MPT) model object as produced by make.mpt
(which is either of class bmpt.model
or mpt.model
) or a fitted MPT model object as produced by fit.mpt
(which is either of class bmpt
or mpt
).
To generate data from a MPT models you also need to specify parameter values and the desired n. Both can be vectors to generate data from a single individual or a matrix to generate data from multiple individuals with each row corresponding to a single individual. The parameter values need to ba a named object, either a vector or a matrix. The names
for a vector or the colnames
of a matrix need to correspond to the free parameters in the model. Additional parameters or named objects not part of the model should be ignored.
If random
is TRUE, a 3-dimensional array with dim(n, n.categories, n.parameter.sets)
:
first dimension |
the number of random draws for each set of parameters (i.e., = |
second dimension |
the response categories in the model |
third dimension |
the parameter set (i.e., the number of the row in the |
If random
is FALSE, a vector or matrix containing the (non-rounded) expected values.
Henrik Singmann
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.