Learn R Programming

umx (version 4.9.0)

xmu_starts: Helper providing boilerplate start values for means and variance in twin models

Description

xmu_starts can handle several common/boilerplate situations in which means and variance start values are used in twin models.

Usage

xmu_starts(
  mzData,
  dzData,
  selVars = selVars,
  sep = NULL,
  equateMeans = NULL,
  nSib,
  varForm = c("Cholesky"),
  SD = TRUE,
  divideBy = 3
)

Arguments

mzData

Data for MZ pairs.

dzData

Data for DZ pairs.

selVars

Variable names: If sep = NULL, then treated as full names for both sibs.

sep

All the variables full names.

equateMeans

(NULL)

nSib

How many subjects in a family.

varForm

currently just "Cholesky" style.

SD

= TRUE (FALSE = variance, not SD).

divideBy

= 3 (A,C,E) 1/3rd each. Use 1 to do this yourself post-hoc.

Value

  • varStarts and meanStarts

See Also

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(), umx, 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_safe_run_summary(), 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_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

Run this code
# NOT RUN {
data(twinData)
selDVs = c("wt", "ht")
mzData = twinData[twinData$zygosity %in%  "MZFF", ] 
dzData = twinData[twinData$zygosity %in%  "DZFF", ]

round(sqrt(var(dzData[,tvars(selDVs, "")], na.rm=TRUE)/3),3)
xmu_starts(mzData, dzData, selVars=selDVs, nSib= 2, sep="", equateMeans=TRUE, varForm="Cholesky")

# Variance instead of SD
round(var(dzData[,tvars(selDVs, "")], na.rm=TRUE)/3,3)
xmu_starts(mzData, dzData, selVars = selDVs, nSib = 2, sep= "", 
	equateMeans= TRUE, varForm= "Cholesky", SD= FALSE)

# one variable
xmu_starts(mzData, dzData, selVars= "wt", nSib = 2, sep="", equateMeans = TRUE)

# Ordinal/continuous mix
data(twinData)
twinData= umx_scale_wide_twin_data(data=twinData,varsToScale="wt",sep= "")
# Cut BMI column to form ordinal obesity variables
cuts     = quantile(twinData[, "bmi1"], probs = c(.5, .8), na.rm = TRUE)
obLevels = c('normal', 'overweight', 'obese')
twinData$obese1= cut(twinData$bmi1,breaks=c(-Inf,cuts,Inf),labels=obLevels)
twinData$obese2= cut(twinData$bmi2,breaks=c(-Inf,cuts,Inf),labels=obLevels)
# Make the ordinal variables into mxFactors
ordDVs = c("obese1", "obese2")
twinData[, ordDVs] = umxFactor(twinData[, ordDVs])
mzData = twinData[twinData$zygosity %in% "MZFF",] 
dzData = twinData[twinData$zygosity %in% "DZFF",]
xmu_starts(mzData, dzData, selVars = c("wt","obese"), sep= "", 
 nSib= 2, equateMeans = TRUE, SD= FALSE)

xmu_starts(mxData(mzData, type="raw"), mxData(mzData, type="raw"), 
   selVars = c("wt","obese"), sep= "", nSib= 2, equateMeans = TRUE, SD= FALSE)

# ==============
# = Three sibs =
# ==============
data(twinData)
twinData$wt3 = twinData$wt2
twinData$ht3 = twinData$ht2
selDVs = c("wt", "ht")
mzData = twinData[twinData$zygosity %in%  "MZFF", ] 
dzData = twinData[twinData$zygosity %in%  "DZFF", ]

xmu_starts(mzData, dzData, selVars=selDVs, sep="", nSib=3, equateMeans=TRUE)
xmu_starts(mzData, dzData, selVars=selDVs, sep="", nSib=3, equateMeans=FALSE)
# }

Run the code above in your browser using DataLab