readEQN | R Documentation |
Function to import MPT models from standard .eqn model files as used, for instance, by multiTree (Moshagen, 2010).
readEQN(file, restrictions = NULL, paramOrder = FALSE, parse = FALSE)
file |
The (full path to the) file that specifies the MPT model
(standard .eqn syntax). Note that category labels must start with a letter
(different to multiTree) and match the column names of |
restrictions |
Specifies which parameters should be (a) constant (e.g.,
|
paramOrder |
if TRUE, the order of MPT parameters as interally used is printed. |
parse |
whether to return a parsed MPT model description in terms of the
matrices |
The file format should adhere to the standard .eqn-syntax (note that
the first line is skipped and can be used for comments). In each line, a
separate branch of the MPT model is specified using the tree label,
category label, and the model equations in full form (multiplication sign
*
required; not abbreviations such as a^2
allowed).
As an example, the standard two-high threshold model (2HTM) is defined as follows:
Target | Hit | Do |
||
Target | Hit | (1-Do)*g |
||
Target | Miss | (1-Do)*(1-g) |
||
Lure | FalseAlarm | (1-Dn)*g |
||
Lure | CorrectReject | (1-Dn)*(1-g) |
||
Lure | CorrectReject | Dn
|
for the default setting parse = FALSE
, the function returns a data.frame
with the following columns:
Tree
: the tree label
Category
: the category label (must match the columns in the data set)
Equation
: the model equation without parameter restrictions
EQN
: the model equation with restricted parameters replaced
Daniel Heck, Denis Arnold, Nina Arnold
Moshagen, M. (2010). multiTree: A computer program for the analysis of multinomial processing tree models. Behavior Research Methods, 42, 42-54.
# Example: Standard Two-High-Threshold Model (2HTM)
EQNfile <- system.file("MPTmodels/2htm.eqn",
package = "TreeBUGS"
)
readEQN(file = EQNfile, paramOrder = TRUE)
# with equality constraint:
readEQN(
file = EQNfile, restrictions = list("Dn = Do", "g = 0.5"),
paramOrder = TRUE
)
# define MPT model directly within R
model <-
"2-High Threshold Model (2HTM)
old hit d
old hit (1-d)*g
old miss (1-d)*(1-g)
new fa (1-d)*g
new cr (1-d)*(1-g)
new cr d"
readEQN(model, paramOrder = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.