genBetaMPT: Generate Data for Beta MPT Models

View source: R/genDataBeta.R

genBetaMPTR Documentation

Generate Data for Beta MPT Models

Description

Generating a data file with known parameter structure using the Beta-MPT. Useful for simulations and robustness checks.

Usage

genBetaMPT(
  N,
  numItems,
  eqnfile,
  restrictions,
  mean = NULL,
  sd = NULL,
  alpha = NULL,
  beta = NULL,
  warning = TRUE
)

Arguments

N

number of participants

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.

mean

Named vector of true group means of individual MPT parameters. If the vector is not named, the internal order of parameters is used (can be obtained using readEQN).

sd

named vector of group standard deviations of individual MPT parameters.

alpha

Alternative specification of the group-level distribution using the shape parameters of the beta distribution (see dbeta).

beta

see alpha

warning

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

Details

Data are generated in a two-step procedure. First, person parameters are sampled from the specified beta distributions for each paramter (either based on mean/sd or based on alpha/beta). In a second step, response frequencies are sampled for each person using genMPT.

Value

a list including the generated frequencies (data) and the true, underlying parameters (parameters) on the group and individual level.

References

Smith, J. B., & Batchelder, W. H. (2010). Beta-MPT: Multinomial processing tree models for addressing individual differences. Journal of Mathematical Psychology, 54, 167-183.

See Also

genMPT

Examples

# Example: Standard Two-High-Threshold Model (2HTM)
EQNfile <- system.file("MPTmodels/2htm.eqn", package = "TreeBUGS")
genDat <- genBetaMPT(
  N = 100,
  numItems = c(Target = 250, Lure = 250),
  eqnfile = EQNfile,
  mean = c(Do = .7, Dn = .5, g = .5),
  sd = c(Do = .1, Dn = .1, g = .05)
)
head(genDat$data, 3)
plotFreq(genDat$data, eqn = EQNfile)

denis-arnold/TreeBUGS documentation built on May 13, 2024, 6:34 p.m.