MxData-class {OpenMx}R Documentation

MxData Class


MxData is an S4 class. An MxData object is a named entity. New instances of this class can be created using the function mxData. MxData is an S4 class union. An MxData object is either NULL or a MxNonNullData object.


The MxNonNullData class has the following slots:

name - The name of the object
observed - Either a matrix or a data frame
vector - A vector for means, or NA if missing
type - Either 'raw', 'cov', 'cor', or 'sscp'
numObs - The number of oberservations

The 'name' slot is the name of the MxData object.

The ‘observed’ slot is used to contain data, either as a matrix or as a data frame. Use of the data in this slot by other functions depends on the value of the 'type' slot. When 'type' is equal to 'cov', 'cor', or 'sscp', the data input into the 'matrix' slot should be a symmetric matrix or data frame.

The 'vector' slot is used to contain a vector of numeric values, which is used as a vector of means for MxData objects with 'type' equal to 'cov', 'cor', or 'sscp'. This slot may be used in estimation using the mxMLObjective function.

The 'type' slot may take one of four supported values:

The 'numObs' slot describes the number of observations in the data. If 'type' equals 'raw', then 'numObs' is automatically populated as the number of rows in the matrix or data frame in the ‘observed’ slot. If 'type' equals 'cov', 'cor', or 'sscp', then this slot must be input using the 'numObs' argument in the mxData function when the MxData argument is created.

MxData objects may not be included in MxAlgebra objects or use the mxAlgebraObjective function. If these capabilities are desired, data should be appropriately input or transformed using the mxMatrix and mxAlgebra functions.

While column names are stored in the ‘observed’ slot of MxData objects, these names are not recognized as variable names in MxPath objects. Variable names must be specified using the 'manifestVars' argument of the mxModel function prior to use in MxPath objects.

The mxData function does not currently place restrictions on the size, shape, or symmetry of matrices input into the ‘observed’ argument. While it is possible to specify MxData objects as covariance, correlation or sscp matrices that do not have the properties commonly associated with these matrices, failure to correctly specify these matrices will likely lead to problems in model estimation.


The OpenMx User's guide can be found at

See Also

mxData for creating MxData objects, matrix and data.frame for objects which may be entered as arguments in the 'matrix' slot. More information about the OpenMx package may be found here.

[Package OpenMx version 0.2.2-951 Index]