Learn R Programming

umx (version 1.4.9)

umx: Helper Functions for Structural Equation Modelling in OpenMx

Description

umx allows you to more easily build, run, modify, and report models using OpenMx with code. The core functions are linked below under See Also

Arguments

Details

The functions are organized into families: Have a read of these below, click to explore.

All the functions have explanatory examples, so use the help, even if you think it won't help :-) Have a look, for example at umxRAM

Introductory working examples are below. You can run all demos with demo(umx) When I have a vignette, it will be: vignette("umx", package = "umx")

There is a helpful blog at http://tbates.github.io

If you want the bleeding-edge version:

devtools::install_github("tbates/umx")

References

- http://www.github.com/tbates/umx

See Also

Other Advanced Model Building Functions: umxJiggle, umxLabel, umxRAM2Ordinal, umxThresholdMatrix, umxValues, umx_fix_first_loadings, umx_fix_latents

Other Core Modelling Functions: plot.MxModel, umxDiagnose, umxLatent, umxMatrix, umxPath, umxRAM, umxReduce, umxRun

Other Data Functions: umxCovData, umxFactor, umxHetCor, umxPadAndPruneForDefVars, umx_as_numeric, umx_cont_2_quantiles, umx_cov2raw, umx_lower2full, umx_make_MR_data, umx_make_bin_cont_pair_data, umx_make_fake_data, umx_merge_CIs, umx_read_lower, umx_reorder, umx_residualize, umx_round, umx_scale_wide_twin_data, umx_scale, umx_swap_a_block

Other File Functions: dl_from_dropbox, umx_make_sql_from_excel, umx_move_file, umx_open, umx_rename_file

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

Other Modify or Compare Models: umxAdd1, umxDrop1, umxEquate, umxFixAll, umxMI, umxSetParameters, umxUnexplainedCausalNexus

Other Reporting Functions: loadings.MxModel, mxSE, umxAPA, umxGetParameters, umxSummary, umx_APA_pval, umx_aggregate, umx_print, umx_show, umx_time

Other Stats Functions: reliability, umxCov2cor, umx_cor, umx_means

Other Super-easy helpers: umxEFA, umxTwoStage

Other Twin Modeling Functions: plot.MxModel, umxACESexLim, umxACEcov, umxACE, umxCF_SexLim, umxCP, umxGxE_window, umxGxE, umxIP, umxPlotACEcov, umxPlotCP, umxPlotGxE, umxPlotIP, umxSummaryACEcov, umxSummaryACE, umxSummaryCP, umxSummaryGxE, umxSummaryIP, umx_make_TwinData

Other Utility Functions: qm, umx_find_object, umx_grep, umx_msg, umx_names, umx_paste_names, umx_pb_note, umx_print, umx_rename

Other zAdvanced Helpers: umx_standardize_ACEcov, umx_standardize_ACE, umx_standardize_CP, umx_standardize_IP

Examples

Run this code
require("umx")
data(demoOneFactor)
myData = mxData(cov(demoOneFactor), type = "cov", numObs = nrow(demoOneFactor))
latents = c("G")
manifests = names(demoOneFactor)
m1 <- umxRAM("One Factor", data = myData,
	umxPath(latents, to = manifests),
	umxPath(var = manifests),
	umxPath(var = latents  , fixedAt=1)
)

omxGetParameters(m1) # Wow! Now your model has informative labels, & better starts

# Let's get some journal-ready fit information

umxSummary(m1) 
umxSummary(m1, show = "std") #also display parameter estimates 
# You can get the coefficients of an MxModel with coef(), just like for lm etc.
coef(m1)

# ==================
# = Model updating =
# ==================
# Can we set the loading of X5 on G to zero?
m2 = omxSetParameters(m1, labels = "G_to_x1", values = 0, free = FALSE, name = "no_g_on_X5")
m2 = mxRun(m2)
# Compare the two models
umxCompare(m1, m2)

# Use umxModify to do the same thing in 1-line
m2 = umxModify(m1, "G_to_x1", name = "no_effect_of_g_on_X5", comparison = TRUE)

# =================================
# = Get some Confidence intervals =
# =================================

confint(m1, run = TRUE) # lots more to learn about ?confint.MxModel

# And make a Figure in .gv format!

# plot(m1, std = TRUE)
# If you just want the .dot code returned set file = NA
plot(m1, std = TRUE, file = NA)

Run the code above in your browser using DataLab