Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

readEQN

Read multiTree files


Description

Function to import MPT models from standard .eqn model files as used, for instance, by multiTree (Moshagen, 2010).

Usage

readEQN(file, restrictions = NULL, paramOrder = FALSE, parse = FALSE)

Arguments

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 data. Alternatively, the EQN-equations can be provided within R as a character value (see examples). Note that the first line of an .eqn-file is reserved for comments and always ignored.

restrictions

Specifies which parameters should be (a) constant (e.g., "a=b=.5") or (b) constrained to be identical (e.g., "Do=Dn") or (c) treated as fixed effects (i.e., identical for all participants; "a=b=FE"). Either given as the path to a text file with restrictions per row or as a list of restrictions, e.g., list("D1=D2","g=0.5"). Note that numbers in .eqn-equations (e.g., d*(1-g)*.50) are directly interpreted as equality constraints.

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 a and b (the powers of the θ and (1-θ), respectively, and the vector of constants c. Each branch probability is then given as c_{i} ∏_{s} θ^{a_{i,s}}(1-θ)^{b_{i,s}})

Details

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

Author(s)

Daniel Heck, Denis Arnold, Nina Arnold

References

Moshagen, M. (2010). multiTree: A computer program for the analysis of multinomial processing tree models. Behavior Research Methods, 42, 42-54.

Examples

# 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)

TreeBUGS

Hierarchical Multinomial Processing Tree Modeling

v1.4.7
GPL-3
Authors
Daniel W. Heck [aut, cre] (<https://orcid.org/0000-0002-6302-9252>), Nina R. Arnold [aut, dtc], Denis Arnold [aut], Alexander Ly [ctb], Marius Barth [ctb] (<https://orcid.org/0000-0002-3421-6665>)
Initial release
2021-01-08

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.