mxBootstrapEval {OpenMx}R Documentation

Evaluate Values in a bootstrapped MxModel


This function can be used to evaluate an arbitrary R expression that includes named entities from a MxModel object, or labels from a MxMatrix object.


mxBootstrapEval(expression, model, defvar.row = 1, ...,
 bq=c(.25,.75), method=c('bcbci','quantile'))

mxBootstrapEvalByName(name, model, defvar.row = 1, ...,
 bq=c(.25,.75), method=c('bcbci','quantile'))

omxBootstrapEval(expression, model, defvar.row = 1L, ...)

omxBootstrapEvalCov(expression, model, defvar.row = 1L, ...)

omxBootstrapEvalByName(name, model, defvar.row=1L, ...)



An arbitrary R expression.


The character name of an object to evaluate.


The model in which to evaluate the expression.


The row number for definition variables when compute=TRUE; defaults to 1. When compute=FALSE, values for definition variables are always taken from the first (i.e., first before any automated sorting is done) row of the raw data.


Not used. Forces remaining arguments to be specified by name.


numeric. A vector of quantiles to be used to summarize bootstrap replication.


character. One of ‘quantile’ or ‘bcbci’.


The argument ‘expression’ is an arbitrary R expression. Any named entities that are used within the R expression are translated into their current value from the model. Any labels from the matrices within the model are translated into their current value from the model. Finally the expression is evaluated and the result is returned. To enable debugging, the ‘show’ argument has been provided. The most common mistake when using this function is to include named entities in the model that are identical to R function names. For example, if a model contains a named entity named ‘c’, then the following mxEval call will return an error: mxEval(c(A, B, C), model).

The mxEvalByName function is a wrapper around mxEval that takes a character instead of an R expression.

The default behavior is to use the ‘bcbci’ method, due to its superior theoretical properties. However, its bias-correction can lead to nonsensical results if the number of bootstrap replications is too small for the desired coverage probability. For example, a lower confidence limit of -Inf, or an upper confidence limit smaller than the point estimate, are signals that more replications are needed.


omxBootstrapEval and omxBootstrapEvalByName return the raw matrix of cvectorize'd results. omxBootstrapEvalCov returns the covariance matrix of the cvectorize'd results. mxBootstrapEval and mxBootstrapEvalByName return the cvectorize'd results summarized by method at quantiles bq.


The OpenMx User's guide can be found at

See Also

mxAlgebra to create algebraic expressions inside your model and mxModel for the model object mxEval looks inside when evaluating. mxBootstrap to create bootstrap data.



testModel <- mxModel(
  mxData(data.frame(weight=1.0, value=1:10), "raw", weight = "weight"),
  mxMatrix("Full", nrow = 1, ncol = 1, values = 1, free=TRUE, name = "A"),
  mxAlgebra(data.weight * filteredDataRow, name = 'rowAlgebra'),
  mxAlgebra((sum(rowResults) - A)^2, name = 'reduceAlgebra'),
  mxFitFunctionRow('rowAlgebra', 'reduceAlgebra', 'value'))

testModel <- mxRun(testModel)
testBoot <- mxBootstrap(testModel)

mxBootstrapEval(A^2, testBoot)

[Package OpenMx version 2.8.3 Index]