Learn R Programming

MPTinR (version 1.14.1)

get.mpt.fia: Convenient function to get FIA for MPT

Description

get.mpt.fia is a comfortable wrapper for the R-port of Wu, Myung, and Batchelder's (2010) BMPTFIA bmpt.fia. It takes data, a model file, and (optionally) a restrictions file, computes the context-free representation of this file and then feeds this into bmpt.fia which returns the FIA.

Usage

get.mpt.fia(data, model.filename, restrictions.filename = NULL, Sample = 2e+05, 
	model.type = c("easy", "eqn", "eqn2"), round.digit = 6, 
	multicore = FALSE, split = NULL, mConst = NULL)

Value

A data.frame containing the results as returned by bmpt.fia:

CFIA

The FIA complexity value of the model with the corresponding confidence interval CI.l (lower bound) and CI.u (upper bound).

lnInt

The log integral term in C_FIA (Wu, Myung, & Batchelder, 2010a; Equation 7) for models without inequality constraints. When inequality constraints are present, 'lnInt' does not take into account the change in the normalizing constant in the proposal distribution and must be adjusted with the output argument `lnconst'. The corresponding confidence interval ranges from CI.lnint.l (lower bound) to CI.lnint.u (upper bound).

lnconst

When inequality constraints are present, lnconst serves as an adjustment of codelnInt. It estimates the logarithm of the proportion of parameter space [0,1]^S that satisfies those inequality constraints, and the log integral term is given by lnInt+lnconst.

The next [two] output argument [CI.lnconst] give the Monte Carlo confidence interval of `lnconst'. [.l = lower & .u = upper bound of the CI]

Arguments

data

Same as in fit.mpt

model.filename

Same as in fit.mpt

restrictions.filename

Same as in fit.mpt

Sample

The number of random samples to be drawn in the Monte Carlo algorithm. Default is 200000.

model.type

Same as in fit.mpt

round.digit

scalar numeric indicating to which decimal the ratios between ns in trees should be rounded (for minimizing computations with differing ns, see Details)

multicore

Same as in bmpt.fia

split

Same as in bmpt.fia

mConst

A constant which is added in the Monte Carlo integration to avoid numerical underflows and is later subtracted (after appropriate transformation). Should be a power of 2 to avoid unnecessary numerical imprecision.

Author

Henrik Singmann

Details

This function is called from fit.mpt to obtain the FIA, but can also be called independently.

It performs the following steps:
1.) Equality restrictions (if present) are applied to the model.
2.) The representation of the model as equations is transformed to the string representation of the model into the context-free language of MPT models (L-BMPT; Purdy & Batchelder, 2009). For this step to be successful it is absolutely necessary that the equations representing the model perfectly map the tree structure of the MPT. That is, the model file is only allowed to contain parameters, their negations (e.g., Dn and (1 - Dn)) and the operators + and *, but nothing else. Simplifications of the equations will seriously distort this step. This step is achieved by calling make.mpt.cf.
Note that inequality restrictions are not included in this transformation.
3.) The context free representation of the model is then fed into the MCMC function computing the FIA (the port of BMPTFIA provided by Wu, Myung, & Batchelder, 2010; see bmpt.fia).
If inequality restrictions are present, these are specified in the call to bmpt.fia.

For multi-individual data sets (i.e., data is a matrix or data.frame), get.mpt.fia tries to minimize computation time. That is done by comparing the ratios of the number items between trees. To not run into problems related to floating point precision, these values are rounded to round.digit. Then, get.mpt.fia will only call bmpt.fia as many times as there are differing ratios. As a consequence, the final penalty factor for FIA (CFIA) is calculated by get.mpt.fia, without providing confidence intervals for the penalty factor.

References

Purdy, B. P., & Batchelder, W. H. (2009). A context-free language for binary multinomial processing tree models. Journal of Mathematical Psychology, 53, 547-561.

Wu, H., Myung, J.I., & Batchelder, W.H. (2010). Minimum description length model selection of multinomial processing tree models. Psychonomic Bulletin & Review, 17, 275-286.

See Also

calls bmpt.fia
is called by fit.mpt, the main function for fitting MPT models

Examples

Run this code

# Get the FIA for the 40 datasets from Broeder & Schuetz (2009, Experiment 3)
# for the 2HTM model with inequality restrictions
# (Can take a while.)

data(d.broeder)
m.2htm <- system.file("extdata", "5points.2htm.model", package = "MPTinR")
i.2htm <- system.file("extdata", "broeder.2htm.ineq", package = "MPTinR")

get.mpt.fia(d.broeder, m.2htm, Sample = 1000) # Way too little samples
get.mpt.fia(d.broeder, m.2htm, i.2htm, Sample = 1000)

if (FALSE) {
# should produce very similar results:
get.mpt.fia(d.broeder, m.2htm, i.2htm)
get.mpt.fia(d.broeder, m.2htm, i.2htm, mConst = 2L^8)
}
  

Run the code above in your browser using DataLab