Learn R Programming

⚠️There's a newer version (4.20.0) of this package.Take me there.

umx

umx is a structural equation modeling package designed to make SEM easier to build, modify, and report.

It includes high-level functions for complex models such as multi-group twin models, as well as for graphical model output.

Grab it from CRAN with

install.packages("umx")
library(umx)
?umx

The best way to learn what is on offer is to use the help ('?umx' works) and the online tutorial: tbates.github.io

umx stands for "user" OpenMx functions. It provides over 100 functions from high-level umxRAM and umxPath functions that make Structural Equation Modeling in R straightforward, to low-level functions to automate activities such as labelling, setting start values etc.,

Some highlights include:

  1. Building Path Models
    • umxRAM() # mxModel with smart data = parameter, no need to specify type = "RAM", + auto-discovery of manifests and latents from the paths you write
    • umxPath() # mxPath on steroids: one-word settings to set var , mean cov, fixedAt 'v.m.' = and more. Great time-saver!
  2. Reporting output
    • umxSummary(model) # A model fit designed for journal reporting (Χ², p, CFI, TLI, & RMSEA). Optionally show the path loadings
    • plot(model, std=T, digits = 3, file = "name") # Graphical, editable output of model in your browser!
  3. Modify models
    • umxModify() *# Modify and run a model. You can add objects, drop or add paths, including by regular-expression label matching), re-name the model, re-run, and even return the comparison. All in 1 line *
    • umxParameters(m1, "below", .1, pattern="_to_")) # A powerful assistant to get labels from a model (e.g. all 'to' params, below .1 in value)
  4. Twin modeling!
    • umxACE() # Twin ACE modeling with aplomb paths are labeled! Works with plot() and umxSummary!
    • umxCP(), umxIP(), umxGxE(), umxCP()
  5. Easy-to-remember options
    • umx_set_cores()
    • umx_set_optimizer()
  6. Many more miscellaneous helpers e.g.
    • umx_time(model) # Report the time taken by a model in a compact programable format
    • umxHcor(data, use = "pairwise.complete.obs") # Compute appropriate pair-wise correlations for mixed data types.
    • Dozens more (?umx to see them all). Check out the "family links" in any help file also!

Feel free to use, and submit code and requests via Github. Tell your friends! Publish more good science :-)

For thrill-seekers and collaborators only: the bleeding-edge development version is here:

install.packages("devtools")
library("devtools")
install_github("tbates/umx")
library("umx")
?umx

Copy Link

Version

Install

install.packages('umx')

Monthly Downloads

2,198

Version

1.9.1

License

GPL-3

Issues

Pull Requests

Stars

Forks

Maintainer

Last Published

November 2nd, 2017

Functions in umx (1.9.1)

dl_from_dropbox

dl_from_dropbox
extractAIC.MxModel

Extract AIC from MxModel
qm

qm
reliability

reliability
umxCF_SexLim

umxCF_SexLim
umxCI

Add (and, optionally, run) confidence intervals to a structural model.
umxDiagnose

Diagnose problems in a model - this is a work in progress.
umxDrop1

umxDrop1: Unfinished function to mimic drop1 in OpenMx
umxJiggle

umxJiggle
umxLabel

umxLabel: Add labels to a RAM model, matrix, or path
umxLatent

umxLatent: Helper to ease making formative and reflective latent variables
umxMI

Report modifications which would improve fit.
umxRun

umxRun: Run an mxModel
umxSetParameters

umxSetParameters: Set parameters in an mxModel
umxSummaryGxE

umxSummaryGxE
umxSummaryIP

Present the results of an independent-pathway twin model in table and graphical form
umx_add_variances

umx_add_variances
umx_aggregate

Convenient formula-based cross-tabs & built-in summary functions
umx_cor

umx_cor
umx_cov2raw

Turn a cov matrix into raw data with umx_cov2raw
umx_explode

umx_explode - like the php function `explode`
umx_explode_twin_names

Break twin variable names (BMI_T1, BMI_T2) into base variable names (BMI, "_T", 1:2)
umx_is_class

Check if variables in a dataframe are in a list of classes.
umx_is_cov

umx_is_cov
umx_is_numeric

Check if variables in a dataframe are numeric
umx_is_ordered

Test if one or more variables in a dataframe are ordered
umx_move_file

Move files
umx_msg

Print the name and compact contents of variable.
umx_read_lower

Read lower-triangle of data matrix from console or file
umx_rename

umx_rename
umx_round

umx_round
umx_scale

Scale data columns, skipping non-scalable columns
umx_set_optimizer

umx_set_optimizer
umx_set_plot_file_suffix

Set output suffix used in umx plot (structural diagrams) files to disk
umx_write_to_clipboard

umx_write_to_clipboard
us_skinfold_data

Anthropometric data on twins
xmuHasSquareBrackets

xmuHasSquareBrackets
xmuLabel_MATRIX_Model

xmuLabel_MATRIX_Model (not a user function)
xmu_check_levels_identical

xmu_check_levels_identical
xmu_dot_make_paths

xmu_dot_make_paths (not for end users)
RMSEA

Generic RMSEA function
RMSEA.summary.mxmodel

RMSEA function for MxModels
umx-deprecated

Deprecated. May already stop() code and ask to be updated. May be dropped entirely in future.
umx

Helper Functions for Structural Equation Modelling in OpenMx
umxCI_boot

umxCI_boot
umxCP

umxCP: Build and run a Common pathway twin model
umxExpMeans

umxFactor

umxFactor
umxGxE

umxGxE: Implements ACE models with moderation of paths, e.g. by SES.
umxGxE_window

Implement the moving-window form of GxE analysis.
umxMatrix

umxMatrix: labeled mxMatrix, with name in the first place
umxModel

Catches users typing umxModel instead of umxRAM
umxPlotCP

Draw a graphical figure for a Common Pathway model
umxPlotGxE

Plot the results of a GxE univariate test for moderation of ACE components.
umxSummary.MxModel

Shows a compact, publication-style, summary of a RAM model
umxSummary

Shows a compact, publication-style, summary of umx models
umx_apply

umx_apply
umx_as_numeric

umx_as_numeric
umx_check_model

umx_check_model
umx_check_names

umx_check_names
umx_fix_latents

umx_fix_latents
umx_fun_mean_sd

umx_fun
umx_is_MxModel

umx_is_MxModel
umx_is_RAM

umx_is_RAM
umx_make_TwinData

Simulate twin data with control over A, C, and E parameters, as well as moderation of A.
umx_make_bin_cont_pair_data

Make pairs of bin & continuous columns to represent censored data
umx_means

umx_means
umx_merge_CIs

umx_merge_CIs
umx_rename_file

umx_rename_file
umx_reorder

Reorder or drop variables from a correlation/covariance matrix.
umx_set_condensed_slots

umx_set_condensed_slots
umx_set_cores

umx_set_cores
umx_standardize_ACEv

Standardize an ACE variance components model (ACEv)
umxEFA

umxEFA
umxEquate

umxEquate: Equate two or more paths
umxFactorScores

Return factor scores from a model as an easily consumable dataframe.
umxFitIndices

Get additional fit-indices for a model with umxFitIndices
umx_standardize_CP

umx_standardize_CP
umx_string_to_algebra

Convert a string to an OpenMx algebra
umx_swap_a_block

umx_swap_a_block
xmuMakeTwoHeadedPathsFromPathList

xmuMakeTwoHeadedPathsFromPathList
xmuMaxLevels

xmuMaxLevels
xmu_dot_make_residuals

xmu_dot_make_residuals (not for end users)
umxReduceACE

Reduce an ACE model.
umxReduceGxE

Reduce a GxE model.
umxValues

umxValues: Set values in RAM model, matrix, or path
xmu_dot_maker

Internal umx function to help plotting graphviz
umxVersion

Get or print the version of umx, along with detail from OpenMx and general system info.
umx_long2wide

Take a long twin-data file and make it wide (one family per row)
umx_lower2full

Convert lower-only matrix data to full (or enforce symmetry on a full matrix)
umx_scale_wide_twin_data

umx_scale_wide_twin_data
umx_set_auto_plot

umx_set_auto_plot
umx_standardize_IP

umx_standardize_IP
umx_standardize_RAM

Return a standardized version of a Structural Model
GFF

Twin data: General Family Functioning, divorce, and wellbeing.
RMSEA.MxModel

RMSEA function for MxModels
umxACE

Build and run a 2-group Cholesky twin model (uni-variate or multi-variate)
umxACESexLim

umxACESexLim: Build and run a sex-limitation twin model (not working yet)
umxAdd1

umxAdd1
umxBrownie

A recipe Easter-egg for umx
umxCov2cor

Convert a covariance matrix into a correlation matrix
umxCovData

Convert a dataframe into a cov mxData object
umxPath

Easier (and powerful) specification of paths in SEM.
umxPlotACE

umxPlotACE
umxRAM2Ordinal

umxRAM2Ordinal
umxReduce

Reduce models, and report the results.
umxSummaryACEv

Shows a compact, publication-style, summary of a variance-based Cholesky ACE model.
umxSummaryCP

Present the results of a Common-pathway twin model in table and graphical form
umx_check

umx_check
umx_check_OS

umx_check_OS
umx_find_object

umx_find_object
umx_fix_first_loadings

umx_fix_first_loadings
umx_has_means

umx_has_means
umx_has_square_brackets

Check if a label contains square brackets
umx_is_exogenous

umx_is_exogenous
umx_is_endogenous

umx_is_endogenous
umx_make_fake_data

umx_make_fake_data
umx_make_sql_from_excel

umx_make_sql_from_excel
umx_pad

Pad an Object with NAs
umx_parameters

Display path estimates from a model, filtering by name and value.
umx_residualize

Easily residualize variables in long or wide dataframes, returning them changed in-place.
umx_rot

umx_rot
umx_standardize_ACE

umx_standardize_ACE
umx_standardize_ACEcov

umx_standardize_ACEcov
xmuMakeOneHeadedPathsFromPathList

xmuMakeOneHeadedPathsFromPathList
xmuMakeThresholdsMatrices

xmuMakeThresholdsMatrices (not a user function)
loadings

loadings Generic loadings function to extract factor loadings from exploratory or confirmatory factor analyses.
plot.MxModel

Create and display a graphical path diagram for a model.
residuals.MxModel

Get residuals from an MxModel
tmx_is.identified

Test if a factor model is identified
umxACEv

Build and run a 2-group Cholesky twin model (uni-variate or multi-variate) with variance estimates.
umxAPA

Creates nicely formatted journal style summaries of lm models, p-values, data-frames etc.
umxEval

umxEval
umxExpCov

Get the expected vcov matrix
umxFixAll

umxFixAll: Fix all free parameters
umxGetParameters

umxGetParameters: Get parameters from a model
umxACE_cov_fixed

Run a Cholesky with covariates ("fixed" / definition variables in the means style)
umxACEcov

Run a Cholesky with covariates, either fixed (def var in the means) or random (in the expected covariance matrix)
umxHetCor

Create a matrix of correlations for variables of diverse types (binary, ordinal, continuous)
umxIP

umxIP: Build and run an Independent pathway twin model
umxModify

umxModify: Add, set, or drop model paths by label.
umxPadAndPruneForDefVars

umxPadAndPruneForDefVars
umxPlotACEcov

Make a graphical display of an ACE model with covariates.
umxPlotACEv

Produce a graphical display of an ACE variance-components twin model
umxPlotIP

Draw a graphical figure for a Independent Pathway model
umxRAM

Easy-to-use RAM model maker.
umxSuperModel

Make a multi-group model
umxThresholdMatrix

Create the threshold matrix needed for modeling ordinal data.
umxTwoStage

umxTwoStage
umxUnexplainedCausalNexus

umxUnexplainedCausalNexus
umx_default_option

Select first item in list of options, while being flexible about choices.
umxSummaryACE

Shows a compact, publication-style, summary of a umx Cholesky ACE model
umxSummaryACEcov

Present results of a twin ACE-model with covariates in table and graphical forms.
umx_APA_model_CI

umx_APA_model_CI
umx_APA_pval

Round p-values according to APA guidelines
umx_get_options

umx_get_options
umx_drop_ok

umx_drop_ok
umx_grep

umx_grep
umx_is_MxData

Check if an object is an mxData object
umx_is_MxMatrix

umx_is_MxMatrix
umx_has_CIs

umx_has_CIs
umx_has_been_run

umx_has_been_run
umx_open

umx_open
umx_open_CRAN_page

Open the CRAN page for a package
umx_print

umx_r_test

Test the difference between correlations for significance.
umx_show

umx_show
umx_standardize

Return a standardized version of a Structural Model
umx_make

umx_make umx using devtools
umx_make_MR_data

Simulate Mendelian Randomization data
umx_paste_names

Concatenate base variable names with suffixes to create wide-format variable names (i.e twin-format)
umx_pb_note

umx_pb_note
umx_var

Get variances from a df that might contain some non-numeric columns
umx_wide2long

Change data 2-twin family data from wide to long format.
umx_set_plot_format

Set output format of plots (structural diagrams) in umx
umx_set_table_format

umx_set_table_format
umx_time

umx_time
umx_trim

Trim whitespace surrounding a string.
xmu_start_value_list

Make start values
xmu_twin_check

Check basic aspects of input for twin models
xmuLabel_Matrix

xmuLabel_Matrix (not a user function)
xmuLabel_RAM_Model

xmuLabel_RAM_Model (not a user function)
xmuMinLevels

xmuMinLevels
xmuPropagateLabels

xmuPropagateLabels (not a user function)
umxCompare

umxConfint

Get confidence intervals from an MxModel
umx_check_parallel

Check if OpenMx is using OpenMP, test cores, and get timings
umx_cont_2_quantiles

umx_cont_2_quantiles
xmuMI

xmuMI
xmuMakeDeviationThresholdsMatrices

Make a deviation-based mxRAMObjective for ordinal models.
install.OpenMx

Easily install the latest parallel/NPSOL enabled build of OpenMx.
loadings.MxModel

Extract factor loadings from an EFA (factor analysis).
umx_set_auto_run

umx_set_auto_run
umx_set_checkpoint

umx_set_checkpoint
umx_get_bracket_addresses

get mat[r,c] style cell address from an mxMatrix
umx_get_checkpoint

umx_get_checkpoint
umx_names

umx_names
umx_object_as_str

umx_object_as_str