mxExpectationRAM {OpenMx} | R Documentation |

This function creates an MxExpectationRAM object.

mxExpectationRAM(A="A", S="S", F="F", M = NA, dimnames = NA, thresholds = NA, threshnames = dimnames, ..., between=NULL, verbose=0L)

`A` |
A character string indicating the name of the 'A' matrix. |

`S` |
A character string indicating the name of the 'S' matrix. |

`F` |
A character string indicating the name of the 'F' matrix. |

`M` |
An optional character string indicating the name of the 'M' matrix. |

`dimnames` |
An optional character vector to be assigned to the column names of the 'F' and 'M' matrices. |

`thresholds` |
An optional character string indicating the name of the thresholds matrix. |

`threshnames` |
An optional character vector to be assigned to the column names of the thresholds matrix. |

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

`between` |
A character vector of matrices that specify cross model relationships. |

`verbose` |
integer. Level of runtime diagnostic output. |

Expectation functions define the way that model expectations are calculated. The mxExpectationRAM calculates the expected covariance and means of a given MxData object given a RAM model. This model is defined by reticular action modeling (McArdle and McDonald, 1984). The 'A', 'S', and 'F' arguments must refer to MxMatrix objects with the associated properties of the A, S, and F matrices in the RAM modeling approach.

The 'dimnames' arguments takes an optional character vector. If this argument is not a single NA, then this vector be assigned to be the column names of the 'F' matrix and optionally to the 'M' matrix, if the 'M' matrix exists.

The 'A' argument refers to the A or asymmetric matrix in the RAM approach. This matrix consists of all of the asymmetric paths (one-headed arrows) in the model. A free parameter in any row and column describes a regression of the variable represented by that row regressed on the variable represented in that column.

The 'S' argument refers to the S or symmetric matrix in the RAM approach, and as such must be square. This matrix consists of all of the symmetric paths (two-headed arrows) in the model. A free parameter in any row and column describes a covariance between the variable represented by that row and the variable represented by that column. Variances are covariances between any variable at itself, which occur on the diagonal of the specified matrix.

The 'F' argument refers to the F or filter matrix in the RAM approach. If no latent variables are included in the model (i.e., the A and S matrices are of both of the same dimension as the data matrix), then the 'F' should refer to an identity matrix. If latent variables are included (i.e., the A and S matrices are not of the same dimension as the data matrix), then the 'F' argument should consist of a horizontal adhesion of an identity matrix and a matrix of zeros.

The 'M' argument refers to the M or means matrix in the RAM approach. It is a 1 x n matrix, where n is the number of manifest variables + the number of latent variables. The M matrix must be specified if either the mxData type is “cov” or “cor” and a means vector is provided, or if the mxData type is “raw”. Otherwise the M matrix is ignored.

The MxMatrix objects included as arguments may be of any type, but should have the properties described above. The mxExpectationRAM will not return an error for incorrect specification, but incorrect specification will likely lead to estimation problems or errors in the mxRun function.

mxExpectationRAM evaluates with respect to an MxData object. The MxData object need not be referenced in the mxExpectationRAM function, but must be included in the MxModel object.

To evaluate, place mxExpectationRAM objects, the mxData object for which the expected covariance approximates, referenced MxAlgebra and MxMatrix objects, and optional MxBounds and MxConstraint objects in an MxModel object. This model may then be evaluated using the mxRun function. The results of the optimization can be found in the 'output' slot of the resulting model, and may be obtained using the mxEval function..

Returns a new MxExpectationRAM object. mxExpectationRAM objects should be included with models with referenced MxAlgebra, MxData and MxMatrix objects.

McArdle, J. J. and MacDonald, R. P. (1984). Some algebraic properties of the Reticular Action Model for moment structures. *British Journal of Mathematical and Statistical Psychology, 37,* 234-251.

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

# Create and fit a model using mxMatrix, mxAlgebra, # mxExpectationNormal, and mxFitFunctionML library(OpenMx) # Simulate some data x=rnorm(1000, mean=0, sd=1) y= 0.5*x + rnorm(1000, mean=0, sd=1) tmpFrame <- data.frame(x, y) tmpNames <- names(tmpFrame) # Define the matrices matrixS <- mxMatrix(type = "Full", nrow = 2, ncol = 2, values=c(1,0,0,1), free=c(TRUE,FALSE,FALSE,TRUE), labels=c("Vx", NA, NA, "Vy"), name = "S") matrixA <- mxMatrix(type = "Full", nrow = 2, ncol = 2, values=c(0,1,0,0), free=c(FALSE,TRUE,FALSE,FALSE), labels=c(NA, "b", NA, NA), name = "A") matrixF <- mxMatrix(type="Iden", nrow=2, ncol=2, name="F") matrixM <- mxMatrix(type = "Full", nrow = 1, ncol = 2, values=c(0,0), free=c(TRUE,TRUE), labels=c("Mx", "My"), name = "M") # Define the expectation expFunction <- mxExpectationRAM(M="M", dimnames = tmpNames) # Choose a fit function fitFunction <- mxFitFunctionML() # Define the model tmpModel <- mxModel(model="exampleRAMModel", matrixA, matrixS, matrixF, matrixM, expFunction, fitFunction, mxData(observed=tmpFrame, type="raw")) # Fit the model and print a summary tmpModelOut <- mxRun(tmpModel) summary(tmpModelOut)

[Package *OpenMx* version 2.7.9 Index]