mpt: Multinomial Processing Tree (MPT) Models

View source: R/mpt.R

mptR Documentation

Multinomial Processing Tree (MPT) Models

Description

Fits a (joint) multinomial processing tree (MPT) model specified by a symbolic description via mptspec.

Usage

mpt(spec, data, start = NULL, method = c("BFGS", "EM"), treeid = "treeid",
    freqvar = "freq", optimargs = 
      if(method == "BFGS") list(control =
        list(reltol = .Machine$double.eps^(1/1.2), maxit = 1000))
      else list())

## S3 method for class 'mpt'
anova(object, ..., test = c("Chisq", "none"))

## S3 method for class 'mpt'
coef(object, logit = FALSE, ...)

## S3 method for class 'mpt'
confint(object, parm, level = 0.95, logit = TRUE, ...)

## S3 method for class 'mpt'
predict(object, newdata = NULL, type = c("freq", "prob"), ...)

## S3 method for class 'mpt'
summary(object, ...)

Arguments

spec

an object of class mptspec: typically result of a call to mptspec. A symbolic description of the model to be fitted. (See Details and Examples.)

data

a data frame consisting at least of one variable that contains the absolute response frequencies. Alternatively, a (named) vector or matrix of frequencies.

start

a vector of starting values for the parameter estimates between zero and one.

method

optimization method. Implemented are optim(..., method = "BFGS") and the EM algorithm.

treeid

name of the variable that identifies the processing trees of a joint multinomial model. Alternatively, a factor that identifies each tree.

freqvar

if data is a data frame, name of the variable that holds the response frequencies; else ignored.

logit

logical. Parameter estimates on logit or probability scale.

optimargs

a list of arguments passed to the optimization function, either optim or mptEM.

object

an object of class mpt, typically the result of a call to mpt.

test

should the p-values of the chi-square distributions be reported?

parm, level

See confint.default.

newdata

a vector of response frequencies.

type

predicted frequencies or probabilities.

...

additional arguments passed to other methods.

Details

Multinomial processing tree models (Batchelder & Riefer, 1999; Erdfelder et al., 2009; Riefer & Batchelder, 1988) seek to represent the categorical responses of a group of subjects by a small number of latent (psychological) parameters. These models have a tree-like graph, the links being the parameters, the leaves being the response categories. The path from the root to one of the leaves represents the cognitive processing steps executed to arrive at a given response.

If data is a data frame, each row corresponds to one response category. If data is a vector or matrix, each element or column corresponds to one response category. The order of response categories and of model equations specified in mptspec should match.

Joint (or product) multinomial models consist of more than one processing tree. The treeid should uniquely identify each tree.

Per default, parameter estimation is carried out by optim's BFGS method on the logit scale with analytical gradients; it can be switched to mptEM which implements the EM algorithm.

Value

An object of class mpt containing the following components:

coefficients

a vector of parameter estimates. For extraction, the coef function is preferred.

loglik

the log-likelihood of the fitted model.

nobs

the number of nonredundant response categories.

fitted

the fitted response frequencies.

goodness.of.fit

the goodness of fit statistic including the likelihood ratio fitted vs. saturated model (G2), the degrees of freedom, and the p-value of the corresponding chi-square distribution.

ntrees

the number of trees in a joint multinomial model.

n

the total number of observations per tree.

y

the vector of response frequencies.

pcat

the predicted probabilities for each response category.

treeid

a factor that identifies each tree.

a, b, c

structural constants passed to mptEM.

spec

the MPT model specification returned by mptspec.

method

the optimization method used.

optim

the return value of the optimization function.

References

Batchelder, W.H., & Riefer, D.M. (1999). Theoretical and empirical review of multinomial process tree modeling. Psychonomic Bulletin & Review, 6(1), 57–86. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.3758/bf03210812")}

Erdfelder, E., Auer, T., Hilbig, B.E., Assfalg, A., Moshagen, M., & Nadarevic, L. (2009). Multinomial processing tree models: A review of the literature. Zeitschrift fuer Psychologie, 217(3), 108–124. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1027/0044-3409.217.3.108")}

Riefer, D.M., & Batchelder, W.H. (1988). Multinomial modeling and the measurement of cognitive processes. Psychological Review, 95(3), 318–339. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1037/0033-295x.95.3.318")}

See Also

mptEM, mptspec, simulate.mpt, plot.mpt, residuals.mpt, logLik.mpt, vcov.mpt, optim.

Examples

## Storage-retrieval pair-clustering model (Riefer & Batchelder, 1988)
data(retroact)

spec <- mptspec(
  c*r,
  (1 - c)*u^2,
  2*(1 - c)*u*(1 - u),
  c*(1 - r) + (1 - c)*(1 - u)^2,
  u,
  1 - u
)
m <- mpt(spec, retroact[retroact$lists == 0, ])

summary(m)  # parameter estimates, goodness of fit
plot(m)     # residuals versus predicted values
confint(m)  # approximate confidence intervals

plot(coef(m), axes = FALSE, ylim = 0:1, pch = 16, xlab = "",
     ylab = "Parameter estimate (MPT model, 95% CI)")
axis(1, 1:3, names(coef(m))); axis(2)
arrows(1:3, plogis(confint(m))[, 1], 1:3, plogis(confint(m))[, 2],
       .05, 90, 3)

## See data(package = "mpt") for application examples.

mpt documentation built on Oct. 11, 2024, 5:07 p.m.