R: MxModel Class

MxModel-class {OpenMx} | R Documentation

## MxModel Class

### Description

MxModel is an S4 class. An MxModel object is a named entity.

### Details

The ‘matrices’ slot contains a list of the MxMatrix objects included in the model. These objects are listed by name. Two objects may not share the same name. If a new MxMatrix is added to an MxModel object with the same name as an MxMatrix object in that model, the added version replaces the previous version. There is no imposed limit on the number of MxMatrix objects that may be added here.

The ‘algebras’ slot contains a list of the MxAlgebra objects included in the model. These objects are listed by name. Two objects may not share the same name. If a new MxAlgebra is added to an MxModel object with the same name as an MxAlgebra object in that model, the added version replaces the previous version. All MxMatrix objects referenced in the included MxAlgebra objects must be included in the ‘matrices’ slot prior to estimation. There is no imposed limit on the number of MxAlgebra objects that may be added here.

The ‘constraints’ slot contains a list of the MxConstraint objects included in the model. These objects are listed by name. Two objects may not share the same name. If a new MxConstraint is added to an MxModel object with the same name as an MxConstraint object in that model, the added version replaces the previous version. All MxMatrix objects referenced in the included MxConstraint objects must be included in the ‘matrices’ slot prior to estimation. There is no imposed limit on the number of MxConstraint objects that may be added here.

The ‘intervals’ slot contains a list of the confidence intervals requested by included MxCI objects. These objects are listed by the free parameters, MxMatrices and MxAlgebras referenced in the MxCI objects, not the list of MxCI objects themselves. If a new MxCI object is added to an MxModel object referencing one or more free parameters MxMatrices or MxAlgebras previously listed in the ‘intervals’ slot, the new confidence interval(s) replace the existing ones. All listed confidence intervals must refer to free parameters MxMatrices or MxAlgebras in the model.

The ‘latentVars’ slot contains a list of latent variable names, which may be referenced by MxPath objects. This slot defaults to 'NA', and is only used when the mxPath function is used. In the context of a RAM model, this slot accepts a character vector of variable names. However, the LISREL model is partitioned into exogenous and endogenous parts. Both exogenous and endogenous variables can be specified using a list like, `list(endo='a', exo='b')`. If a character vector is passed to a LISREL model then those variables will be assumed endogenous.

The ‘manifestVars’ slot contains a list of latent variable names, which may be referenced by MxPath objects. This slot defaults to 'NA', and is only used when the mxPath function is used. In the context of a RAM model, this slot accepts a character vector of variable names. However, the LISREL model is partitioned into exogenous and endogenous parts. Both exogenous and endogenous variables can be specified using a list like, `list(endo='a', exo='b')`. If a character vector is passed to a LISREL model then those variables will be assumed endogenous.

The ‘data’ slot contains an MxData object. This slot must be filled prior to execution when a fitfunction referencing data is used. Only one MxData object may be included per model, but submodels may have their own data in their own ‘data’ slots. If an MxData object is added to an MxModel which already contains an MxData object, the new object replaces the existing one.

The ‘submodels’ slot contains references to all of the MxModel objects included as submodels of this MxModel object. Models held as arguments in other models are considered to be submodels. These objects are listed by name. Two objects may not share the same name. If a new submodel is added to an MxModel object with the same name as an existing submodel, the added version replaces the previous version. When a model containing other models is executed using mxRun, all included submodels are executed as well. If the submodels are dependent on one another, they are treated as one larger model for purposes of estimation.

The ‘independent’ slot contains a logical value indicating whether or not the model is independent. If a model is independent (independent=TRUE), then the parameters of this model are not shared with any other model. An independent model may be estimated with no dependency on any other model. If a model is not independent (independent=FALSE), then this model shares parameters with one or more other models such that these models must be jointly estimated. These dependent models must be entered as submodels of another MxModel objects, so that they are simultaneously optimized.

The ‘options’ slot contains a list of options for the model. The name of each entry in the list is the option name to be used at runtime. The values in this list are the values of the optimizer options. The standard interface for updating options is through the mxOption function.

The ‘output’ slot contains a list of output added to the model by the mxRun function. Output includes parameter estimates, optimization information, model fit, and other information. If a model has not been optimized using the mxRun function, the 'output' slot will be 'NULL'.

Named entities in MxModel objects may be viewed and referenced by name using the $ symbol. For instance, for an MxModel named "yourModel" containing an MxMatrix named "yourMatrix", the contents of "yourMatrix" can be accessed as yourModel$yourMatrix. Slots (i.e., matrices, algebras, etc.) in an mxMatrix may also be referenced with the $ symbol (e.g., yourModel$matrices or yourModel$algebras). See the documentation for Classes and the examples in mxModel for more information.

### Objects from the Class

Objects can be created by calls of the form `mxModel()`.

### Slots

`name`:

  Character string. The name of the model object.

`matrices`:

  List of the model's MxMatrix objects.

`algebras`:

  List of the model's MxAlgebra objects.

`constraints`:

  List of the model's MxConstraint objects.

`intervals`:

  List of the model's MxInterval objects, requested via `mxCI()`.

`latentVars`:

  "Latent variables;" object of class `"MxCharOrList"`.

`manifestVars`:

  "Manifest variables;" object of class `"MxCharOrList"`.

`data`:

  Object of class MxData.

`submodels`:

  List of MxModel objects.

`expectation`:

  Object of class MxExpectation; dictates the model's specification.

`fitfunction`:

  Object of class MxFitFunction; dictates the cost function to be minimized when fitting the model.

`compute`:

  Object of class MxCompute–the model's compute plan, which contains instructions on what the model is to compute and how to do so.

`independent`:

  Logical; is the model to be run independently from other submodels?

`options`:

  List of model-specific options, set by `mxOption()`.

`output`:

  List of model output produced during a call to `mxRun()`.

`runstate`:

  List produced by `mxRun()`, which contains the pre-run state of the model object.

`.newobjects`:

  Logical; for internal use.

`.resetdata`:

  Logical; for internal use.

`.wasRun`:

  Logical; for internal use.

`.modifiedSinceRun`:

  Logical; for internal use.

`.version`:

  Object of class `"package_version"`; for internal use.

### Methods

$

  `signature(x = "MxModel")`: Accessor. Accesses slots by slot-name. Also accesses constituent named entities, by name.

$<-

  `signature(x = "MxModel")`: Assignment. Generally, this method will not allow the user to make unsafe changes to the MxModel object.

[[

  `signature(x = "MxModel")`: Accessor for constituent named entities.

[[<-

  `signature(x = "MxModel")`: Assignment for a named entity.

names

  `signature(x = "MxModel")`: Returns names of slots and named entities.

print

  `signature(x = "MxModel")`: "Print" method.

show

  `signature(object = "MxModel")`: "Show" method.

Note that `imxInitModel()`, `imxModelBuilder()`, `imxTypeName()`, and `imxVerifyModel()` are separately documented methods for class "MxModel".

### References

The OpenMx User's guide can be found at http://openmx.ssri.psu.edu/documentation.

### See Also

mxExpectationRAM, mxExpectationLISREL, mxModel for creating MxModel objects. More information about the OpenMx package may be found here.

### Examples

    showClass("MxModel")

[Package OpenMx version 2.17.3 Index]