This function needs data and a model files and outputs the exact command needed to obtain the minimum description length measure for MPT models using the procedure by Wu, Myung, and Batchelder (2010) for MATLAB. It can be considered an extended wrapper for make.mpt.cf
.
prepare.mpt.fia(data, model.filename, restrictions.filename = NULL,
outfile = "clipboard", Sample = 2e+05, model.type = c("easy", "eqn", "eqn2"))
The most important value is the output to a file or clipboard (Windows only) of the MATLAB code to get the minimum description length. For multiple individuals multiple outputs are generated which only differ if the ns of the data differ. Furthermore, each argument is returned in a list:
The string representation of the model.
A list of the numbers representing the parameters.
A vector describing which number corresponds to which parameter in the parameters vector.
The numbers representing the categories.
The matrix representing the inequality constraints.
The n of the data.
The L-BMPT representation as returned by make.mpt.cf
.
Either a numeric vector
for individual fit or a numeric matrix
or data.frame
for multi-individual fit. The data on each position (column for multi individual fit) must correpsond to the relevant line in the model file.
A character vector
specifying the location and name of the model file.
NULL
or a character vector
specifying the location and name of the restrictions file. Default is NULL
which corresponds to no restrictions.
A character vector specifying the name of the file where the MATLAB code is saved. Default is "clipboard"
which will copy the output to the clipboard and will not write it to a file (Windows only). Actually, this parameter is directly passed to writeLines
which interprets character vectors as filenames, so any other legal connection
can be used.
Number of Monte Carlo samples to be used by the procedure of Wu, Myung, and Batchelder (2010). Default is 200.000.
Character vector specifying whether the model file is formatted in the easy
format ("easy"
; i.e., each line represents all branches corresponding to a response categories) or the traditional EQN syntax ("eqn"
or "eqn2"
). See Details in fit.mpt
.
Henrik Singmann
This function uses make.mpt.cf
to create the representation in the L-BMPT. Therefore, it is necessary that the representation of the model via equations in the model file exactly maps on the structure of the binary tree (see make.mpt.cf
for more details).
Whereas fit.mpt
can reparameterize MPT models for fitting inequality constraints, Wu, Myung, and Batchelder (2010) have used another method to deal with these issues that is also adopted here. Our function does not report a reparameterized version of the MPT model that satisfies the inequality contraints, but modifies the appropriate argument in the call to the function by Wu et al (2010).
Note that MATLAB needs the statistics toolbox to run the script by Wu, Myung, and Batchelder (2010).
Wu, H., Myung, J., I., & Batchelder, William, H. (2010). Minimum description length model selection of multinomial processing tree models. Psychonomic Bulletin & Review, 17, 275-286.
Since we ported the original BMPTFIA function by Wu, Myung, & Batchelder (2010) to R (bmpt.fia
), this function is a little bit outdated. However, getting the FIA in Matlab is (still) faster than getting it in R.
See also get.mpt.fia
which takes the same arguments but will then compute the FIA using the function provided by Wu et al. (2010) ported to R.
make.mpt.cf
if (FALSE) {
# This example produces the code for the first example of how to use the
# function by Wu, Myung & Batchelder (2010, pp. 280):
# Value should be around 12.61 and 12.62
model.1htm <- system.file("extdata", "wmb.ex1.model", package = "MPTinR")
model.1htm.restr <- system.file("extdata", "wmb.ex1.restr", package = "MPTinR")
prepare.mpt.fia(c(250,0,0,250,0,0,500,0,0), model.1htm, model.1htm.restr)
}
Run the code above in your browser using DataLab