umxGetLatents: Get the latentVars from a RAM model

umxGetLatentsR Documentation

Get the latentVars from a RAM model

Description

Get the latentVars from a RAM model, optionally targeting a submodel.

Usage

umxGetLatents(model, targetModel = NULL)

Arguments

model

a umxRAM()

targetModel

name of the model to extract from

Value

  • variables

See Also

  • umxGetManifests(), umxRAM(), umxSuperModel()

Other Reporting Functions: umx, umxAPA(), umxFactorScores(), umxGetManifests(), umxGetModel(), umxGetParameters(), umxParameters(), umx_aggregate(), umx_time()

Examples

## Not run: 
library(umx)
# Create two sets of data in which X & Y correlate ~ .4 in both datasets.
manifests = c("x", "y")
tmp = umx_make_TwinData(nMZpairs = 100, nDZpairs = 150, 
		AA = 0, CC = .4, EE = .6, varNames = manifests)

grp1   = tmp[tmp$zygosity == "MZ", manifests]
g1Data = mxData(cov(grp1), type = "cov", numObs = nrow(grp1), means=umx_means(grp1))

grp2   = tmp[tmp$zygosity == "DZ", manifests]
g2Data = mxData(cov(grp2), type = "cov", numObs = nrow(grp2), means=umx_means(grp2))
# Model 1 (could add autoRun = FALSE if you don't want to run this as it is being built)
m1 = umxRAM("m1", data = g1Data,
	umxPath("x", to = "y", labels = "beta"),
	umxPath(var = manifests, labels = c("Var_x", "Resid_y_grp1")),
	umxPath(means = manifests, labels = c("Mean_x", "Mean_y"))
)

# Model 2
m2 = umxRAM("m2", data = g2Data,
	umxPath("x", to = "y", labels = "beta"),
	umxPath(var = manifests, labels=c("Var_x", "Resid_y_grp2")),
	umxPath(means = manifests, labels=c("Mean_x", "Mean_y"))
)

m3 = umxSuperModel('top', m1, m2)
umxGetLatents(m3)
umxGetLatents(m3, targetModel = "m1")

## End(Not run)

tbates/umx documentation built on Dec. 14, 2024, 11:28 a.m.