
Generating a data file with known parameter structure using the Beta-MPT. Useful for simulations and robustness checks.
genBetaMPT(
N,
numItems,
eqnfile,
restrictions,
mean = NULL,
sd = NULL,
alpha = NULL,
beta = NULL,
warning = TRUE
)
a list including the generated frequencies (data
) and the
true, underlying parameters (parameters
) on the group and individual
level.
number of participants
number of responses per tree (a named vector with tree labels)
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.
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.
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
).
named vector of group standard deviations of individual MPT parameters.
Alternative specification of the group-level distribution using the shape parameters of the beta distribution (see dbeta).
see alpha
whether to show warning in case the naming of data-generating parameters are unnamed or do not match
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
.
Smith, J. B., & Batchelder, W. H. (2010). Beta-MPT: Multinomial processing tree models for addressing individual differences. Journal of Mathematical Psychology, 54, 167-183.
genMPT
# 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)
Run the code above in your browser using DataLab