Description
The function omxSelectRowsAndCols
filters rows and columns from an mxMatrix using a single row or column R matrix as a selector. The function omxSelectRows
can be used to only filter rows and the function omxSelectCols
can be used to only filter columns.
Usage
omxSelectRowsAndCols(mxMatrixToBeFiltered, selectorMatrix)
omxSelectRows(mxMatrixToBeFiltered, selectorMatrix)
omxSelectCols(mxMatrixToBeFiltered, selectorMatrix)
Arguments
mxMatrixToBeFiltered
- A mxMatrixselectorMatrix
- A single row or single column R matrix indicating which values should be filtered from the mxMatrix.
Details
omxSelectRowsAndCols
, omxSelectRows
, and omxSelectCols
returns the filtered entries in a mxMatrix
specified by a single row or single column selector matrix. Each entry in the selector matrix is treated as a logical data indicating if the corresponding entry in the mxMatrix
should be excluded (0 or FALSE) or included (not 0 or TRUE). Typically the function is used to filter data from an mxMatrix
using an existence vector which specifies what data entries are missing. This can be seen in the demo: FIMLRowObjectiveBivariateCorrelation.R.
Value
Returns a new MxMatrix
object with the filtered data.
References
The function is most often used when filtering data for missingness. This can be seen in the demo: FIMLRowObjectiveBivariateCorrelation.R. The OpenMx User's guide can be found at https://openmx.ssri.psu.edu/documentation. The omxSelect*
functions share some similarity to the Extract function in the R programming language.
Examples
loadings <- c(1, -0.625, 0.1953125, 1, -0.375, 0.0703125, 1, -0.375, 0.0703125)
loadings <- matrix(loadings, 3, 3, byrow= TRUE)
loadingsMatrix <- mxMatrix("Full", free=FALSE, values=loadings, name="loadingsMatrix", byrow=TRUE)
existenceList <- c(1, 0, 1)
existenceList <- matrix(existenceList, 1, 3, byrow= TRUE)
rowsAndCols <- omxSelectRowsAndCols(loadingsMatrix, existenceList)
rows <- omxSelectRows(loadingsMatrix, existenceList)
cols <- omxSelectCols(loadingsMatrix, existenceList)