genMPT: Generate MPT Frequencies

View source: R/genDataMPT.R

genMPTR Documentation

Generate MPT Frequencies

Description

Uses a matrix of individual MPT parameters to generate MPT frequencies.

Usage

genMPT(theta, numItems, eqnfile, restrictions, warning = TRUE)

Arguments

theta

matrix of MPT parameters (rows: individuals; columns: parameters). Parameters are assigned by column names of the matrix. all of the parameters in the model file need to be included.

numItems

number of responses per tree (a named vector with tree labels)

eqnfile

The (relative or 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 (cf. readEQN). 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.

warning

whether to show warning in case the naming of data-generating parameters are unnamed or do not match

See Also

genTraitMPT and genBetaMPT to generate data for latent normal/beta hierarchical distributions.

Examples

# Example: Standard Two-High-Threshold Model (2HTM)
EQNfile <- system.file("MPTmodels/2htm.eqn", package = "TreeBUGS")
theta <- matrix(
  c(
    .8, .4, .5,
    .6, .3, .4
  ),
  nrow = 2, byrow = TRUE,
  dimnames = list(NULL, c("Do", "Dn", "g"))
)
genDat <- genMPT(
  theta, c(Target = 250, Lure = 250),
  EQNfile
)
genDat

TreeBUGS documentation built on May 31, 2023, 9:21 p.m.