Learn R Programming

umx (version 1.9.1)

umx_add_variances: umx_add_variances

Description

Convenience function to save the user specifying mxPaths adding variance to each variable

Usage

umx_add_variances(model, add.to, values = NULL, free = NULL)

Arguments

model

an mxModel to add variances to

add.to

= List of variables to create variance for

values

= List of values (default = NULL)

free

= List of variables to create variance for (default = NULL)

Value

- mxModel

References

- http://tbates.github.io, https://github.com/tbates/umx, http://openmx.ssri.psu.edu

See Also

Other Misc: umxEval, umx_APA_model_CI, umx_apply, umx_default_option, umx_get_bracket_addresses, umx_object_as_str, umx_string_to_algebra, umx

Examples

Run this code
# NOT RUN {
require(umx)
data(demoOneFactor)
m1 <- mxModel("One Factor", type = "RAM",
 manifestVars = names(demoOneFactor),
 latentVars = "g",
	mxPath(from = "g", to = names(demoOneFactor), values= .1),
	mxData(cov(demoOneFactor), type = "cov", numObs = 500)
)
umx_show(m1, matrices = "S") # variables lack variance :-(
m1 = umx_add_variances(m1, add.to = names(demoOneFactor))
m1 = umx_add_variances(m1, add.to = "g", FALSE, 1)
umx_show(m1, matrices = "S") 
# Note: latent g has been treated like the manifests...
# umxFixLatents() will take care of this for you...
m1 = umxRun(m1, setLabels = TRUE, setValues = TRUE)
umxSummary(m1)
# }

Run the code above in your browser using DataLab