Converts SEM models to RAM models for
OpenMx.
Usage
as_ram(x, ...)
# S3 method for class 'data.frame'
as_ram(x, groups = NULL, data = NULL, threshold_method = "mxThreshold", ...)Arguments
- x
An object for which a method exists, such as a
tidy_semobject, or character vector describing the user-specified model using the lavaan model syntax.- ...
Parameters passed on to other functions.
- groups
Character, either corresponding to the name of a column in
data, or else a vector of group names.- data
Optional, a
data.framewhich is added to the model.- threshold_method
Character, one of
c("mxThreshold", "mx_deviances"). Method used to specify thresholds for ordinal indicators. See themxThresholdfunction in theOpenMxpackage, andmx_deviances, respectively.
Value
Returns an mxModel.
Details
For models specified using lavaan syntax, the procedure is as follows:
Apply
lavaanifyto themodel. The default arguments tolavaanifycorrespond to those of thesemfunction.Apply the method for
data.frameto the resulting lavaan parameter table. This usesmxPathfor means, regression coefficients, and (co)variances, and the specifiedthreshold_methodfor thresholds.Apply
mxModelto the resulting list ofmxPathandmxMatrixelements to create anmxModelusing RAM specification.
Examples
as_ram("y ~ x")
#> MxModel 'model'
#> type : RAM
#> $matrices : 'A', 'S', 'F', and 'M'
#> $algebras : NULL
#> $penalties : NULL
#> $constraints : NULL
#> $intervals : NULL
#> $latentVars : none
#> $manifestVars : 'y' and 'x'
#> $data : NULL
#> $submodels : NULL
#> $expectation : MxExpectationRAM
#> $fitfunction : MxFitFunctionML
#> $compute : NULL
#> $independent : FALSE
#> $options :
#> $output : FALSE