xmu_safe_run_summary: Safely run and summarize a model

View source: R/xmu.R

xmu_safe_run_summaryR Documentation

Safely run and summarize a model

Description

The main benefit is that it returns the model, even if it can't be run.

The function will run the model if requested, wrapped in tryCatch() to avoid throwing an error. If summary = TRUE then umxSummary() is requested (again, wrapped in try).

note: If autoRun is logical, then it over-rides summary to match autoRun. This is useful for easy use umxRAM() and twin models.

Usage

xmu_safe_run_summary(
  model1,
  model2 = NULL,
  autoRun = TRUE,
  tryHard = c("no", "yes", "ordinal", "search"),
  summary = !umx_set_silent(silent = TRUE),
  std = "default",
  comparison = TRUE,
  digits = 3,
  intervals = FALSE,
  returning = c("model", "summary"),
  refModels = NULL
)

Arguments

model1

The model to attempt to run and summarize.

model2

Optional second model to compare with model1.

autoRun

Whether to run or not (default = TRUE) Options are FALSE and "if needed".

tryHard

Default ('no') uses normal mxRun. "yes" uses mxTryHard. Other options: "ordinal", "search"

summary

Whether to print model summary (default = autoRun).

std

What to print in summary. "default" = the object's summary default. FALSE = raw, TRUE = standardize, NULL = omit parameter table.

comparison

Toggle to allow not making comparison, even if second model is provided (more flexible in programming).

digits

Rounding precision in tables and plots

intervals

whether to run intervals or not (default FALSE)

returning

What to return (default, the run model)

refModels

whether to run refModels or not (default NULL)

Value

  • mxModel()

See Also

  • mxTryHard()

Other xmu internal not for end user: umxModel(), umxRenameMatrix(), umx_APA_pval(), umx_fun_mean_sd(), umx_get_bracket_addresses(), umx_make(), umx_standardize(), umx_string_to_algebra(), xmuHasSquareBrackets(), xmuLabel_MATRIX_Model(), xmuLabel_Matrix(), xmuLabel_RAM_Model(), xmuMI(), xmuMakeDeviationThresholdsMatrices(), xmuMakeOneHeadedPathsFromPathList(), xmuMakeTwoHeadedPathsFromPathList(), xmuMaxLevels(), xmuMinLevels(), xmuPropagateLabels(), xmuRAM2Ordinal(), xmuTwinSuper_Continuous(), xmuTwinSuper_NoBinary(), xmuTwinUpgradeMeansToCovariateModel(), xmu_CI_merge(), xmu_CI_stash(), xmu_DF_to_mxData_TypeCov(), xmu_PadAndPruneForDefVars(), xmu_bracket_address2rclabel(), xmu_cell_is_on(), xmu_check_levels_identical(), xmu_check_needs_means(), xmu_check_variance(), xmu_clean_label(), xmu_data_missing(), xmu_data_swap_a_block(), xmu_describe_data_WLS(), xmu_dot_make_paths(), xmu_dot_make_residuals(), xmu_dot_maker(), xmu_dot_move_ranks(), xmu_dot_rank_str(), xmu_extract_column(), xmu_get_CI(), xmu_lavaan_process_group(), xmu_make_TwinSuperModel(), xmu_make_bin_cont_pair_data(), xmu_make_mxData(), xmu_match.arg(), xmu_name_from_lavaan_str(), xmu_path2twin(), xmu_path_regex(), xmu_print_algebras(), xmu_rclabel_2_bracket_address(), xmu_set_sep_from_suffix(), xmu_show_fit_or_comparison(), xmu_simplex_corner(), xmu_standardize_ACEcov(), xmu_standardize_ACEv(), xmu_standardize_ACE(), xmu_standardize_CP(), xmu_standardize_IP(), xmu_standardize_RAM(), xmu_standardize_SexLim(), xmu_standardize_Simplex(), xmu_start_value_list(), xmu_starts(), xmu_summary_RAM_group_parameters(), xmu_twin_add_WeightMatrices(), xmu_twin_check(), xmu_twin_get_var_names(), xmu_twin_make_def_means_mats_and_alg(), xmu_twin_upgrade_selDvs2SelVars()

Examples

## Not run: 
tmp = mtcars
tmp$disp = tmp$disp/100
m1 = umxRAM("tim", data = tmp,
	umxPath(c("wt", "disp"), to = "mpg"),
	umxPath("wt", with = "disp"),
	umxPath(v.m. = c("wt", "disp", "mpg"))
)
m2 = umxModify(m1, "wt_to_mpg")

# Summary ignored if run is false
xmu_safe_run_summary(m1, autoRun = FALSE, summary = TRUE)
# Run, no summary
xmu_safe_run_summary(m1, autoRun = TRUE, summary = FALSE)
# Default summary is just fit string
xmu_safe_run_summary(m1, autoRun = TRUE, summary = TRUE)
# Show std parameters
xmu_safe_run_summary(m1, autoRun = TRUE, summary = TRUE, std = TRUE)
# Run + Summary + comparison
xmu_safe_run_summary(m1, m2, autoRun = TRUE, summary = TRUE, intervals = TRUE)
# Run + Summary + no comparison
xmu_safe_run_summary(m1, m2, autoRun = TRUE, summary = TRUE, std = TRUE, comparison= FALSE)


## End(Not run)


umx documentation built on May 29, 2024, 5:40 a.m.